Skip to content

PKI: KCSA practice questions

A public key infrastructure binds identities to key pairs through certificates signed by a trusted certificate authority. Kubernetes leans on it heavily: TLS protects traffic between components, and client certificates are one of the ways a caller proves who it is to the API server.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What PKI covers in KCSA

A public key infrastructure binds identities to key pairs through certificates signed by a trusted certificate authority. Kubernetes leans on it heavily: TLS protects traffic between components, and client certificates are one of the ways a caller proves who it is to the API server.

The list of certificates a cluster needs is long. On the server side there are certificates for the API server endpoint, for the etcd server and for each kubelet. On the client side, each kubelet authenticates to the API server, the API server authenticates to etcd and to kubelets, and the controller manager, scheduler and kube-proxy each have client certificates for talking to the API server. etcd also uses mutual TLS between clients and peers. A kubeadm cluster typically has three CAs: the general Kubernetes CA (ca.crt and ca.key), a separate etcd CA and a front-proxy CA, plus a key pair used to sign ServiceAccount tokens. kubeadm stores these under /etc/kubernetes/pki by default, with administrator kubeconfig files such as admin.conf in /etc/kubernetes.

Issuing a certificate for a new human user illustrates the pieces. First generate a private key with openssl genrsa (the official walkthrough uses openssl genrsa -out myuser.key 3072, and the key must stay private because anyone holding it can impersonate the user). Then create a certificate signing request with openssl req, setting CN to the user name and O to a group, because the API server reads those fields as the user's name and group membership. Wrap the CSR, base64-encoded, in a CertificateSigningRequest object from the certificates.k8s.io API with signerName kubernetes.io/kube-apiserver-client, an optional expirationSeconds and the client auth usage. An administrator approves it with kubectl certificate approve (or rejects it with kubectl certificate deny); that signer is never auto-approved by the controller manager. The issued certificate appears base64-encoded in .status.certificate, and kubectl config set-credentials with --client-certificate and --client-key adds it to a kubeconfig. The certificate only authenticates; RBAC still decides what the user may do.

Certificates expire, so rotation is part of operations. kubeadm certs check-expiration lists every certificate and its remaining lifetime, and kubeadm certs renew renews them, individually or with renew all. kubeadm also renews all certificates during a control plane upgrade, which is enough for clusters upgraded at least once a year. Kubelet serving certificates generated by kubeadm expire after one year; with rotateCertificates enabled, the kubelet requests new ones through CSRs, which must be approved.

Integrity checks apply to binaries as well as certificates. The Kubernetes download instructions publish a SHA-256 checksum for each binary, and comparing it with sha256sum detects corrupted or tampered downloads before they run on a node.

Key points

  • kubeadm keeps cluster certificates under /etc/kubernetes/pki by default.
  • CN in a client certificate becomes the user name and O becomes the group.
  • kubernetes.io/kube-apiserver-client CSRs are never auto-approved by kube-controller-manager.
  • kubeadm certs check-expiration shows remaining lifetimes; kubeadm certs renew renews them.

Three sample questions

8 KCSA questions on PKI, 8 with explanations. How practice works

Question 1

What is the primary role of Public Key Infrastructure (PKI) in IT security?
  1. A.Managing network configurations
  2. B.Handling storage volumes
  3. C.Issuing and managing digital certificates and encryption keys
  4. D.Maintaining container images
  5. E.Collecting and analyzing application logs

Correct answer: C

Public Key Infrastructure (PKI) is a framework that manages digital certificates and encryption keys to enable secure communication and authentication over networks. It does not handle network configurations, storage volumes, container images, or application logs. PKI ensures trust by issuing certificates that verify identities and encrypt data.

Sources: Microsoft Docs - Public Key Infrastructure (PKI), NIST Special Publication 800-32 - Introduction to Public Key Technology and the Federal PKI Infrastructure

Question 2

What is the recommended method to rotate TLS certificates in a Kubernetes cluster managed by kubeadm?
  1. A.Manually delete and recreate certificates
  2. B.Use the 'kubeadm certs renew' command to renew certificates
  3. C.TLS certificates cannot be rotated once issued
  4. D.Restart the kubelet service to refresh certificates
  5. E.Use a third-party certificate manager exclusively

Correct answer: B

Kubernetes clusters initialized with kubeadm provide the 'kubeadm certs renew' command to safely renew TLS certificates without manual deletion. Manually deleting certificates or restarting kubelet alone is not sufficient and can cause downtime. While third-party certificate managers can be used, kubeadm's built-in commands are the recommended approach for certificate rotation.

Sources: Kubernetes Official Documentation - Managing Certificates, Kubeadm Certificate Management Guide

Question 3

Which command is used to generate a 2048-bit RSA private key for a new Kubernetes user?
  1. A.openssl genrsa -out user.key 2048
  2. B.openssl rsa -in user.key -out user.key
  3. C.openssl req -newkey rsa:2048 -nodes -keyout user.key -out user.csr
  4. D.kubectl create secret tls user.key
  5. E.ssh-keygen -t rsa -b 2048 -f user.key

Correct answer: A

The command 'openssl genrsa -out user.key 2048' generates a 2048-bit RSA private key and saves it to 'user.key'. The second command attempts to process an existing key but does not generate a new one. The third command generates a new private key and a certificate signing request (CSR), not just the key. 'kubectl create secret tls' is for creating TLS secrets, not generating keys. 'ssh-keygen' generates SSH keys, which are different from the keys used for Kubernetes user certificates.

Sources: OpenSSL Documentation - genrsa, Kubernetes Official Documentation - Creating a Client Certificate

Practice this topic

Focus mode keeps every question on PKI until you leave it. 10 free guest answers, then a free account; no credit card.

Or open KCSA practice across all topics.

Sources

The explanation above was checked against these official documents.