Ensure the --root-ca-file argument for controller managers is set appropriately

Error: The --root-ca-file argument for controller managers is not set appropriately

Bridgecrew Policy ID: BC_K8S_84
Checkov Check ID: CKV_K8S_111
Severity: HIGH

The --root-ca-file argument for controller managers is not set appropriately

Description

Allow pods to verify the API server's serving certificate before establishing connections.
Processes running within pods that need to contact the API server must verify the API server's serving certificate. Failing to do so could be a subject to man-in-the-middle attacks.
Providing the root certificate for the API server's serving certificate to the controller manager with the --root-ca-file argument allows the controller manager to inject the trusted bundle into pods so that they can verify TLS connections to the API server.

Fix - Buildtime

Kubernetes

  • Kind: Pod
apiVersion: v1
  kind: Pod
  metadata:
    creationTimestamp: null
    labels:
      component: kube-controller-manager
      tier: control-plane
    name: kube-controller-manager
    namespace: kube-system
  spec:
    containers:
    - command:
      - kube-controller-manager
+     -  --root-ca-file=private.pem
      image: gcr.io/google_containers/kube-controller-manager-amd64:v1.6.0