Skip to main content
This guide walks through the end-to-end process for creating, approving, inspecting, denying, and deleting Kubernetes CertificateSigningRequest (CSR) objects. Scenario: a new team member, Akshay, requests cluster access. You already have Akshay’s CSR and private key on the control plane under /root. Contents
  • Prerequisites
  • Verify CSR files
  • View CSR (PEM)
  • Base64-encode CSR for Kubernetes manifest
  • Create CSR manifest
  • Apply and inspect CSR
  • Approve CSR and retrieve issued certificate
  • Handle suspicious CSRs: inspect, deny, delete
  • Quick reference table
  • Links and references
Prerequisites
  • kubectl configured to connect to your control plane (you appear to be root on the control plane in these examples).
  • Access to the PEM CSR file and private key (in this scenario: /root/akshay.csr and /root/akshay.key).
Verify where you are and list the CSR/key files
View the CSR (PEM format)
Base64-encode the PEM CSR for use in a Kubernetes CSR manifest Kubernetes expects the PEM CSR as a single-line base64 string placed in spec.request. Generate that one-line string using one of the following commands depending on your environment:
  • GNU/Linux (coreutils base64):
  • macOS (BSD base64) or if your base64 lacks -w:
Copy the output (a single long base64 string) and use it in the CSR manifest below. Create the CSR manifest Create a file (for example akshay.yaml) and paste the base64 string into spec.request. Set metadata.name to akshay and choose an appropriate signerName and usages. Example manifest:
Notes:
  • Use kubernetes.io/kube-apiserver-client as the signer for client certificates intended to authenticate to the API server (kubectl, client certs).
  • usages should reflect the intended purpose: client auth, server auth, digital signature, etc.
Apply the manifest to create the CSR object
Inspect the CSR status (Pending until approved)
Approve the CSR Approving the CSR will cause the configured signer (here, the API server) to issue a certificate.
Verify Approved and Issued status
Retrieve the issued certificate and decode it to a file The issued certificate is placed in the CSR object’s status. Use the JSONPath to extract and decode.
  • GNU/Linux:
  • macOS (BSD base64):
Inspect the certificate:
Handling a suspicious CSR (deny / delete) If a CSR requests highly privileged groups (for example system:masters) or otherwise looks malicious, do not approve it. Instead, inspect, deny, and clean up. Inspect CSR YAML to see requested groups and usages:
Because system:masters is highly privileged, deny it:
Confirm Denied condition
Delete the denied CSR to clean up:
Verify removal:
Best practices and callouts
Always verify the spec.groups and usages requested in a CSR before approving. Never approve CSRs that request system:masters or other highly privileged groups unless you explicitly trust the requester.
When base64-encoding the CSR for spec.request, ensure the encoded value is a single line (no embedded newlines). Use base64 -w 0 on GNU systems or base64 | tr -d '\n' on systems where -w is unsupported.
Quick reference: common commands and fields Links and references This completes the end-to-end flow for creating, approving, inspecting, denying, and deleting Kubernetes CSRs.

Watch Video