/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
- 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.csrand/root/akshay.key).
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:
akshay.yaml) and paste the base64 string into spec.request. Set metadata.name to akshay and choose an appropriate signerName and usages. Example manifest:
- Use
kubernetes.io/kube-apiserver-clientas the signer for client certificates intended to authenticate to the API server (kubectl, client certs). usagesshould reflect the intended purpose:client auth,server auth,digital signature, etc.
- GNU/Linux:
- macOS (BSD base64):
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:
system:masters is highly privileged, deny it:
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.
Links and references
- Kubernetes Certificates API: https://kubernetes.io/docs/reference/access-authn-authz/certificate-signing-requests/
- Kubernetes kubectl certificate plugin: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#certificate
- OpenSSL: https://www.openssl.org/