kubectl create deployment command using template example

2/4/2019

The kubernetes doc has a deprecated kubectl run command that I'm looking forward to run using kubectl create deployment command with --template option without using external json/yaml file. I'd appreciate your help in this.

The deprecated command that I'm looking forward to translate is below: kubectl run hello-world --replicas=5 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0 --port=8080

Simply put, how do i re-write the above kubectl run command with kubectl create deployment command using --template option?

-- karthiks
kubectl
kubernetes

1 Answer

2/7/2019

You can use run-pod/v1 generator in kubectl run command as it is not deprecated for Pod resource instead of deployment/apps.v1 for deployments, find more information about Kubernetes API generators here.

kubectl run hello-world --replicas=5 --labels="run=load-balancer-example" --image=gcr.io/google-samples/node-hello:1.0  --port=8080 --generator=run-pod/v1
-- mk_sta
Source: StackOverflow