问题:
我正在配置基于TykTechnologies/tyk-kubernetes 存储库的 Tyk 网关和仪表板:
我现在希望使用 TLS 证书保护 Gateway 和 Dashboard K8s 服务。
我购买了一个证书来保护外部 URL (https://api.example.com
和https://dashboard.example.com
),如下所示,但该证书对内部 k8s 服务端点无效,因此仪表板和网关无法再在内部说话:
$ kubectl logs deployment/tyk-dashboard
...
time="Jan 01 00:00:00" level=error msg="Request failed with error Get https://tyk-dashboard.tyk.svc.cluster.local:443/register/node: x509: certificate is valid for *.example.com, not tyk-dashboard.tyk.svc.cluster.local; retrying in 5s"
到目前为止我所做的:
修改tyk.conf
andtyk_analytics.conf
以更改监听端口并引用证书:
{
"listen_port": 443,
"notifications_listen_port": 5000,
"tyk_api_config": {
"Host": "https://tyk-gateway.tyk.svc.cluster.local",
"Port": "443",
...
"http_server_options": {
"use_ssl": true,
"server_name": "api.example.com",
"min_version": 771,
"certificates": [
{
"domain_name": "*.example.com",
"cert_file": "/etc/ssl/gateway-tls/tls.crt",
"key_file": "/etc/ssl/gateway-tls/tls.key"
}
]
},
...
我正在通过 K8s TLS 机密将证书安装在 tyk pod 中(对于仪表板也是如此):
kubectl create secret tls tyk-gateway --cert=example.com.crt --key=example.com.key
以及相应的 K8s 部署更新:
...
ports:
- containerPort: 443
- containerPort: 5000
volumeMounts:
...
- name: tyk-gateway-tls
readOnly: true
mountPath: "/etc/ssl/gateway-tls"
volumes:
...
- name: tyk-gateway-tls
secret:
secretName: tyk-gateway