vic
vic

Reputation: 2816

invalid argument "client" for "--dry-run"

After I run the following kubectl command

kubectl create deployment springdeployment --image=docker.io/me/sample-app:latest -o yaml --dry-run=client > sample-app.yaml

I get an error:

Error: invalid argument "client" for "--dry-run" flag: strconv.ParseBool: parsing "client": invalid syntax

although "client" is one of three argument options for "--dry-run" according to kubectl document.

My kubectl version is

Client Version: version.Info{Major:"1", Minor:"14+", GitVersion:"v1.14.10-dispatcher", GitCommit:"f5757a1dee5a89cc5e29cd7159076648bf21a02b", GitTreeState:"clean", BuildDate:"2020-02-12" 

Based on online data, someone else also run into this error. I, however, haven't seen a solution.

How to resolve this issue?

Upvotes: 4

Views: 4702

Answers (2)

Rakesh Gupta
Rakesh Gupta

Reputation: 3760

To add clarity to @henry's answer, use --dry-run=1 as shown below, as some versions do not support client as value so, 1 works instead in those cases

kubectl create deployment nginx-deploy --image=nginx:1.1 --dry-run=1 -o yaml > nginx-deploy.yml

Upvotes: 0

Henry
Henry

Reputation: 43788

Your version of kubernetes (kubectl) is too old to support --dry-run=client. In your version this flag was just a boolean.

Upvotes: 7

Related Questions