Hello,
Before, we used the “kubectl run” command to create a deployment with the pods.
Today, how can I use a single command to do that ?
I’m searching, and I only find yaml files to apply.
The old command is :
kubectl run sample-nginx --image=nginx --replicas=2 --port=80
I’m looking for a single command to create a deployment with the 2 pods.
This won’t work :
kubectl create deployment sample-nginx --image=nginx --replicas=2 --port=80
Because, there are no “replicas” flag.
And they don’t even talk about “replicas” in kubectl create --help
.
In a deployment yaml file, we can say :
spec:
replicas: 3
This works :
kubectl create deployment sample-nginx --image=nginx
kubectl scale deployment sample-nginx --replicas=2
Is it the good way to do that ?
Is it impossible to add replicas with kubectl create deployment
?
Thanks