Kubernetes Let's Encrypt cert-manager Error secret not found
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Understanding Kubernetes Let's Encrypt `cert-manager` Error: "Secret Not Found"
Kubernetes is a powerful orchestration platform used to manage containerized applications, and one of its most popular tools for simplifying certificate management is `cert-manager`. Among various features, `cert-manager` supports automated issuance and renewal of TLS certificates from Let's Encrypt and other certificate authorities. However, users often encounter errors during the process, with the "Secret Not Found" error being a common stumbling block. This article aims to detail the causes, diagnosis, and resolution of this error.
What is `cert-manager`?
`cert-manager` is a Kubernetes add-on that automates the creation, deployment, and renewal of TLS certificates, thereby ensuring that your applications have current and valid certificates. It utilizes Custom Resource Definitions (CRDs) to manage certificates and relies on secrets to store them in the Kubernetes cluster.
Custom Resource Definitions (CRDs)
- Certificate: A resource that defines the desired state of the certificate.
- Issuer/ClusterIssuer: Defines how certificates are obtained. An Issuer is namespace-scoped, whereas a ClusterIssuer is cluster-wide.
Secrets
- Secret: A Kubernetes object used to store sensitive information such as passwords, OAuth tokens, and TLS certificates. The `cert-manager` saves issued certificates and keys in these secrets.
The Error: "Secret Not Found"
The "Secret Not Found" error typically arises when `cert-manager` tries to reference a `Secret` that doesn't exist, or if there's a misconfiguration related to secret handling. This error manifests in various ways, such as when accessing a TLS certificate or while attempting to verify domain ownership.
Common Causes
- Missing Secret: The associated `Secret` object might not have been created or might have been deleted.
- Incorrect Secret Name: The `Certificate` resource may reference an incorrect or outdated `Secret` name.
- Namespace Mismatch: There might be a mismatch between the `Namespace` of the `Certificate` and the `Secret`.
- Misconfigured `cert-manager` Resources: Errors in the configuration of the `Certificate` or `Issuer` could lead to these issues.
- Controller Errors: Problems with the `cert-manager` controller can affect how it creates and manages secrets.
Diagnosing the Issue
- Check Certificate StatusUse the following command to inspect the status of the `Certificate` resource:
Related reading
- Kubernetes list all pods and its nodes
- kubernetes list all running pods name
- Kubernetes Liveness Probe Logging
- Kubernetes livenessProbe restarting vs destroying of the pod
- Kubernetes Logs - How to get logs for kube-system pods
- kubernetes lost /.kube/config
- kubernetes local cluster create pods got errors like ‘ErrImagePull’ and ‘ImagePullBackOff’
- Kubernetes log location in pod

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.