VKS Cluster upgrade stuck from v1.33.x to v1.34.x due to antrea-controller pod failing
search cancel

VKS Cluster upgrade stuck from v1.33.x to v1.34.x due to antrea-controller pod failing

book

Article ID: 431022

calendar_today

Updated On:

Products

VMware vSphere Kubernetes Service VMware vSphere ESXi

Issue/Introduction

After initiating a workload cluster upgrade from VKR v1.33.x to v1.34.X, the upgrade is stuck because the workload cluster's antrea-controller is failing to start.

While connected to the affected workload cluster context, one or more of the following symptoms are observed:

  • Performing a describe on the new workload cluster node stuck in Provisioned state shows the following error regarding antrea CNI failing:
    "Container runtime network not ready" 
    networkReady="NetworkReady=false reason:NetworkPluginNotReady 
    message:Network plugin returns error: cni plugin not initialized"


  • The antrea-controller pod is stuck in ImagePullBackOff or ErrImagePull state:
    kubectl get pods -n kube-system

    Describing the antrea-controller pod shows the following image pull error message:

    kubectl describe pod -n kube-system <antrea-controller-pod>
    
    Back-off pulling image \\\"localhost:5000/tkg/packages/core/antrea@sha256:<sha>\\\": ErrImagePull: rpc error: code = NotFound desc = failed to pull and unpack image \\\"localhost:5000/tkg/packages/core/antrea@sha256:<sha>\\\": failed to resolve reference \\\"localhost:5000/tkg/packages/core/antrea@sha256:<sha>\\\": localhost:5000/tkg/packages/core/antrea@sha256:<sha>: not found\

     

  • The antrea-controller pod is stuck in ContainerCreating state with an error message similar to the below:
    Couldn't get configMap kube-system/antrea-config-ver-#: configmap "antrea-config-ver-#" not found.

     

     
  • The antrea-controller pod is stuck in Pending state due to the presence of other failed antrea-controller pods:
    kubectl get pods -n kube-system

     

  • There are multiple antrea-controller replicasets with the desired state of 1:
    kubectl get replicaset -n kube-system | grep antrea
    
    NAME                       DESIRED      CURRENT     READY
    antrea-controller-<id-a>   1              #          #
    antrea-controller-<id-b>   1              #          #

     

  • Other system pods such as vsphere-csi-controller are stuck in ContainerCreating state because these system pods are dependent on antrea-controller health.

This behaviour has also been noticed when doing a simultaneous upgrade of the ClusterClass and VKr version. 

Environment

vSphere Supervisor

VKR upgrade from v1.33.X to v1.34.X

Cause

Antrea-controller is unable to start properly due to a race condition on its start-up.

This issue has been observed more frequently in workload clusters using a single control plane node.

Resolution

Resolution

This issue will be resolved in a future VKS version.

 

Workaround

Do not delete the antrea-controller deployment without performing the pre-flight checks below. If the antrea-controller fails to restart (due to third-party webhooks or node scheduling mismatches), its APIServices will lose their endpoints. This may triggers a continuous status-update loop from the kube-apiserver, which can exhaust etcd database space and cause a catastrophic cluster crash within 10 minutes.

Phase 1: Pre-flight Checks (Do this before modifying any resources)

  1. Check for blocking Third-Party Webhooks

During an upgrade, unreachable webhooks (e.g., Kyverno, OPA Gatekeeper) will block the recreation of pods and deployments.

        kubectl get validatingwebhookconfigurations,mutatingwebhookconfigurations

Action: Look for non-native webhooks. If strict policy webhooks are present and failing, you must temporarily bypass them or exempt the kube-system namespace before proceeding. (Reference: KB 387563 for resolving third-party webhook blockages during upgrades).

  1. Check for existing webhook admission errors

    kubectl get events -n kube-system --field-selector type=Warning | grep -i webhook

  2. Double-check if webhook errors are present in kube-apiserver

    kubectl logs -n kube-system kube-apiserver-<wc>-n4sz8-4qhdr | tail -n 10

    Example log message: Failed calling webhook, failing open monitor-webhooks.kyverno.svc: failed calling webhook "monitor-webhooks.kyverno.svc": failed to call webhook: Post "https://kyverno-svc.kyverno.svc:443/verifymutate?timeout=10s": dial tcp ##.##.##.##:443: connect: connection refused

Action: If you see errors like FailedCreate: admission webhook denied the request, stop. Resolve the webhook failure before continuing.

Phase 2: Execute the Deployment Reset

Once you have verified webhooks will not block resource creation, proceed with forcing the controller to recreate:

  1. Connect into the affected workload cluster's context.
  2. Crucial Step: Take a backup of the antrea-controller deployment. You may need this if scheduling fails later.

    kubectl get deployment -n kube-system antrea-controller -o yaml > antrea-controller-deploy-backup.yaml


  3. Delete the antrea-controller deployment:

    kubectl delete deployment -n kube-system antrea-controller

  4. Force reconcile the antrea packageInstall (PKGI) to quickly recreate the deployment:

    kubectl patch pkgi -n vmware-system-tkg <cluster-name>-antrea --type='merge' -p '{"spec":{"syncPeriod":"9m"}}'

  5. Monitor the pod recreation:

    kubectl get pods -n kube-system -w | grep antrea-controller

Phase 3: Troubleshooting Scheduling Failures

If the antrea-controller pod is recreated but gets stuck in a Pending state, it is likely due to a Node Selector mismatch (the pod is trying to schedule on an upgraded node that is currently offline or stuck).

  1. Edit your backup file:

    vi antrea-controller-deploy-backup.yaml

  2. Modify the nodeSelector or affinity fields to explicitly match the labels of one of your existing, healthy, older control plane nodes.
  3. Apply the modified backup manually to force the pod to schedule:

    kubectl apply -f antrea-controller-deploy-backup.yaml

Phase 4: Emergency etcd Protection (If pods refuse to start)

If you cannot get the antrea-controller pod into a Running state and the deployment remains broken, the kube-apiserver will begin spamming etcd with status updates for the missing Antrea endpoints. This may cause a cluster-wide NOSPACE crash within minutes.

Action: delete the unreachable Antrea APIServices to protect the cluster. Run the following command to safely remove the v1alpha1.stats.antrea.io, v1alpha2.controlplane.antrea.io, and v1alpha3.controlplane.antrea.io services:

kubectl delete apiservice v1alpha1.stats.antrea.io v1alpha2.controlplane.antrea.io v1alpha3.controlplane.antrea.io

Note: Refer to your standard etcd recovery and APIService remediation runbooks(for example: 411644) if further database defragmentation is required.