API server etcd CA file configuration needs review

Configure kube-apiserver to verify the etcd server certificate against a trusted CA.

Description

If a private CA issued the etcd server certificate, point kube-apiserver’s --etcd-cafile to that CA. The API server uses it to verify the etcd server it connects to.

Potential impact

Trusting the wrong CA can cause TLS failures. Skipping verification to restore connectivity can connect the API server to the wrong server.

Remediation

Mount the CA file where the API server can read it. For each HTTPS endpoint in --etcd-servers, check that its certificate chains to that CA and its subject alternative names (SANs) cover that endpoint’s hostname or IP address. If etcd requires client authentication, also configure the API server’s --etcd-certfile and --etcd-keyfile, then test the connection.

Examples

These excerpts compare Kubernetes 1.6.0 API server arguments. Use a supported version in production.

Before

yaml
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
      command: ["kube-apiserver"]
      args: []

After

yaml
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
      command: ["kube-apiserver"]
      args: ["--etcd-cafile=/path/to/ca/file.pem"]

Replace /path/to/ca/file.pem in the second excerpt with the mounted CA file path.

References