3.2.7 Updating your application

View in the book. Buy the book.

Update the deployment manifest with the new version.

Using the editor, change the version.

Cloud Editor

It should look like:

Apply the change:

$ cd Chapter03/3.2_DeployingToKubernetes/
$ kubectl apply -f deploy.yaml
deployment.apps/timeserver configured

Get the status:

$ kubectl get deploy
NAME         READY   UP-TO-DATE   AVAILABLE   AGE
timeserver   3/3     1            3           16m

Watch the rollout in realtime

watch -d kubectl get deploy

Or, printing the changes:

$ kubectl get deploy -w
NAME         READY   UP-TO-DATE   AVAILABLE   AGE
timeserver   3/3     2            3           17m
timeserver   4/3     2            4           18m
timeserver   3/3     2            3           18m
timeserver   3/3     3            3           18m

You can also get the deployment by name (important if you have many deployments)

kubectl get deploy $DEPLOYMENT_NAME
$ kubectl get deploy timeserver
NAME         READY   UP-TO-DATE   AVAILABLE   AGE
timeserver   3/3     3            3           19m

And view just the Pods from the Deployment by using their labels (useful when you have lots of Pods)

$ kubectl get pods --selector=pod=timeserver-pod
NAME                          READY   STATUS              RESTARTS   AGE
timeserver-7d778fcbc4-8cxwg   1/1     Running             0          2m5s
timeserver-f94cc5dd9-l56wg    1/1     Running             0          68s
timeserver-f94cc5dd9-qjksn    0/1     ContainerCreating   0          52s
timeserver-f94cc5dd9-xwbnx    1/1     Running             0          18m