Renew letsencrypt certificate with cert-manager in digitalocean

Ratna
1 min readNov 7, 2021

Since you are here, you might have issued ssl/tls certificates and now they are expired. Also I am assuming that your CA is Let’s Encrypt and certificate manager is cert-manager.

My cloud provider is digitalocean. And I followeed this tutorial — https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nginx-ingress-with-cert-manager-on-digitalocean-kubernetes to create certificates. When certificate expires we need to recreate them with new secret. So first we need to delete existing certificate and secret. To delete certifcate & secret you can use following commands

kubectl delete certificate echo-tls
kubectl delete secret echo-tls

You can see my certificate and secret both have same name echo-tls. Now you need to create new certificate and secret. For this either you should use your existing certificate definition or you can create new looks as below.

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: echo-tls
namespace: default
spec:
dnsNames:
- api1.example.co.za
- api2.example.co.za
issuerRef:
group: cert-manager.io
kind: ClusterIssuer
name: letsencrypt-prod
secretName: echo-tls

This certificate will create certificate and secret with the same name. Make sure you give right dnsnames in the definition file.

Once you got them generated successfully you will have secret and certificate. You can open your website in browser and you will have valid certificate.

--

--

Ratna

Senior System Developer with 15 years of experience. Currently focused on microservice, Event Driven, CQRS architecture