I have setup an Ingress for my nginx service,and I can access this service(my-domain.com
) with a 200
response.But it always returns 503
when the html page trying to get its static resources(my-domain.com/foo/static/
). But everything goes right when I simply pull my image and expose the port on local machine.
pieces of code:
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
In nginx.conf
I should Specify server_name
the same as k8s service
name in the same k8s cluster.