【问题标题】:Ingress-nginx returning 503 to app-root pathIngress-nginx 返回 503 到 app-root 路径
【发布时间】:2020-05-27 16:15:54
【问题描述】:

我已使用此 Ingress-Nginx-Doc 将入口 nginx 控制器部署到 Aws EKS 集群

问题:

---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  namespace: mynamespace
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/use-regex: "true"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
spec:
  - path: /
      backend:
        serviceName: my-app
        servicePort: 7300

当我访问我的应用程序时。 http://load-balancer-url/nginx 抛出 503。

[27/May/2020:15:27:40 +0000] "GET / HTTP/1.1" 503 600 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" 662 0.000 [namespace-serviceName-7300] [] - - - - 21eb2db883548292ce20a71ddf45df99
W0527 15:39:07.037844       6 controller.go:909] Service "mynamespace/service" does not have any active Endpoint.

我是否遗漏了任何注释?

---
apiVersion: v1
kind: Service
metadata:
  name: my-app
  labels:
    app: my-app
spec:
  type: ClusterIP
  ports:
    - protocol : TCP
      port: 7300
      targetPort: 7300
  selector:
    name: my-app
    namespace: my-namespace

【问题讨论】:

  • 分享 kubectl describe svc my-app 的输出
  • Name: my-app Namespace: my-namespace Labels: app=myname Annotations: Selector: name=my-app,namespace=mynamespace Type: ClusterIP IP: 172.20.26.* Port: <unset> 7300/TCP TargetPort: 7300/TCP Endpoints: <none> Session Affinity: None Events: <none>
  • 通过不在 cmets 中编辑来共享有问题的服务和 pod yaml
  • @ArghyaSadhu 分享

标签: kubernetes amazon-eks


【解决方案1】:

这里的问题是服务my-appEndpoints 部分中有none,应该有豆荚的IP。

参考docs,您应该检查您的服务的spec.selector 字段是否实际选择了您的Pod 上的metadata.labels 值。一个常见的错误是出现拼写错误或其他错误,例如服务选择了name=my-app,但部署指定了其他内容。

【讨论】:

    猜你喜欢
    • 2021-05-15
    • 2019-09-25
    • 1970-01-01
    • 2017-02-04
    • 2018-12-12
    • 1970-01-01
    • 2021-10-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多