There is a cert-manager HELM package provided on k8s platform. It provides support for Let's Encrypt
, and we can control to refresh it before its expiration (3 month).
install cert-manager
1 | $ kubectl create ns cert-manager |
Exchanging for external service usage
Create Certificate
resource and wait for the CA to be seen in Secret
.
Export the CA:
1 | $ kubectl get secret wangkexiong.duckdns.org-tls -n certificate -o template --template='{{ index .data "tls.crt" }}' | base64 -d |
Above crt and key file can be used by nginx directly. To make CA autorefresh, use cronjob to get latest CA.
1 | $ cat /etc/nginx/nginx.conf |