Deployment update strategy – rolling-update

The following will introduce the subcommands edit and set, for the purpose of updating the containers under Deployment:

  1. First, let's update the Pods in Deployment with a new command:
// get into editor mode with the command below// the flag "--record" is for recording the update// add the command argument as below and save the change$ kubectl edit deployment simple-nginx --recordspec:  replicas: 5  ...  template:    ...    spec:      containers:      - image: nginx        command:           - sh          - -c          - echo "Happy Programming with Kubernetes!" > /usr/share/nginx/html/index.html && service nginx stop && nginx -g "daemon off;"        imagePullPolicy: Always        ...deployment.extensions "simple-nginx" edited

We are not only doing the update; ...

Get Kubernetes Cookbook, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.