Security intermediate ⏱ 15 minutes K8s 1.28+

Q-Day Certificate Inventory on Kubernetes

Q-Day is when quantum computers break RSA and ECDSA. List every TLS secret and cert-manager Certificate in your cluster with its key algorithm and expiry.

By Luca Berton • • 📖 5 min read

💡 Quick Answer: Q-Day is the day a quantum computer can break RSA and elliptic-curve cryptography. Y2Q (“years to quantum”) is the countdown. Nobody knows the date, so start with a list: read every kubernetes.io/tls secret with kubectl and openssl, and print the key algorithm and the expiry date. Certificates with RSA or ECDSA keys that are valid after 2035 are the long-term work.

The Problem

A quantum computer that is large enough can forge RSA and ECDSA signatures and can decrypt recorded key exchanges. The date is not known. The planning dates are: the NIST plan in IR 8547 deprecates these algorithms after 2030 and disallows them after 2035.

A cluster has certificates in many places: ingress TLS secrets, service mesh identities, webhooks, the control plane PKI. You cannot plan a migration without a list of them.

This recipe makes the list for the certificates that are stored as secrets and for the ones that cert-manager issues. The verification recipe covers the key exchange.

The Solution

Step 1: List every TLS secret with its algorithm and expiry

kubectl get secrets -A --field-selector type=kubernetes.io/tls -o json \
  | jq -r '.items[] | [.metadata.namespace, .metadata.name, .data["tls.crt"]] | @tsv' \
  | while IFS=$'\t' read -r ns name crt; do
      info=$(echo "$crt" | base64 -d | openssl x509 -noout -text 2>/dev/null)
      algo=$(echo "$info" | grep -m1 "Public Key Algorithm" | sed 's/.*: //')
      bits=$(echo "$info" | grep -m1 "Public-Key" | sed 's/.*(\(.*\)).*/\1/')
      end=$(echo "$crt" | base64 -d | openssl x509 -noout -enddate 2>/dev/null | cut -d= -f2)
      printf '%s\t%s\t%s\t%s\t%s\n' "$ns" "$name" "$algo" "$bits" "$end"
    done | tee tls-inventory.tsv

Example output:

default      web-tls         rsaEncryption    2048 bit   Mar  4 10:12:01 2027 GMT
payments     api-tls         id-ecPublicKey   256 bit    Feb 20 08:00:00 2027 GMT
istio-system cacerts-root    rsaEncryption    4096 bit   Jan 10 00:00:00 2036 GMT

Step 2: Count by algorithm

cut -f3,4 tls-inventory.tsv | sort | uniq -c | sort -rn

Step 3: Find certificates that are valid after 2035

kubectl get secrets -A --field-selector type=kubernetes.io/tls -o json \
  | jq -r '.items[] | [.metadata.namespace, .metadata.name, .data["tls.crt"]] | @tsv' \
  | while IFS=$'\t' read -r ns name crt; do
      year=$(echo "$crt" | base64 -d | openssl x509 -noout -enddate 2>/dev/null | awk '{print $4}')
      if [ -n "$year" ] && [ "$year" -ge 2035 ]; then
        echo "$ns/$name is valid until $year"
      fi
    done

These are usually root and intermediate CAs. They are the slow part of the migration.

Step 4: Read what cert-manager is configured to issue

kubectl get certificates -A -o json | jq -r '
  .items[] | [
    .metadata.namespace,
    .metadata.name,
    (.spec.privateKey.algorithm // "RSA (default)"),
    (.spec.privateKey.size // "-" | tostring),
    (.spec.duration // "default"),
    .spec.issuerRef.name
  ] | @tsv'

The privateKey.algorithm field controls the key type of each new certificate. When cert-manager and your issuer support a post-quantum algorithm, this field is where the change happens.

Step 5: Check the control plane PKI (kubeadm clusters)

# On a control plane node
kubeadm certs check-expiration
openssl x509 -in /etc/kubernetes/pki/ca.crt -noout -text | grep -E "Public Key Algorithm|Public-Key|Not After"

The cluster CA from kubeadm is valid for 10 years by default. A cluster that you create today has a CA that is valid after the 2035 deadline.

Common Issues

forbidden on secrets. The inventory needs read access to secrets in all namespaces. Run it with an account that has it, or run it per namespace.

The secret has a chain. openssl x509 reads only the first certificate, the leaf. For the chain, use openssl crl2pkcs7 -nocrl -certfile chain.pem | openssl pkcs7 -print_certs -noout -text.

Service mesh certificates are not in the list. Mesh workload certificates are usually in memory, not in secrets. Read the mesh CA secret and the mesh configuration.

Managed clusters. The control plane PKI belongs to the provider. Ask the provider for its plan.

Best Practices

  • Keep leaf certificates short-lived and automated. The algorithm then changes with a normal renewal.
  • Give each long-lived CA an owner and a replacement date before 2035.
  • Run the inventory on a schedule and keep the reports, so that you can show progress.
  • Do the key exchange first. It protects against “harvest now, decrypt later” today. Signatures are forged only after Q-Day.

Key Takeaways

  • Q-Day has no date. The planning dates are 2030 (deprecated) and 2035 (disallowed).
  • All RSA and ECDSA certificates are affected. AES-256 is not.
  • Leaf certificates are easy when the renewal is automated. Long-lived CAs are the real work.
  • One kubectl and openssl loop gives you the list today.
  • For the migration plan, see Post-Quantum Cryptography on Kubernetes.
#post-quantum #cryptography #q-day #certificates #cert-manager
Luca Berton
Written by Luca Berton

Principal Solutions Architect specializing in Kubernetes, AI/GPU infrastructure, and cloud-native platforms. Author of Kubernetes Recipes and creator of CopyPasteLearn courses.

Book by Grzegorz Stencel & Luca Berton

Kubernetes Recipes

  • Paperback · eBook
  • Apress
  • 750 pages

This recipe is from Kubernetes Recipes, our 750-page practical guide with hundreds of production-ready patterns.

Luca Berton Ansible Pilot Ansible by Example Open Empower K8s Recipes Terraform Pilot CopyPasteLearn ProteinLens