How to update a set of pods running in kubernetes?

Madis Nõmme

What is the preferred way of updating a set of pods (e.g. after making code changes & pushing underlying docker image to docker hub) controlled by a replication controller in kubernetes cluster?

I can see 2 ways:

  1. Deleting & re-creating replication controller manually
  2. Using kubectl rolling-update

With the rolling-update I have to change the replication controller name. Since I'm storing replication controller definition in YAML file and not generating it manually, having to change the file to push out a code update seems to bring about bad habits like alternating between 2 names for the replication controller (e.g. controllerA and controllerB) to avoid name conflict.

What is the better way?

Robert Bailey

Update: kubectl rolling-update has been deprecated and the replacement command is kubectl rollout. Also note that since I wrote the original answer the Deployment resource has been added and is a better choice than ReplicaSets as the rolling update is performed server side instead of by the client.


You should use kubectl rolling-update. We recently added a feature to do a "simple rolling update" which will update the image in a replication controller without renaming it. It's the last example shown in the kubectl help rolling-update output:

// Update the pods of frontend by just changing the image, and keeping the old name
$ kubectl rolling-update frontend --image=image:v2

This command also supports recovery -- if you cancel your update and restart it later, it will resume from where it left off. Even though it creates a new replication controller behind the scenes, at the end of the update the new replication controller takes the name of the old replication controller so it appears as pure update rather than switching to an entirely new replication controller.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to change running pods limits in Kubernetes?

in kubernetes, how to update pods to use updated configmap

Does kubernetes rolling update may impact applications running in pods or not?

running pods and containers in Kubernetes

How to set fixed pods names in kubernetes

How to debug Kotlin applications running in Kubernetes pods in IntelliJ?

Kubernetes - How to list all pods running in a particular instance group?

kubernetes - How to ensure running pods are terminated before new pods are created for a deployment

Kubernetes + TF serving - how to use hundred of ML models without running hundred of idle pods up and running?

Are there issues with running user pods on a Kubernetes master node?

Kubernetes pods not starting, running behind a proxy

kubernetes list all running pods name

Kubernetes prometheus metrics for running pods and nodes?

Consul on Kubernetes: Consul pods are running but not ready

Running a command on all kubernetes pods of a service

Monitoring the number of threads running on kubernetes PODS

How can pods within a kubernetes replica set discover and talk to each other without the kubernetes API?

how to use Kubernetes DNS for pods?

How to ship logs from pods on Kubernetes running on top of GCP to elasticsearch/logstash?

How to show custom application metrics in Prometheus captured using the golang client library from all pods running in Kubernetes

How do I avoid unschedulable pods when running an autoscale-enabled Google Container/Kubernetes Engine cluster?

Does Kubernetes move pods between nodes or is the Replica Set that recreates the pods?

Set retention policy for Pods created by Kubernetes CronJob

Set up unique purpose pods with Helm / Kubernetes

Running Kubernetes master and node on the same server (scheduling pods on Kubernetes master)

How do you set up kubernetes RBAC resources so that pods can access the API via a client?

How would I set up kubernetes Services and pods' IP addresses and ports to send some information into a pod?

How to update pods to Swift 3.0

How to adjust the output of kubectl get pods in kubernetes to watch pods status