Reputation: 232
On my kubernetes (hosted on Azure), I have a Statefulset named database
with a replica = 3 to handle my database cluster (so I have pods database-0
, database-1
, database-2
)
I have some operations to perform on the disk of one of the 'cluster node'. I Would like to shutdown database-1
(without stopping the two other pods), to be able to make changes to the disk mounted on a different pod, and then restart database-1
.
How could I do that ? Is it even possible in kubernetes ?
Thanks
Upvotes: 0
Views: 831
Reputation: 76
kubectl delete statefulset --cascade=orphan and kubectl delete pod database-1. After maintaining, reapply your statefulset. Reference: https://kubernetes.io/docs/tasks/run-application/delete-stateful-set/
Upvotes: 0
Reputation: 854
What you want is no possible with statefulset controller. As the replica is 3 if you delete a specific pod, then the controller will bring back the pod. If you scale down the stateful set then the pods are terminated based on how much you scale down.
Upvotes: 0