Implementing Zero-Touch Certificate Rotation for Kubernetes Workloads

The shift toward cloud-native architectures has fundamentally broken traditional Public Key Infrastructure (PKI). Traditional certificate management was designed for static servers with lifespans meas...

Tim Henrich
November 19, 2026
6 min read
65 views

Implementing Zero-Touch Certificate Rotation for Kubernetes Workloads

The shift toward cloud-native architectures has fundamentally broken traditional Public Key Infrastructure (PKI). Traditional certificate management was designed for static servers with lifespans measured in years. Today, containers and microservices have lifespans measured in days, hours, or even minutes.

We are no longer just securing servers; we are managing machine identities at scale. Machine identities now outnumber human identities in modern enterprise environments by a staggering ratio of 45:1. When a core authentication container's certificate expires, it can cause a cascading failure across hundreds of dependent microservices. With the average cost of IT downtime hovering around $5,600 per minute, manual certificate management is no longer just inefficient—it is a critical operational vulnerability.

To survive in a containerized environment, human intervention must be entirely removed from the certificate lifecycle. This tutorial explores the technical implementation of zero-touch certificate rotation, moving from basic automated issuance to advanced, identity-based mutual TLS (mTLS).

The Fundamental Flaw in Container PKI

Lifting and shifting traditional PKI into Kubernetes is a recipe for disaster. Historically, certificates were tied to static IP addresses or hostnames. In Kubernetes, pods spin up and down dynamically, constantly changing IPs across different worker nodes.

Furthermore, relying on developers to generate Certificate Signing Requests (CSRs) or bake private keys into Docker images leads to severe secret sprawl. Private keys must be generated exactly where they are used. A Certificate Authority (CA) should never generate a private key and transmit it over the network. The container environment itself must generate the key pair, send the CSR to the CA, and receive the signed certificate.

To solve this, the industry has standardized on a combination of Kubernetes-native controllers, Container Storage Interface (CSI) drivers, and Service Meshes built on workload identity frameworks.

Phase 1: Automating Issuance with cert-manager

The foundational step for any Kubernetes cluster is deploying cert-manager, a CNCF graduated project that introduces certificates and issuers as native resource types in your cluster.

Instead of writing custom scripts to interact with Let's Encrypt or your internal CA, cert-manager watches for specific annotations on Ingress resources or dedicated Certificate custom resources. When a workload needs a certificate, cert-manager handles the ACME challenge, retrieves the certificate, and stores it as a Kubernetes Secret.

Installing cert-manager

The most reliable way to install cert-manager is via Helm. You must also install the Custom Resource Definitions (CRDs) it relies on.

# Add the Jetstack Helm repository
helm repo add jetstack https://charts.jetstack.io
helm repo update

# Install cert-manager with CRDs enabled
helm install cert-manager jetstack/cert-manager \
  --namespace cert-manager \
  --create-namespace \
  --version v1.14.4 \
  --set installCRDs=true

Configuring a ClusterIssuer

Once installed, you need an Issuer. Best practice dictates using a ClusterIssuer for organization-wide CAs (like Let's Encrypt for public endpoints) and namespace-scoped Issuer resources for team-specific internal CAs to maintain strict tenant isolation.

Here is an example of configuring a production Let's Encrypt ClusterIssuer using the ACME protocol and an HTTP-01 challenge:

apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
  name: letsencrypt-production
spec:
  acme:
    # The ACME server URL
    server: https://acme-v02.api.letsencrypt.org/directory
    # Email address used for ACME registration
    email: security@yourdomain.com
    # Name of a secret used to store the ACME account private key
    privateKeySecretRef:
      name: letsencrypt-production-account-key
    # Enable the HTTP-01 challenge provider
    solvers:
    - http01:
        ingress:
          class: nginx

With this applied, any Ingress resource annotated with cert-manager.io/cluster-issuer: "letsencrypt-production" will automatically receive a valid, auto-rotating TLS certificate.

Phase 2: Eliminating Secret Sprawl with the CSI Secrets Store

While cert-manager is excellent for Ingress, relying on native Kubernetes Secrets for internal pod-to-pod communication presents security risks. By default, Kubernetes Secrets are merely base64 encoded and sit in etcd.

Modern compliance frameworks, including PCI DSS v4.0, require stricter controls on cryptography. To meet these standards, you should mount certificates directly from external secret managers (like HashiCorp Vault or AWS Secrets Manager) into the container's file system using the Secrets Store CSI Driver.

This approach ensures the certificate is mounted as an ephemeral tmpfs volume. It never touches the disk, and it is never stored unencrypted in etcd.

Implementing the CSI Driver with Vault

First, you define a SecretProviderClass that tells the CSI driver how to communicate with your external PKI or Vault instance to request a dynamic certificate.

apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
  name: vault-tls-cert
  namespace: application-namespace
spec:
  provider: vault
  parameters:
    vaultAddress: "https://vault.internal:8200"
    roleName: "app-workload-role"
    objects: |
      - objectName: "tls-cert"
        secretPath: "pki/issue/internal-dot-com"
        secretArgs:
          common_name: "app.internal.com"
          ttl: "24h"

Next, you modify your application's Deployment to mount this volume. When the pod starts, the CSI driver authenticates with Vault (usually via Kubernetes Service Account tokens), generates a private key locally, requests a 24-hour certificate, and mounts both directly into the pod.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: secure-microservice
spec:
  template:
    spec:
      containers:
      - name: app
        image: my-app:v1.2
        volumeMounts:
        - name: tls-certs
          mountPath: "/mnt/secrets-store"
          readOnly: true
      volumes:
      - name: tls-certs
        csi:
          driver: secrets-store.csi.k8s.io
          readOnly: true
          volumeAttributes:
            secretProviderClass: "vault-tls-cert"

Phase 3: Enforcing Zero Trust with Service Mesh and SPIRE

Mounting certificates via CSI is a massive improvement, but it still requires application developers to write code that loads the certificate and terminates TLS. In a true Zero Trust Architecture—mandated by frameworks like US Executive Order 14028—you must enforce cryptographic proof of identity for every container-to-container transaction without burdening the application layer.

This is achieved by decoupling TLS from the application entirely using a Service Mesh like Istio or Linkerd, backed by SPIFFE/SPIRE.

Workload Identity via SPIFFE

SPIFFE (Secure Production Identity Framework for Everyone) abandons IP-based identity. Instead, it assigns a cryptographic identity to the workload itself, known as a SPIFFE ID (e.g., spiffe://internal.domain/ns/payments/sa/billing-service).

SPIRE (the SPIFFE Runtime Environment) acts as the control plane. It verifies the workload's identity based on kernel-level attributes (like cgroups and namespaces) and issues a short-lived SPIFFE Verifiable Identity Document (SVID)—which is simply an X.509 certificate with the SPIFFE ID encoded in the Subject Alternative Name (SAN) extension.

The Sidecar Proxy Pattern

When you combine SPIRE with a Service Mesh, the architecture looks like this:

  1. A sidecar proxy (like Envoy) is automatically injected into every application pod.
  2. The application code communicates over plain, unencrypted HTTP to localhost.
  3. The Envoy sidecar intercepts the traffic.
  4. Envoy requests an SVID (certificate) from the local SPIRE agent.
  5. Envoy uses this certificate to establish a mutually authenticated TLS (mTLS) tunnel to the destination pod's Envoy proxy.

Major technology companies rely on this exact architecture. Uber transitioned to a microservices architecture with thousands of services, utilizing SPIFFE/SPIRE to issue identities dynamically and enforce mTLS. ByteDance (parent company of TikTok) uses SPIRE to manage tens of thousands of nodes, issuing short-lived certificates to ensure secure inter-service communication across global data centers.

Because these certificates are managed entirely by the proxy and the control plane, they can be configured to expire in mere hours. If a container is compromised, the certificate becomes useless before an attacker can realistically exfiltrate and exploit it, entirely bypassing the need for complex Certificate Revocation Lists (CRLs) or OCSP infrastructure.

The Fail-Safe: Independent Observability

A fully automated, zero-touch certificate infrastructure is incredibly powerful, but it introduces a new risk: silent failures.

When humans are removed from the loop, automated systems can fail invisibly. A misconfigured network policy might block cert-manager from reaching the Let's Encrypt API. HashiCorp Vault might become sealed after a node restart, preventing the CSI driver from fetching new internal certificates. An ACME rate limit might quietly block renewals for a critical ingress route.

Because container certificates are moving toward extremely short lifespans (and public TLS certificates are expected to drop to 90-day maximums soon), a failure in your automation pipeline gives you very little time to react before an outage occurs.

This is why independent, external

Share This Insight

Related Posts