Kubelet Certificate Authority Not Set

  • Query id: ec18a0d3-0069-4a58-a7fb-fbfe0b4bbbe0
  • Query name: Kubelet Certificate Authority Not Set
  • Platform: Kubernetes
  • Severity: Medium
  • Category: Secret Management
  • CWE: 295
  • URL: Github

Description

When using kube-apiserver command, the 'kubelet-certificate-authority' flag should be set
Documentation

Code samples

Code samples with security vulnerabilities

Positive test num. 1 - yaml file
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
      command: ["kube-apiserver"]
  restartPolicy: OnFailure

Code samples without security vulnerabilities

Negative test num. 1 - yaml file
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
      command: ["kube-apiserver"]
      args: ["--kubelet-certificate-authority=/path/to/any/cert/file.pem"]
  restartPolicy: OnFailure
Negative test num. 2 - yaml file
apiVersion: v1
kind: Pod
metadata:
  name: command-demo
  labels:
    purpose: demonstrate-command
spec:
  containers:
    - name: command-demo-container
      image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
      command: ["kube-apiserver","--kubelet-certificate-authority=/path/to/any/cert/file.crt"]
      args: []
  restartPolicy: OnFailure