local persistant volume & nodeAffinity

cn flag

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.

      - matchExpressions:
        - key:
          operator: In
          - 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?

id flag
Could you please share more details about your PV capacity, your persistent volume claim and what version of kubernetes you are using?
cn flag
Using v1.17, using Local PV with 50Gi, Using it for logs persistance only. Not for any Datasource like DB or something else
hk flag

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.


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.