Rotate Kubelet Server Certificate Not Active
- Query id: 1c621b8e-2c6a-44f5-bd6a-fb0fb7ba33e2
- Query name: Rotate Kubelet Server Certificate Not Active
- Platform: Kubernetes
- Severity: Medium
- Category: Secret Management
- URL: Github
Description¶
The RotateKubeletServerCertificate argument should be true
Documentation
Code samples¶
Code samples with security vulnerabilities¶
Positive test num. 1 - yaml file
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
address: "192.168.0.8"
port: 20250
serializeImagePulls: false
evictionHard:
memory.available: "200Mi"
featureGates:
RotateKubeletServerCertificate: false
Positive test num. 2 - yaml file
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: foo/bar
command: ["kubelet"]
args: ["--feature-gates=RotateKubeletServerCertificate=false"]
restartPolicy: OnFailure
Positive test num. 3 - json file
{
"kind": "KubeletConfiguration",
"address": "192.168.0.8",
"apiVersion": "kubelet.config.k8s.io/v1beta1",
"evictionHard": {
"memory.available": "200Mi"
},
"featureGates": {
"RotateKubeletServerCertificate": false
},
"port": 20250,
"serializeImagePulls": false
}
Positive test num. 4 - yaml file
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container7
image: gcr.io/google_containers/kube-apiserver-amd64:v1.6.0
command: ["kube-controller-manager"]
args: ["--feature-gates=RotateKubeletServerCertificate=false"]
restartPolicy: OnFailure
Code samples without security vulnerabilities¶
Negative test num. 1 - yaml file
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
address: "192.168.0.8"
port: 20250
serializeImagePulls: false
evictionHard:
memory.available: "200Mi"
featureGates:
RotateKubeletServerCertificate: true
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: foo/bar
command: ["kubelet"]
args: ["--feature-gates=RotateKubeletServerCertificate=true"]
restartPolicy: OnFailure
Negative test num. 3 - yaml file
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
address: "192.168.0.8"
port: 20250
serializeImagePulls: false
evictionHard:
memory.available: "200Mi"