我正在尝试为后端服务创建一个入口规则。入口控制器是Microk8s Nginx入口控制器。如果我设置了主机,则入口停止与后端匹配,当我访问https://my-host.com
时,结果是404下面是我的代码:apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
nginx.ingress.kubernetes.io/rewrite-target: /
kubernetes.io/ingress.class: public
name: http-ingress
spec:
tls:
- hosts:
- "my-host.com"
secretName: nginx-ingress
rules:
- host: "my-host.com"
- http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: some-service
port:
number: 80
您已经创建了2个规则,一个只有host
,另一个有http: ...
。应该是
rules:
- host: "my-host.com"
http:
paths:
是的,YAML是邪恶的。