我正在使用kubernetes nginx-ingress设置反向代理,但是我不知道如何向配置中添加nginx参数,特别是:proxy_ssl_server_name。如何在Yaml配置中设置入口参数?
我已经尝试使用server-snippet批注,但是似乎没有将参数添加到集群Pod中的nginx.conf文件中。
这是反向代理的当前代码:
kind: Service
apiVersion: v1
metadata:
name: formstack
namespace: serves
spec:
type: ExternalName
externalName: fluidsignal.formstack.com
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: formstack
namespace: serves
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/upstream-vhost: "fluidsignal.formstack.com"
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
tls:
- hosts:
- fluidattacks.com
secretName: fluidattacks-cert
rules:
- host: fluidattacks.com
http:
paths:
- backend:
serviceName: formstack
servicePort: 443
path: /forms(.*)
设置代理后,我从Nginx收到一个502 Bad Gateway
错误。查看pods日志后,我看到以下openssl错误:SSL: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:SSL alert number 40
,这就是为什么我要添加前面提到的参数的原因。
答案 0 :(得分:1)
我刚刚发现我确实使用了正确的注释:nginx.ingress.kubernetes.io/server-snippet
但是我需要添加一个额外的参数:proxy_ssl_name
添加以下代码可解决此问题:
nginx.ingress.kubernetes.io/server-snippet: |
proxy_ssl_name fluidsignal.formstack.com;
proxy_ssl_server_name on;
现在一切似乎都很好:D