我有两个容器 - 一个是nginx中的静态页面,另一个是反应应用程序。
我想在/
上提供静态页面,并在/app
上做出反应
目前的问题是,当我输入/
时,我重定向/app
静态页面的头盔摘录:
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/app-root: /
paths:
- /
反应应用程序的头盔摘录:
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/app-root: app/
paths:
- /app
kubectl describe ingress
:
Name: app
Namespace: prod
Address:
Default backend: default-http-backend:80 (<none>)
Rules:
Host Path Backends
---- ---- --------
example.com
/app app:http (10.244.2.52:80)
Annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/app-root: app/
Name: static-page
Namespace: prod
Address:
Default backend: default-http-backend:80 (<none>)
Rules:
Host Path Backends
---- ---- --------
example.com
/ static-page:80 (10.244.2.40:80)
Annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/app-root: /
您可能尝试在没有nginx.ingress.kubernetes.io/app-root:
注释的情况下在一个入口对象中使用多路径配置,它在类似的情况下适用于我:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
name: example
spec:
rules:
- http:
paths:
- backend:
serviceName: static-page
servicePort: 80
path: /
- backend:
serviceName: app
servicePort: 80
path: /app