Courseiva

CKA Practice Question: Cluster Architecture, Installation and Configuration

Which TWO commands can be used to check the expiration of certificates managed by kubeadm?

⚠ Common exam trap

Candidates often confuse `kubeadm certs renew --all` (which performs renewal) with `kubeadm certs check-expiration` (which only checks expiration), or they mistakenly think `kubectl get certificates` is a valid command for checking kubeadm-managed certificates, when in fact Kubernetes has a `CertificateSigningRequest` resource but not a generic `certificates` resource for PKI files.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -text | grep -A2 Validity

Option E, `kubeadm certs check-expiration`, is correct because it is the dedicated kubeadm subcommand that lists all kubeadm-managed certificates (in /etc/kubernetes/pki and /etc/kubernetes/pki/etcd) along with their expiration dates, residual time, and CA certificate validity. Option C, `openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -text | grep -A2 Validity`, is correct because it directly parses the X.509 certificate file and prints its Validity period (Not Before / Not After), which is a valid way to inspect the expiration of any individual kubeadm-managed certificate. Option A, `kubeadm upgrade plan`, is not correct because it reports available Kubernetes version upgrades and only incidentally warns about certificate expiry, not as its purpose. Option B, `kubectl get certificates`, is not correct because there is no built-in `certificates` resource in Kubernetes (that would require cert-manager CRDs, which are unrelated to kubeadm PKI). Option D, `kubeadm certs renew --all`, is not correct because it renews certificates rather than checking their expiration.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    kubeadm upgrade plan

    Why it's wrong here

    kubeadm upgrade plan is designed to evaluate the feasibility and steps for upgrading a Kubernetes cluster to a newer version. It compares the current kubeadm version against available release versions and outputs upgrade instructions, but it never reads the validity period of the cluster's PKI certificates. Consequently, it provides no information about apiserver certificate expiration.

  • ✗

    kubectl get certificates

    Why it's wrong here

    There is no built-in Kubernetes API resource type called 'certificates'; the related resource is CertificateSigningRequest (short name 'csr'). Running kubectl get certificates will fail with an error such as "the server doesn't have a resource type 'certificates'". Even if you instead query CSR objects, they only show the status of signing requests, not the expiration of the issued certificate files like apiserver.crt on the control plane node.

  • ✓

    openssl x509 -in /etc/kubernetes/pki/apiserver.crt -noout -text | grep -A2 Validity

    Why this is correct

    The openssl x509 command reads the actual X.509 certificate file at /etc/kubernetes/pki/apiserver.crt and decodes it. With -noout it suppresses the base64 PEM output, and -text prints the structured certificate fields; piping to grep -A2 'Validity' extracts the Not Before and Not After dates, which directly reveal the expiration timestamp. This method works at the filesystem level and is independent of kubeadm's state, making it a reliable diagnostic for any certificate file.

  • ✗

    kubeadm certs renew --all

    Why it's wrong here

    kubeadm certs renew --all triggers an immediate renewal of every kubeadm-managed certificate, overwriting the existing files and requiring a restart of control plane components to take effect. It is strictly a renewal operation, not a status query; it does not display the current validity period or time remaining. Attempting to use it as an expiration check would actually modify cluster state and cause unnecessary downtime.

  • ✓

    kubeadm certs check-expiration

    Why this is correct

    kubeadm certs check-expiration is a read-only diagnostic subcommand that scans /etc/kubernetes/pki and prints a table listing each certificate, its remaining validity, and whether it is externally managed. It uses kubeadm's internal certificate inventory logic to report expiration for apiserver.crt and all other control plane certificates without altering them. This is the intended tool for pre-flight expiry checks in a kubeadm cluster.

About these practice questions

One of 726 original CKA practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This CKA practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKA exam.