Automate Jira Issue Creation for Expiring Certificates with Cert-manager
Hello, tech enthusiasts! Today, we’re going to explore an exciting integration between Cert-manager and Jira. This setup will automatically create Jira issues when a certificate is about to expire, ensuring that you’re always on top of your certificate management game. Let’s dive in!
Prerequisites
- A Kubernetes cluster with
cert-managerinstalled. You can install it using Helm:shellEditFull ScreenCopy code1helm install \ 2 cert-manager jetstack/cert-manager \ 3 --namespace cert-manager \ 4 --create-namespace \ 5 --version v1.13.3 \ 6 --set installCRDs=true \ 7 --set prometheus.enabled=false \ 8 --set webhook.timeoutSeconds=4 - Access to a Docker registry and the ability to build and push images.
- A Jira server with API access.
- Clone Github repo
Deploy the Custom Controller
- Build the image and push it into your Docker registry:dockerEditFull ScreenCopy code
1docker build -t <name of registry>/<image name>:<image tag> . 2docker push <name of registry>/<image name>:<image tag> - Create a certificate and a Kubernetes secret out of that certificate:shellEditFull ScreenCopy code
1openssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 2 2kubectl create secret tls <secret name> --key="cert.pem" --cert="key.pem" -n <namespace> - Edit the
k8s/deployment.yamlfile and set the image, environment variables, and secret name:shellEditFull ScreenCopy code1image: <name of registry>/<image name>:<image tag> 2env: 3 - name: JIRA_SERVER 4 - name: JIRA_USERNAME 5 - name: JIRA_API_TOKEN 6 - name: JIRA_PROJECT_KEY 7secretName: <name of the secret tks you created earlier> - Update the
mutation.yamlfile with the CA bundle from your certificate’s TLS secret:shellEditFull ScreenCopy code1kubectl get secret <secret name> -o jsonpath='{.data.ca\.crt}' | base64 --decode > ca.crtReplacecaBundleinmutation.yamlwith the contents ofca.crt. - Apply the configuration:shellEditFull ScreenCopy code
1kubectl apply -f k8s/
That’s it! You’ve successfully integrated Cert-manager with Jira to automatically create issues when certificates are about to expire. Stay proactive and maintain your certificates with ease!