根据这个文档(https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#server-alias),我可以在 nginx 配置文件中添加额外的 server_name 。但是,它会将额外的 server_name 添加到我的所有主机中,这肯定会导致冲突。有没有办法只为我的一个主机添加服务器别名?假设我只想将 10.10.0.100 添加到我的 test1 主机。入口示例:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: test-ingress
namespace: default
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/server-alias: 10.10.0.100
spec:
rules:
- host: test1.com
http:
paths:
- path: /
backend:
service:
name: test1-service
port:
number: 8000
pathType: Prefix
- host: test2.com
http:
paths:
- path: /
backend:
service:
name: test2-service
port:
number: 8000
pathType: Prefix