305-998-7702 | 415-800-2922 info@rx-m.com

Cloud Native Short Take – Kubernetes Deployment

(Nov. 17, 2021) – Welcome to another cloud native short take from RX-M. My name is Chris…

(Nov. 17, 2021) – Welcome to another cloud native short take from RX-M. My name is Chris Hanson today we are going to talk about the Kubernetes module “Deployments”. In this module we talk about the workings of a number of Kubernetes controllers with a specific emphasis on the Deployment controller and its zero downtime application rollout feature.

I use a couple of terminals in the video to demo some commands. First we take a look at the Deployment manifest, which is fairly standard and uses the default rolling update percentages and 10 replicas so we can see lots of change happen as we do rollouts. RX-M has a demo image called “hostinfo” which essentially spits out its hostname so we can see the ReplicaSet hashes change over time. The demo also uses a busybox client pod that queries the service name in a shell loop so that we can see the app’s availability during the rolling update.

As we introduce the first change we will use a 25 percent max surge and max unavailable; what that means is you’re going to have 2-3 pods above 10 and below 10 in two waves. What will end up happening is the controller will tear down two but we’re going to roll out upwards of five. Subsequently we will control the speed by changing max surge and max unavailable values. We perform a rollout undo and it rolls back with the same number of pods up and/or down.

The second demo uses a 10 percent max unavailable and a 90 percent max surge which means we will only tear down one pod but we create nine new pods. More pods get created in this case because that max surge is so high but we only tear down one the first wave. But subsequently, because we have a lot of running pods, we are able to tear down a lot of pods very quickly.

We do a final patch with opposite values of max surge at 10 percent and max unavailable at 90 percent; there is more danger of the client requests getting dropped with this extreme because 90 percent of our pods can be down. As the rollout starts, right away we get a timeout from the client because we have a lot of pods being terminated at the same time.

The danger with rolling these things out quickly without things like readiness probes and sane values for surge and unavailable is clients may be sent to a pod that is either not viable yet or was already torn down so make sure that you use probes!

Rolling update behavior is just one of the things that you’ll learn in this section on deployments. We also cover things like health checks and liveness/readiness probes. You can build a custom course by going to the courseware builder at https://rx-m.com/cloud-native-training-custom-course-builder-list/. Open up the kubernetes section and find the module on Deployments and add it to your custom course along with a number of other modules to build a course that works for you and your team.

That is our Cloud Native Short Take on Kubernetes Deployments.