我繼承了 GKE Kubernetes 環境,而且幾天來一直在嘗試解決這個問題,但不幸的是我不知道下一步該嘗試什麼。
叢集設定為使用 cert-manager(透過 helm 安裝)將 Let's Encrypt 憑證套用到叢集。由於某種原因,這已經完美運行了兩年多,但從 4 月 16 日開始,我開始在瀏覽器中看到叢集上所有註釋的 SSL 警告。
當我運行時,kubectl describe certificates site-cloud-tls
證書似乎已更新,但未應用於入口流量。
Name: site-cloud-tls
Namespace: cs
Labels: <none>
Annotations: <none>
API Version: certmanager.k8s.io/v1alpha1
Kind: Certificate
Metadata:
Creation Timestamp: 2019-06-02T09:55:05Z
Generation: 34
Owner References:
API Version: extensions/v1beta1
Block Owner Deletion: true
Controller: true
Kind: Ingress
Name: cs-nginx
UID: 7f312326-851c-11e9-8bf0-4201ac10000c
Resource Version: 541365011
UID: 7f36cc40-851c-11e9-8bf0-4201ac10000c
Spec:
Dns Names:
site.cloud (changed name but is correct)
Issuer Ref:
Kind: ClusterIssuer
Name: letsencrypt-dns
Secret Name: site-cloud-tls
Status:
Conditions:
Last Transition Time: 2022-04-24T05:26:13Z
Message: Certificate is up to date and has not expired
Reason: Ready
Status: True
Type: Ready
Not After: 2022-06-15T17:01:48Z
Events: <none>
kubectl describe ingress
Name: cs-nginx
Namespace: cs
Address: 192.168.1.32
Default backend: default-http-backend:80 (10.16.3.12:8080)
TLS:
site-cloud-tls terminates site.cloud (changed naming but seems correct)
Rules:
Host Path Backends
---- ---- --------
site.cloud
/ site:8080 (10.10.10.10:8080)
Annotations: certmanager.k8s.io/cluster-issuer: letsencrypt-dns
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/ssl-redirect: true
nginx.org/websocket-services: datahub
Events: <none>
我們的暫存環境確實也受到了影響。我嘗試過重新安裝 cert-manager,重新安裝 nginx-ingress,但不幸的是無法恢復並運行(可能是由於我犯的配置錯誤)。
3 天后,我不知道該走哪條路,也不太了解 Kubernetes,不知道下一步該嘗試什麼。有什麼指導嗎?我可以提供任何可能有幫助的附加資訊嗎?
謝謝你!
答案1
這裡的問題是您cluster-issuer
在 Ingress 定義中引用了一種:
Annotations: certmanager.k8s.io/cluster-issuer: letsencrypt-dns
但是您定義的物件是一種Certificate
:
Name: site-cloud-tls
Namespace: cs
Labels: <none>
Annotations: <none>
API Version: certmanager.k8s.io/v1alpha1
Kind: Certificate
這就是為什麼它沒有被應用於 Ingress。你需要的是創建一個發行人Kubernetes 中用於處理憑證的資源。在這裡您可以找到基本的範例ACME ClusterIssuer
清單文件:
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-staging
spec:
acme:
# You must replace this email address with your own.
# Let's Encrypt will use this to contact you about expiring
# certificates, and issues related to your account.
email: [email protected]
server: https://acme-staging-v02.api.letsencrypt.org/directory
privateKeySecretRef:
# Secret resource that will be used to store the account's private key.
name: example-issuer-account-key
# Add a single challenge solver, HTTP01 using nginx
solvers:
- http01:
ingress:
class: nginx