I was trying to generate certificate for my domain and I got an issue
cert-manager/challenges "msg"="re-queuing item due to error processing" "error"="Unable to check the TXT record: ### Unexpected HTTP status: 422"
I follow this for generate the ssl certificate for my domain which is hosted on godaddy
Secret
Create a Secret containing as key parameter the concatenation of the Godaddy Api and Secret
separated by ":"
cat <<EOF > secret.yml
apiVersion: v1
kind: Secret
metadata:
name: godaddy-api-key
type: Opaque
stringData:
token: <GODADDY_API:GODADDY_SECRET>
EOF
Next, deploy it under the namespace where you would like to get your certificate/key signed by the ACME CA Authority
kubectl apply -f secret.yml -n prod
ClusterIssuer
Create a ClusterIssuerresource to specify the address of the ACME staging or production server to access. Add the DNS01 Solver Config that this webhook will use to communicate with the API of the Godaddy Server in order to create or delete an ACME Challenge TXT record that the DNS Provider will accept/refuse if the domain name exists.
cat <<EOF > clusterissuer.yml
EOF apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
# ACME Server
# prod : https://acme-v02.api.letsencrypt.org/directory
# staging : https://acme-staging-v02.api.letsencrypt.org/directory
server: https://acme-v02.api.letsencrypt.org/directory
# ACME Email address
email: xyz@gmail.com
privateKeySecretRef:
name: letsencrypt-production # staging or production
solvers:
- selector:
dnsNames:
- '*.example.com'
dns01:
webhook:
config:
apiKeySecretRef:
name: godaddy-api-key
key: token
production: true
ttl: 600
groupName: acme.mycompany.com
solverName: godaddy
EOF
Next, install it on your kubernetes cluster
kubectl apply -f clusterissuer.yml -n prod
Next, create for each of your domain where you need a signed certificate from the Letsencrypt authority the following certificate
cat <<EOF > certificate.yml
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: wildcard-example-com
spec:
secretName: wildcard-example-com-tls
renewBefore: 240h
dnsNames:
- '*.example.com'
issuerRef:
name: letsencrypt-prod
kind: ClusterIssuer
EOF
Deploy it
kubectl apply -f certificate.yml -n prod