代码之家  ›  专栏  ›  技术社区  ›  Moshe Shmukler

K8S入口服务返回503,POD日志中无任何内容

  •  1
  • Moshe Shmukler  · 技术社区  · 6 年前

    我正在运行一个 Ingress 它应该连接到我的豆荚里的图像。当我这样做的时候 describe 看起来不错,比如。

    $ kubectl describe svc solar-demo
    Name:              solar-demo
    Namespace:         default
    Labels:            <none>
    Annotations:       kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"solar-demo","namespace":"default"},"spec":{"ports":[{"name":"city","port":3000...
    Selector:          app=solardemo
    Type:              ClusterIP
    IP:                10.97.245.248
    Port:              city  3000/TCP
    TargetPort:        3000/TCP
    Endpoints:         172.17.0.4:3000,172.17.0.6:3000
    Port:              solar  3001/TCP
    TargetPort:        3001/TCP
    Endpoints:         172.17.0.4:3001,172.17.0.6:3001
    Session Affinity:  None
    Events:            <none>
    

    它甚至正确地列出了我的图像的IP地址。但是,当我尝试访问服务时,只要请求一个根目录,就会得到404,这很好,因为我不映射映射 / 对任何事情和 503 尝试到达路由时出错 /solar 和/或 /city .

    当我检查日志时,它返回:

    $ kubectl logs solar-demo-5845984b94-xp82l solar-svc
    npm info it worked if it ends with ok
    npm info using npm@5.6.0
    npm info using node@v9.11.2
    npm info lifecycle nf-images-test@1.0.0~prestart-solar-svc: nf-images-test@1.0.0
    npm info lifecycle nf-images-test@1.0.0~start-solar-svc: nf-images-test@1.0.0
    
    > nf-images-test@1.0.0 start-solar-svc /opt/app-root/src
    > node solar-svc.js
    
    {"level":30,"time":1530271233676,"msg":"Server listening at http://0.0.0.0:3001","pid":26,"hostname":"solar-demo-5845984b94-xp82l","v":1}
    server listening on 3001
    

    另一项服务也是如此:

    $ kubectl logs solar-demo-5845984b94-xp82l api
    npm info it worked if it ends with ok
    npm info using npm@5.6.0
    npm info using node@v9.11.2
    npm info lifecycle nf-images-test@1.0.0~prestart-api: nf-images-test@1.0.0
    npm info lifecycle nf-images-test@1.0.0~start-api: nf-images-test@1.0.0
    
    > nf-images-test@1.0.0 start-api /opt/app-root/src
    > node api.js
    
    {"level":30,"time":1530271244205,"msg":"Server listening at http://0.0.0.0:3000","pid":21,"hostname":"solar-demo-5845984b94-xp82l","v":1}
    server listening on 3000
    

    我得到了503,图像从来没有得到任何要求,好像 进入 “以为”每 Pod 有问题。我可以查什么?

    $ curl -v http://shmukler.example.com/solar
    *   Trying 192.168.99.101...
    * Connected to shmukler.example.com (192.168.99.101) port 80 (#0)
    > GET /solar HTTP/1.1
    > Host: shmukler.example.com
    > User-Agent: curl/7.43.0
    > Accept: */*
    > 
    < HTTP/1.1 503 Service Temporarily Unavailable
    < Server: nginx/1.13.7
    < Date: Sun, 01 Jul 2018 13:49:38 GMT
    < Content-Type: text/html
    < Content-Length: 213
    < Connection: keep-alive
    < 
    <html>
    <head><title>503 Service Temporarily Unavailable</title></head>
    <body bgcolor="white">
    <center><h1>503 Service Temporarily Unavailable</h1></center>
    <hr><center>nginx/1.13.7</center>
    </body>
    </html>
    * Connection #0 to host shmukler.example.com left intact
    

    请告知。

    1 回复  |  直到 6 年前
        1
  •  2
  •   Moshe Shmukler    6 年前

    在批注中,缺少配置:

    nginx.org/server-snippet: "proxy_ssl_verify off;"