gpt4 book ai didi

kubernetes - kubectl : --dry-run is deprecated and can be replaced with --dry-run=client

转载 作者:行者123 更新时间:2023-12-03 23:20:04 35 4
gpt4 key购买 nike

我有 aws-eks 集群,下面是我替换现有配置的命令。

kubectl create configmap flink-config --from-file=./config -o yaml --dry-run | kubectl replace -
但是当我运行这个命令时。它给出了一个错误,如
W1009 17:00:14.998329  323115 helpers.go:553] --dry-run is deprecated and can be replaced with --dry-run=client.
如果我将 -dry-run 替换为 -dry-run=client,它会做同样的事情吗?

最佳答案

关于我们学习的dry-run=client

--dry-run=client flag to preview the object that would be sent toyour cluster, without really submitting it.


在 kubernetes API 引用中,我们读到:

Must be "none", "server", or "client". If client strategy, only printthe object that would be sent, without sending it. If server strategy,submit server-side request without persisting the resource.


执行本地测试时,我意识到当我尝试使用 dry-run=server 替换现有配置对象时,会发生以下错误。 apiserver 告诉我们已经存在一个名为 flink-config 的配置映射。
kubectl create configmap flink-config --from-file=./config -o yaml --dry-run=server
Error from server (AlreadyExists): configmaps "flink-config" already exists
但是,我尝试使用 dry-run=client 对象未由 apiserver 验证,即仅由客户端验证,因此 yaml 打印给我们:
kubectl create configmap flink-config --from-file=./config -o yaml --dry-run=client
apiVersion: v1
data:
config: |
FOO: foo
MYVAR: hello
kind: ConfigMap
metadata:
creationTimestamp: null
name: flink-config
所以基本上,是的, dry-run=client 它与已弃用的 dry-run 具有相同的效果。 dry-run=server 的等效标志是 --server-dry-run,并在 v1.18 中被弃用。

关于kubernetes - kubectl : --dry-run is deprecated and can be replaced with --dry-run=client,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64279343/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com