0

I am using local persistant volumes in my Kubernetes cluster, I have currently two worker nodes in my cluster(node1, node2). So while creating local Peristant Volume I have added node affinity with these nodes.

 nodeAffinity: required: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/hostname operator: In values: - node1 - node2 

10 deployments are working using these PVs. Now, I want to add a new worker node to the cluster(node3). I tried to modify the Persistent Volume but I can't modify the nodeAffinity as this is showing "field is immutable". How should I proceed now? If I don't modify the PV, pods will not get scheduled on the new worker node?

How to tackle this situation?

2
  • Could you please share more details about your PV capacity, your persistent volume claim and what version of kubernetes you are using? Commented Jun 1, 2022 at 15:28
  • Using v1.17, using Local PV with 50Gi, Using it for logs persistance only. Not for any Datasource like DB or something else Commented Jun 2, 2022 at 6:53

1 Answer 1

1

When a field is immutable, what you could do is delete the parent object, with the option cascade option set to orphan (used to be "false" in older versions / if "orphan" isn't recognized)

See kubectl docs.

Having your new configuration ready, delete the old object

kubectl delete deploy/example --cascade=orphan 

Its child replicaset and pods should still exist. At which point, you can create the replacement deployment.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.