# 警告：服务'default/my-service'没有可用的端点

- **ID:** `kubernetes/ingress-controller-no-endpoints`
- **领域:** kubernetes
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 87%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| nginx-ingress-controller v1.9.5 | active | — | — |
| Kubernetes v1.27.3 | active | — | — |
| Kubernetes v1.28.2 | active | — | — |

## 解决方案

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.
   ```

## 无效尝试

- **Delete and recreate the Ingress resource** — The Ingress resource is not the problem; the underlying service or pod configuration is misaligned. Recreating Ingress doesn't fix the endpoint mismatch. (95% 失败率)
- **Increase the number of replicas in the deployment** — More replicas won't help if the service selector doesn't match the pod labels or if pods are failing readiness probes. (80% 失败率)
