Kubernetes Deployment 101

1 min read

Table of Contents

Create deployment

To create deployment from command line use the following command, --dry-run will just show resource and not create. -o yaml will show output as yaml

kubectl create deployment nginx-deployment --image=busybox --dry-run -o yaml

Few useful flags to use.

  • -r for creating replicas. By default it is 1.

Scale deployment

kubectl scale deployment/nginx-deployment --replicas=2

More in docs

Expose deployment as service

kubectl expose deployment nginx-deployment --port=80 --target-port=8000  --type=LoadBalancer --name=my-service