- Create the deployment and expose it using a Load Balancer
kubectl apply -f demo.yaml
- Wait for the LoadBalancer
$ kubectl get services lb-service --watch
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
lb-service LoadBalancer 10.76.7.155 35.205.231.57 80:30526/TCP 10m
- Poll the application constantly
$ while true; do curl 35.205.231.57/hostname; echo ; sleep 1; done
server-deployment-8c8d64764-jsmsm
server-deployment-8c8d64764-jsmsm
server-deployment-8c8d64764-sggwl
server-deployment-8c8d64764-jsmsm
server-deployment-8c8d64764-sggwl
- Update the deployment image and observe how the pods names change without any disruption
kubectl set image deployment/server-deployment agnhost=k8s.gcr.io/e2e-test-images/agnhost:2.40