Kubectl run with replicas

10/13/2021

I am trying to create a deployment with Kubectl run. I want to specify replicas as part of the command. I get

Error: unknown flag: --replicas

Is this deprecated in the current version. If yes how do we achieve replicas.

-- Rahul
kubectl
kubernetes

1 Answer

10/14/2021

Using kubectl run for deployments has been deprecated for quite some time and removed in a recent kubernetes version.

If you want to create a deployment using the kubectl commandline, use

kubectl create deployment $deploymentname --image $image --replicas $replicacount

see the official documentation for here for more detail.

-- meaningqo
Source: StackOverflow