During TKGI Cluster Upgrade | error when patching | Invalid value | field is immutable
book
Article ID: 374004
calendar_today
Updated On:
Products
VMware Tanzu Kubernetes Grid Integrated Edition
Issue/Introduction
Cluster upgrade fails with an error similar to the below at the end of the upgrade while apply-addons errands are running:
\"/var/vcap/jobs/apply-specs/specs/coredns-yaml":error when patching ... Deployment.apps \"coredns\" is invalid: selector: Invalid value: v1.LabeiSelector{MatchLabels:map[string]string\"k8s-app\": "kube-dns\"),MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable
Environment
VMware Tanzu Kubernetes Grid Integrated Edition
Cause
An immutable field was added to the coredns deployment running in the affected cluster.
apply-addons tries to patch the deployment but fails because the field is immutable.
Resolution
NOTE: This has potential to break any workloads that depend on the custom DNS configurations.
Backup the coredns deployment yaml
Set the kubectl context on the affected cluster
kubectl get deploy coredns -n kube-system -o yaml
Pull the core dns deployment yaml from the apply-addons VM of the affected cluster
bosh -d service-instance_<GUID> run-errand apply-addons --keep-alive
bosh -d service-instance_<GUID> ssh <apply-addons_VM>
cat /var/vcap/jobs/apply-specs/specs/coredns-yaml
Copy the deployment section yaml from the output and save it for later.