Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubernetes deployment Error: unknown flag: --replicas issue

Tags:

kubernetes

While creating a deployment using command

kubectl create deploy nginx --image=nginx:1.7.8 --replicas=2 --port=80

I am getting error Error: unknown flag: --replicas

controlplane $ kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:58:59Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:50:46Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
controlplane $ kubectl create deploy nginx --image=nginx:1.7.8 --replicas=2 --port=80
Error: unknown flag: --replicas
See 'kubectl create deployment --help' for usage.

Could anyone please help me with the reason for this as this command is working on other Kubernetes clusters?

like image 473
Ashu Avatar asked May 10 '26 09:05

Ashu


1 Answers

You may try to put a blank character between -- and the commands For example

kubectl create deploy nginx --image=nginx:1.7.8 -- replicas=2

It's work for me.

like image 186
Tim Wang Avatar answered May 13 '26 20:05

Tim Wang