通过 k8s Ingress 在 Nginx 中使用 503 进行静态资源响应

Static resources response with 503 in Nginx over k8s Ingress

我已经为我的 nginx 服务设置了一个 Ingress,我可以使用 200 response.But 访问这个服务(my-domain.com)它总是 returns 503 当 html 页面试图获取其静态资源时 (my-domain.com/foo/static/)。但是当我简单地拉出我的图像并在本地机器上公开端口时一切正常。

条代码:

nginx.conf
location / {
   root html;
   index index.html;
}

ingress.yml
http:
  paths:
    - path : /
    backend:
      serviceName: nginx
      servicePort: 8000

directories and fies inner nginx/html:
- html
  - foo
    - static
      - css
      - js
      - image
    index.html

nginx.conf中,我应该在同一个k8s集群中指定server_name与k8s相同的service名称。