Kubelet Read Only Port Is Not Set To Zero
- Query id: 2940d48a-dc5e-4178-a3f8-bfbd80720b41
- Query name: Kubelet Read Only Port Is Not Set To Zero
- Platform: Kubernetes
- Severity: Medium
- Category: Networking and Firewall
- URL: Github
Description¶
When using the kubelet command, the read-only port should be set to zero (--read-only-port=0)
Documentation
Code samples¶
Code samples with security vulnerabilities¶
Postitive test num. 1 - yaml file
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: joaodanielrufino/kubelet
command: ["kubelet"]
args: ["--read-only-port=1"]
restartPolicy: OnFailure
Postitive test num. 2 - yaml file
apiVersion: v1
kind: Pod
metadata:
name: command-demo
labels:
purpose: demonstrate-command
spec:
containers:
- name: command-demo-container
image: joaodanielrufino/kubelet
command: ["kubelet", "--read-only-port=1"]
restartPolicy: OnFailure
Postitive 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"
readOnlyPort: 1
Postitive test num. 4 - json file
Code samples without security vulnerabilities¶
Negative test num. 1 - yaml file
apiVersion: v1
kind: Pod
metadata:
name: kubelet-demo
labels:
purpose: kubelet-demo
spec:
containers:
- name: kubelet-demo-container
image: joaodanielrufino/kubelet
command: ["kubelet"]
args: ["--read-only-port=0"]
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: joaodanielrufino/kubelet
command: ["kubelet", "--read-only-port=0"]
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"
readOnlyPort: 0