Antrea Agent CrashLoopBackOff Due to Spec.PodCIDR Exhaustion
search cancel

Antrea Agent CrashLoopBackOff Due to Spec.PodCIDR Exhaustion

book

Article ID: 425788

calendar_today

Updated On:

Products

VMware vSphere Kubernetes Service VMware vSphere ESXi

Issue/Introduction

The following symptoms and conditions are observed in a guest cluster:

  • Pod Status: antrea-agent pods continuously fail with a CrashLoopBackOff status.
  • Probe Failures: Readiness and liveness probe failures occur (connection refused on port 10350).
  • Node Status: Nodes display a CIDRNotAvailable status.
  • Cluster Configuration: The cluster is deployed with a pod CIDR block range of 172.#.#.0/24.
  • Pod Status Output:

    kubectl get pod -A | grep antrea
    kube-system antrea-agent-8jxtr 1/2 CrashLoopBackOff 5 (107s ago) #m##s
    kube-system antrea-agent-nrpc8 1/2 CrashLoopBackOff 5 (68s ago) #m##s
    kube-system antrea-agent-ns9w8 2/2 Running 0 ###m
    kube-system antrea-controller-977ddfd7-x6nfb 1/1 Running 0 ###m
    vmware-system-antrea antrea-pre-upgrade-job-g5ssq 0/1 Completed 0 ###m

    Antrea-Agent Pod Logs:

    kubectl logs -n kube-system antrea-agent-8jxtr
    E0116 HH:MM:SS.###### 1 agent.go:911] "Spec.PodCIDR is empty for Node. Please make sure --allocate-node-cidrs is enabled for kube-controller-manager and --cluster-cidr specifies a sufficient CIDR range, or nodeIPAM is enabled for antrea-controller" err="context deadline exceeded" nodeName="#########"
    F0116 HH:MM:SS.###### 1 main.go:54] Error running agent: error initializing agent: Spec.PodCIDR is empty for Node #########

Environment

vSphere with Tanzu

Cause

The error "Spec.PodCIDR is empty" occurs because the Kubernetes kube-controller-manager runs out of subnets to assign to new nodes.

A pod CIDR block range of 172.#.#.0/24 supports only one node in the cluster. The first control plane node consumes the only available /24 block, leaving subsequent nodes with no available CIDRs to allocate.

Resolution

  1. Pod CIDR ranges cannot be changed on an existing cluster.
  2. Redeploy the cluster with a larger range or a different subnet mask configuration.
  3. Recommendation: Use a CIDR with a /16 subnet to ensure sufficient IP allocation across all nodes.

Refer to the below KB article for more information on changing Service and Pod CIDR ranges in a vSphere Kubernetes Guest Cluster:

Changing Service and Pod CIDR Ranges in vSphere Kubernetes Guest Cluster

Additional Information

Japanese KB: Antrea-agentが"Spec.PodCIDR is empty"というエラーで再起動を繰り返す