Scaling down old replicasets while deploying requires data migration

11/26/2018

What about ReplicaSet_B and ReplicaSet_A update the same db? I hoped the pods in ReplicaSet_A were stopped with taking a snapshot. But there is not any explanation like this in https://kubernetes.io/docs/concepts/workloads/controllers/deployment/. I think, It is assumed that the containers are running online applications in the pods. What if they are batch applications? I mean the old pods belonging to old replicas will update the dbs in old manner. This will require also a data migration issue.

-- Tolga Golelcin
database
deployment
kubernetes
migration
replicaset

1 Answer

11/26/2018

Yes. ReplicaSets (managed by Deployments) make two assumptions: 1. your workload is stateless, and 2. all pods are identical clones (other than their IP addresses). Now, StatefulSets address some aspects, for example, you can assign pods a certain identity (for example: leader or follower), but really only work for specific workloads. Also, the Jobs abstractions in Kubernetes won't really help you a lot concerning stateful workloads. What you likely are looking at is a custom controller or operator. We're collecting good practices and tooling via stateful.kubernetes.sh, maybe there's something there that can be of help?

-- Michael Hausenblas
Source: StackOverflow