Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have aws-eks cluster and below is my command to replace existing the configuration.

kubectl create configmap flink-config --from-file=./config -o yaml --dry-run | kubectl replace -

but when I run this command. it gives an error like

W1009 17:00:14.998329  323115 helpers.go:553] --dry-run is deprecated and can be replaced with --dry-run=client.

Will it do the same thing If I replace -dry-run to -dry-run=client?

like image 831
NIrav Modi Avatar asked Oct 09 '20 11:10

NIrav Modi


1 Answers

About dry-run=client we learn

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

And in the kubernetes API reference we read:

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

Performing local tests I realized that when I try to replace an existing config object using dry-run=server, the following error occurs. The apiserver told us that already exist a configmap with the name flink-config.

kubectl create configmap flink-config --from-file=./config -o yaml --dry-run=server
Error from server (AlreadyExists): configmaps "flink-config" already exists

However is I try with to use dry-run=client the object is not validated by the apiserver, that is, just by the client, so the yaml is printed to us:

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

So basically, yes, the dry-run=client it has the same effect than the deprecated dry-run. The equivalent flag for dry-run=server was --server-dry-run and became deprecated in v1.18.

like image 121
Daniel Marques Avatar answered Oct 24 '22 21:10

Daniel Marques