cert-manager ClusterIssuer を AKS にインストールしようとしていますが、クラスターが Azure Application Gateway の背後にあるため、HTTP ではなく DNS ソルバーを使用するルートをたどりました。ただし、チャレンジは Cloudflare API の呼び出しエラーで失敗します。コード スニペットを使用して電子メールとドメインを編集しました。出力kubectl describe challenge rabt-cert-tls-g4mcl-1991965707-2468967546は次のとおりです。
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Started 72s cert-manager Challenge scheduled for processing
Warning PresentError 3s (x5 over 71s) cert-manager Error presenting challenge: Cloudflare API Error for GET "/zones?name=<domain>"
Error: 6003: Invalid request headers<- 6103: Invalid format for X-Auth-Key header
https://blog.darkedges.com/2020/05/04/cert-manager-kubernetes-cloudflare-dns-update/のガイドとhttps://github.com/jetstack/cert-の問題に従いました。 manager/issues/3021とhttps://github.com/jetstack/cert-manager/issues/2384を参照していますが、発行者の apiVersion 以外の違いは見られません。これを公式ドキュメントと照らし合わせて確認しましたが、これらのガイドに記載されている内容から変更はありません。
イングレスとクラスター発行者の関係は問題ないようです。イングレスを削除して新しい証明書を再作成すると、注文とチャレンジが作成されます。シークレットが入力されていることを確認し、コンソールに出力できるため、ヘッダーに空白の文字列を送信することはできません。トークンは有効です。CloudFlare からの CURL リクエストの例を使用して、その有効性を確認できます。
ログを見て、何が送信されているかを正確に知ることができる場所はありますか?
ClusterIssuer
apiVersion: v1
kind: Secret
metadata:
name: cloudflare-api-token-secret
namespace: cert-manager
type: Opaque
stringData:
api-token: ${CLOUDFLARE_API_TOKEN}
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: rabt-letsencrypt
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>
# ACME server URL for Let’s Encrypt’s staging environment.
# The staging environment will not issue trusted certificates but is
# used to ensure that the verification process is working properly
# before moving to production
server: https://acme-staging-v02.api.letsencrypt.org/directory
privateKeySecretRef:
# Secret resource used to store the account's private key.
name: rabt-letsencrypt-key
# Enable the HTTP-01 challenge provider
# you prove ownership of a domain by ensuring that a particular
# file is present at the domain
solvers:
- dns01:
cloudflare:
email: <email>
apiTokenSecretRef:
name: cloudflare-api-token-secret
key: api-key
イングレス
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: rabt-ingress
namespace: default
annotations:
kubernetes.io/ingress.class: azure/application-gateway
appgw.ingress.kubernetes.io/backend-protocol: https
appgw.ingress.kubernetes.io/ssl-redirect: "true"
cert-manager.io/cluster-issuer: rabt-letsencrypt
cert-manager.io/acme-challenge-type: dns01
appgw.ingress.kubernetes.io/backend-path-prefix: "/"
spec:
tls:
- hosts:
- "*.rabt.<domain>"
secretName: rabt-cert-tls
rules:
- host: "mq.rabt.<domain>"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: rabt-mq
port:
number: 15672
- host: es.rabt.<domain>
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: rabt-db-es-http
port:
number: 9200
- host: "kibana.rabt.<domain>"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: rabt-kb-http
port:
number: 5601