Kubernetes
Let's Encrypt
cert-manager
error resolution
secret management

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.

Practice system design

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

  1. Missing Secret: The associated `Secret` object might not have been created or might have been deleted.
  2. Incorrect Secret Name: The `Certificate` resource may reference an incorrect or outdated `Secret` name.
  3. Namespace Mismatch: There might be a mismatch between the `Namespace` of the `Certificate` and the `Secret`.
  4. Misconfigured `cert-manager` Resources: Errors in the configuration of the `Certificate` or `Issuer` could lead to these issues.
  5. Controller Errors: Problems with the `cert-manager` controller can affect how it creates and manages secrets.

Diagnosing the Issue

  1. Check Certificate Status
    Use the following command to inspect the status of the `Certificate` resource:

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track 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.

Practice system design

All Rights Reserved.