如何解决GKE Ingress 无法使用证书管理器 ssl 机密
我正在尝试让 Letencrypt 与 GKE LB 一起工作,我知道有 GCP 托管证书,但它不适用于内部 LB,因为挑战无法通过。 Letsencrypt DNS 认证使用 cert-manager 已准备就绪,可供使用。
❯ k get secrets letsencrypt-prod -o yaml
apiVersion: v1
data:
tls.key: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFb3dJQkFBS0NBUUVBdlVZTVhXdGNZZUJpMkdadzljRFRLNzY==
kind: Secret
Metadata:
creationTimestamp: "2021-01-24T15:03:39Z"
name: letsencrypt-prod
namespace: elastic-system
resourceVersion: "3636289"
selfLink: /api/v1/namespaces/elastic-system/secrets/letsencrypt-prod
uid: f4bec5a9-d3b5-4f4a-9ec6-01a4ce3ba47c
type: Opaque
spec:
tls:
- hosts:
- staging.example.com
- staging2.example.com
secretName: letsencrypt-prod
GCP 报告此错误 Error syncing to GCP: error running load balancer syncing routine: error getting secrets for Ingress: secret "letsencrypt-prod" does not specify cert as string data
有人可以帮我解决它缺少的东西吗?
解决方法
根据 this,您必须为 GCP 提供有效的格式,例如您已经提供的 Let's Encrypt
有效证书:
kubectl create secret generic letsencrypt-prod --from-file=tls.crt="cert.pem" --from-file=tls.key="privkey.pem" --dry-run -o yaml > output
kubectl apply -f output
此外,(似乎您已经在使用它,但安全总比抱歉好),您必须按照 this
在tls
的 Ingress
部分定义它>
,
实际上,它在文档中遗漏了,或者我遗漏了,因为示例在任何地方都使用与元数据相同的名称。
---
apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
name: cert-example
namespace: example
spec:
secretName: REAL_NAME_OF_SECRET << This need to include in ingress.
issuerRef:
name: letsencrypt-prod
dnsNames:
- 'staging.domain.com'
- '*.staging.domain.com'
所以 REAL_NAME_OF_SECRET
你应该放在 ingress 或任何你想使用 tls.crt
或 tls.key
的地方。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。