【发布时间】:2021-01-14 20:48:49
【问题描述】:
我正在使用 HAProxy 入口控制器 (https://github.com/helm/charts/tree/master/incubator/haproxy-ingress) 为我的应用程序终止 TLS。
我有一个简单的 Node.JS 服务器在 8080 上侦听 HTTP,1935 作为简单的回显服务器(不是 HTTP)。
我使用 HAProxy Ingress 控制器将端口包装在 TLS 中。 (8080 -> 443 (HTTPS), 1935 -> 1936 (TCP + TLS))
我用
helm upgrade --install haproxy-ingress incubator/haproxy-ingress \
--namespace test \
-f ./haproxy-ingress-values.yaml \
--version v0.0.27
,其中haproxy-ingress-values.yaml的内容是
controller:
ingressClass: haproxy
replicaCount: 1
service:
type: LoadBalancer
tcp:
1936: "test/simple-server:1935:::test/ingress-cert"
nodeSelector:
"kubernetes.io/os": linux
defaultBackend:
nodeSelector:
"kubernetes.io/os": linux
这是我的入口:
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ingress
annotations:
kubernetes.io/ingress.class: "haproxy"
spec:
tls:
- hosts:
secretName: ingress-cert
rules:
- http:
paths:
- path: /
backend:
serviceName: "simple-server"
servicePort: 8080
证书是自签名的。 如果我用
测试TLS握手echo | openssl s_client -connect "<IP>":1936
有时(大约 1/3 的时间)它会失败
CONNECTED(00000005)
139828847829440:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:332:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 5 bytes and written 316 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
Early data was not sent
Verify return code: 0 (ok)
---
443 端口不会发生同样的问题。
有关重现问题的设置的详细信息,请参阅here。
[编辑]
正如@JoaoMorais 所指出的,这是因为默认统计端口是 1936。
虽然我没有打开统计,但它似乎仍然会干扰行为。
有两种解决方案适合我。
- 将我的服务的 1936 端口更改为另一个
- 在安装 haproxy-ingress 图表时,通过添加如下值来更改统计端口。
controller:
stats:
port: 5000
【问题讨论】:
-
port
1936已经用于统计,你能用另一个外部/监听端口号重现问题吗? -
@JoaoMorais 谢谢。将 1936 端口更改为其他端口或更改统计端口工作!请回复此问题,以便我将您的答案标记为正确。 :)
标签: ssl kubernetes haproxy-ingress