kubernetes network_error ai_generated true

Warning: No endpoints available for service 'default/my-service'

ID: kubernetes/ingress-controller-no-endpoints

Also available as: JSON · Markdown · 中文
87%Fix Rate
88%Confidence
1Evidence
2023-11-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
nginx-ingress-controller v1.9.5 active
Kubernetes v1.27.3 active
Kubernetes v1.28.2 active

Root Cause

The Ingress controller cannot find any healthy pod endpoints for the referenced service, often because the service selector doesn't match any pods or pods are not ready.

generic

中文

Ingress控制器无法找到引用服务的健康Pod端点,通常是因为服务选择器没有匹配到任何Pod或Pod未就绪。

Official Documentation

https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/

Workarounds

  1. 90% success Verify the service selector matches the pod labels: `kubectl get service my-service -n default -o jsonpath='{.spec.selector}'` and `kubectl get pods -n default --show-labels | grep my-service`
    Verify the service selector matches the pod labels: `kubectl get service my-service -n default -o jsonpath='{.spec.selector}'` and `kubectl get pods -n default --show-labels | grep my-service`
  2. 85% success Check pod readiness: `kubectl get pods -n default -l app=my-service -o wide` and ensure readiness probes pass. If pods are not ready, fix the probe configuration in the deployment.
    Check pod readiness: `kubectl get pods -n default -l app=my-service -o wide` and ensure readiness probes pass. If pods are not ready, fix the probe configuration in the deployment.

中文步骤

  1. Verify the service selector matches the pod labels: `kubectl get service my-service -n default -o jsonpath='{.spec.selector}'` and `kubectl get pods -n default --show-labels | grep my-service`
  2. Check pod readiness: `kubectl get pods -n default -l app=my-service -o wide` and ensure readiness probes pass. If pods are not ready, fix the probe configuration in the deployment.

Dead Ends

Common approaches that don't work:

  1. Delete and recreate the Ingress resource 95% fail

    The Ingress resource is not the problem; the underlying service or pod configuration is misaligned. Recreating Ingress doesn't fix the endpoint mismatch.

  2. Increase the number of replicas in the deployment 80% fail

    More replicas won't help if the service selector doesn't match the pod labels or if pods are failing readiness probes.