O'Reilly logo

Kubernetes Cookbook, 2nd Edition by Ke-Jou Carol Hsu, Hui-Chuan Chloe Lee, Hideto Saito

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required