GKE Ingress 未使用 cert-manager ssl 机密
GKE Ingress is not working with cert-manager ssl secrets
我正在尝试让 letsencrypt 与 GKE LB 一起工作,我知道有 GCP 托管证书,但它不适用于内部 LB,因为挑战不会通过。使用 cert-manager 的 Letsencrypt DNS 认证已经准备就绪,可以使用了。
❯ 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[在 Ingress
的 tls
部分定义它
实际上,它在文档中遗漏了,或者我遗漏了,因为示例在所有地方都使用与元数据相同的名称。
---
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
你应该放在入口或任何你想使用tls.crt
或tls.key
的地方。
我正在尝试让 letsencrypt 与 GKE LB 一起工作,我知道有 GCP 托管证书,但它不适用于内部 LB,因为挑战不会通过。使用 cert-manager 的 Letsencrypt DNS 认证已经准备就绪,可以使用了。
❯ 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[在 Ingress
的 tls
部分定义它
实际上,它在文档中遗漏了,或者我遗漏了,因为示例在所有地方都使用与元数据相同的名称。
---
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
你应该放在入口或任何你想使用tls.crt
或tls.key
的地方。