What happens when we scale the kubernetes deployment and change one of the pod or container configuration?

11/7/2019

When i scale the application by creating deployment .Let's say i am running nginx service on 3 cluster. Nginx is running in containers in multiple pods . If i change nginx configuration in one of the pod ,does it propagate to all the nodes and pods because it is running in cluster and scaled.

-- Penguin Tech
kubernetes
kubernetes-pod

2 Answers

11/7/2019

I would like to add a few more things to what was already said. First of all you are even not supposed to do any changes to Pods which are managed let's say by ReplicaSet, ReplicationController or Deployment. This are objects which provide additional abstraction layer and it is their responsibility to ensure that there are given number of Pods of a certain kind running in your kubernetes cluster. It doesn't matter how many nodes your cluster consists of as mentioned controllers span across all nodes in the cluster.

Changes made in a single Pod will not only not propagate to other Pods but may be easily lost if such newly created Pod with changed configuration crashes.

Remember that one of the tasks of the Deployment is to make sure that certain number of Pods of a given type ( specified in a Pod template section of the Deployment ) are always up and running. When your manually reconfigured Pod goes down then your Deployment (actually ReplicaSet created by the Deployment) acts behind the scenes and recreates such Pod. But how does it recreate it ? Does it take into consideration changes introduced by you to such Pod ? Of course not, it will recreate it based on the template it is given in the Deployment.

If you want to make changes in your Pods one by one kubernetes allows you to do so by providing so called rolling update mechanism. Here you can read about old-fashioned approach using ReplicationController which is not used any more as it is replaced by Deployments and ReplicaSets but I think it's still worth reading just to grasp the concept. Currently Deployment is the way to go. About updating a Deployment you can read here. Note that the default update strategy is RollingUpdate which ensures that changes are not applied to all Pods at once but one by one.

-- mario
Source: StackOverflow

11/7/2019

does it propagate to all the nodes and pods because it is running in cluster and scaled.

No. Only when you change the deployment yaml. Then it re-creates pods 1 by 1 with the new configuration.

-- Max Lobur
Source: StackOverflow