You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Minikube部署Ingress控制器时出现HTTP 503服务不可用问题求助

Minikube Ingress返回503错误的排查与解决

核心问题

你的Service资源的标签选择器与Pod标签不匹配,导致Ingress无法将流量转发到后端Pod,触发503错误:

  • Service定义的选择器为 app.kubernetes.io/name: example
  • 而Deployment的Pod标签(含Kustomization添加的commonLabels)是 app: example

修复步骤

修改Service配置中的selector字段,使其与Pod标签一致:

apiVersion: v1
kind: Service
metadata:
  name: example
spec:
  ports:
    - name: web
      port: 80
      targetPort: web
  selector:
    app: example  # 修正为与Pod匹配的标签

验证操作

  1. 应用更新后的配置:
kubectl apply -k .
  1. 检查Service是否成功关联Pod,查看Endpoints字段是否有Pod IP:
kubectl describe service example
  1. 重新执行测试命令:
curl --resolve "hello-world.info:80:$( minikube ip )" -i http://hello-world.info

日志佐证

从Nginx Ingress日志[default-example-80] []可以看出,Ingress对应的Service没有可用后端端点(空数组),这直接验证了标签不匹配导致的后端不可达问题。


内容的提问来源于stack exchange,提问作者Jenia Be Nice Please

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 02:34:53