Review Kubernetes client-certificate CA configuration

Verify trusted CAs and actual authentication when using client certificates.

Description

When kube-apiserver or kubelet authenticates clients by certificate, configure the CA that issued those certificates. Use --client-ca-file or the kubelet configuration field authentication.x509.clientCAFile. Other authentication methods can still apply when this setting is absent.

Potential impact

An unreadable CA file or a missing issuer can prevent legitimate clients from authenticating. Trusting too many issuers can give an unintended identity the permissions assigned to it.

Remediation

Mount the trusted CA certificates as a PEM bundle the server can read. Restrict who can issue certificates or replace the bundle. Check certificate expiry, then test that untrusted certificates are rejected and approved users and groups can perform only their intended operations.

Examples

The kubelet examples change the CA path from ca.txt to ca.pem. Either file can hold valid PEM certificates, so inspect the contents and issuer. The image foo/bar is a placeholder. Apply the configuration and file mount to the node’s kubelet.

Before

yaml
apiVersion: v1
kind: Pod
metadata:
  name: kubelet
spec:
  containers:
    - name: kubelet
      image: foo/bar
      command:
        - "kubelet"
      args:
        - "--client-ca-file=/var/lib/ca.txt"

After

yaml
apiVersion: v1
kind: Pod
metadata:
  name: kubelet
spec:
  containers:
    - name: kubelet
      image: foo/bar
      command:
        - "kubelet"
      args:
        - "--client-ca-file=/var/lib/ca.pem"

References