Skip to content

Conversation

uchinda-sph
Copy link
Contributor

No description provided.

Comment on lines +36 to +46
ports:
- name: dns
port: 53
protocol: UDP
targetPort: 53
- name: dns-tcp
port: 53
protocol: TCP
targetPort: 53
selector:
k8s-app: kube-dns

Check warning

Code scanning / Trivy

User Pods should not be placed in kube-system namespace Medium

Artifact: modules/essentials/templates/nodelocaldns.yaml
Type: kubernetes
Vulnerability KSV037
Severity: MEDIUM
Message: Service 'kube-dns-upstream' should not be set with 'kube-system' namespace
Link: KSV037
forward . __PILLAR__UPSTREAM__SERVERS__
prometheus :9253
}
---

Check warning

Code scanning / Trivy

Seccomp policies disabled Medium

Artifact: modules/essentials/templates/nodelocaldns.yaml
Type: kubernetes
Vulnerability KSV104
Severity: MEDIUM
Message: container "node-cache" of daemonset "node-local-dns" in "kube-system" namespace should specify a seccomp profile
Link: KSV104
forward . __PILLAR__UPSTREAM__SERVERS__
prometheus :9253
}
---

Check failure

Code scanning / Trivy

Prevent binding to privileged ports High

Artifact: modules/essentials/templates/nodelocaldns.yaml
Type: kubernetes
Vulnerability KSV117
Severity: HIGH
Message: daemonset node-local-dns in kube-system namespace should not set spec.template.spec.containers.ports.containerPort to less than 1024
Link: KSV117
Comment on lines 114 to 209
updateStrategy:
rollingUpdate:
maxUnavailable: 10%
selector:
matchLabels:
k8s-app: node-local-dns
template:
metadata:
labels:
k8s-app: node-local-dns
annotations:
prometheus.io/port: "9253"
prometheus.io/scrape: "true"
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
- key: eks.amazonaws.com/compute-type
operator: NotIn
values:
- fargate
- auto
priorityClassName: system-node-critical
serviceAccountName: node-local-dns
hostNetwork: true
dnsPolicy: Default # Don't use cluster DNS.
tolerations:
- key: "CriticalAddonsOnly"
operator: "Exists"
- effect: "NoExecute"
operator: "Exists"
- effect: "NoSchedule"
operator: "Exists"
containers:
- name: node-cache
image: registry.k8s.io/dns/k8s-dns-node-cache:${tag}
resources:
requests:
cpu: 25m
memory: 5Mi
args: [ "-localip", "${PILLAR__LOCAL__DNS},${PILLAR__DNS__SERVER}", "-conf", "/etc/Corefile", "-upstreamsvc", "kube-dns-upstream" ]
securityContext:
capabilities:
add:
- NET_ADMIN
ports:
- containerPort: 53
name: dns
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
- containerPort: 9253
name: metrics
protocol: TCP
livenessProbe:
httpGet:
host: ${PILLAR__LOCAL__DNS}
path: /health
port: 8080
initialDelaySeconds: 60
timeoutSeconds: 5
volumeMounts:
- mountPath: /run/xtables.lock
name: xtables-lock
readOnly: false
- name: config-volume
mountPath: /etc/coredns
- name: kube-dns-config
mountPath: /etc/kube-dns
volumes:
- name: xtables-lock
hostPath:
path: /run/xtables.lock
type: FileOrCreate
- name: kube-dns-config
configMap:
name: kube-dns
optional: true
- name: config-volume
configMap:
name: node-local-dns
items:
- key: Corefile
path: Corefile.base

Check failure

Code scanning / Trivy

Access to host network High

Artifact: modules/essentials/templates/nodelocaldns.yaml
Type: kubernetes
Vulnerability KSV009
Severity: HIGH
Message: DaemonSet 'node-local-dns' should not set 'spec.template.spec.hostNetwork' to true
Link: KSV009
Comment on lines 114 to 209
updateStrategy:
rollingUpdate:
maxUnavailable: 10%
selector:
matchLabels:
k8s-app: node-local-dns
template:
metadata:
labels:
k8s-app: node-local-dns
annotations:
prometheus.io/port: "9253"
prometheus.io/scrape: "true"
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
- key: eks.amazonaws.com/compute-type
operator: NotIn
values:
- fargate
- auto
priorityClassName: system-node-critical
serviceAccountName: node-local-dns
hostNetwork: true
dnsPolicy: Default # Don't use cluster DNS.
tolerations:
- key: "CriticalAddonsOnly"
operator: "Exists"
- effect: "NoExecute"
operator: "Exists"
- effect: "NoSchedule"
operator: "Exists"
containers:
- name: node-cache
image: registry.k8s.io/dns/k8s-dns-node-cache:${tag}
resources:
requests:
cpu: 25m
memory: 5Mi
args: [ "-localip", "${PILLAR__LOCAL__DNS},${PILLAR__DNS__SERVER}", "-conf", "/etc/Corefile", "-upstreamsvc", "kube-dns-upstream" ]
securityContext:
capabilities:
add:
- NET_ADMIN
ports:
- containerPort: 53
name: dns
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
- containerPort: 9253
name: metrics
protocol: TCP
livenessProbe:
httpGet:
host: ${PILLAR__LOCAL__DNS}
path: /health
port: 8080
initialDelaySeconds: 60
timeoutSeconds: 5
volumeMounts:
- mountPath: /run/xtables.lock
name: xtables-lock
readOnly: false
- name: config-volume
mountPath: /etc/coredns
- name: kube-dns-config
mountPath: /etc/kube-dns
volumes:
- name: xtables-lock
hostPath:
path: /run/xtables.lock
type: FileOrCreate
- name: kube-dns-config
configMap:
name: kube-dns
optional: true
- name: config-volume
configMap:
name: node-local-dns
items:
- key: Corefile
path: Corefile.base

Check warning

Code scanning / Trivy

hostPath volumes mounted Medium

Artifact: modules/essentials/templates/nodelocaldns.yaml
Type: kubernetes
Vulnerability KSV023
Severity: MEDIUM
Message: DaemonSet 'node-local-dns' should not set 'spec.template.volumes.hostPath'
Link: KSV023
Comment on lines 159 to 194
- name: node-cache
image: registry.k8s.io/dns/k8s-dns-node-cache:${tag}
resources:
requests:
cpu: 25m
memory: 5Mi
args: [ "-localip", "${PILLAR__LOCAL__DNS},${PILLAR__DNS__SERVER}", "-conf", "/etc/Corefile", "-upstreamsvc", "kube-dns-upstream" ]
securityContext:
capabilities:
add:
- NET_ADMIN
ports:
- containerPort: 53
name: dns
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
- containerPort: 9253
name: metrics
protocol: TCP
livenessProbe:
httpGet:
host: ${PILLAR__LOCAL__DNS}
path: /health
port: 8080
initialDelaySeconds: 60
timeoutSeconds: 5
volumeMounts:
- mountPath: /run/xtables.lock
name: xtables-lock
readOnly: false
- name: config-volume
mountPath: /etc/coredns
- name: kube-dns-config
mountPath: /etc/kube-dns

Check notice

Code scanning / Trivy

Runs with GID <= 10000 Low

Artifact: modules/essentials/templates/nodelocaldns.yaml
Type: kubernetes
Vulnerability KSV021
Severity: LOW
Message: Container 'node-cache' of DaemonSet 'node-local-dns' should set 'securityContext.runAsGroup' > 10000
Link: KSV021
Comment on lines 159 to 194
- name: node-cache
image: registry.k8s.io/dns/k8s-dns-node-cache:${tag}
resources:
requests:
cpu: 25m
memory: 5Mi
args: [ "-localip", "${PILLAR__LOCAL__DNS},${PILLAR__DNS__SERVER}", "-conf", "/etc/Corefile", "-upstreamsvc", "kube-dns-upstream" ]
securityContext:
capabilities:
add:
- NET_ADMIN
ports:
- containerPort: 53
name: dns
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
- containerPort: 9253
name: metrics
protocol: TCP
livenessProbe:
httpGet:
host: ${PILLAR__LOCAL__DNS}
path: /health
port: 8080
initialDelaySeconds: 60
timeoutSeconds: 5
volumeMounts:
- mountPath: /run/xtables.lock
name: xtables-lock
readOnly: false
- name: config-volume
mountPath: /etc/coredns
- name: kube-dns-config
mountPath: /etc/kube-dns

Check warning

Code scanning / Trivy

Specific capabilities added Medium

Artifact: modules/essentials/templates/nodelocaldns.yaml
Type: kubernetes
Vulnerability KSV022
Severity: MEDIUM
Message: Container 'node-cache' of DaemonSet 'node-local-dns' should not set 'securityContext.capabilities.add'
Link: KSV022
Comment on lines 159 to 194
- name: node-cache
image: registry.k8s.io/dns/k8s-dns-node-cache:${tag}
resources:
requests:
cpu: 25m
memory: 5Mi
args: [ "-localip", "${PILLAR__LOCAL__DNS},${PILLAR__DNS__SERVER}", "-conf", "/etc/Corefile", "-upstreamsvc", "kube-dns-upstream" ]
securityContext:
capabilities:
add:
- NET_ADMIN
ports:
- containerPort: 53
name: dns
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
- containerPort: 9253
name: metrics
protocol: TCP
livenessProbe:
httpGet:
host: ${PILLAR__LOCAL__DNS}
path: /health
port: 8080
initialDelaySeconds: 60
timeoutSeconds: 5
volumeMounts:
- mountPath: /run/xtables.lock
name: xtables-lock
readOnly: false
- name: config-volume
mountPath: /etc/coredns
- name: kube-dns-config
mountPath: /etc/kube-dns

Check notice

Code scanning / Trivy

Runtime/Default Seccomp profile not set Low

Artifact: modules/essentials/templates/nodelocaldns.yaml
Type: kubernetes
Vulnerability KSV030
Severity: LOW
Message: Either Pod or Container should set 'securityContext.seccompProfile.type' to 'RuntimeDefault'
Link: KSV030
Comment on lines 159 to 194
- name: node-cache
image: registry.k8s.io/dns/k8s-dns-node-cache:${tag}
resources:
requests:
cpu: 25m
memory: 5Mi
args: [ "-localip", "${PILLAR__LOCAL__DNS},${PILLAR__DNS__SERVER}", "-conf", "/etc/Corefile", "-upstreamsvc", "kube-dns-upstream" ]
securityContext:
capabilities:
add:
- NET_ADMIN
ports:
- containerPort: 53
name: dns
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
- containerPort: 9253
name: metrics
protocol: TCP
livenessProbe:
httpGet:
host: ${PILLAR__LOCAL__DNS}
path: /health
port: 8080
initialDelaySeconds: 60
timeoutSeconds: 5
volumeMounts:
- mountPath: /run/xtables.lock
name: xtables-lock
readOnly: false
- name: config-volume
mountPath: /etc/coredns
- name: kube-dns-config
mountPath: /etc/kube-dns

Check notice

Code scanning / Trivy

Container capabilities must only include NET_BIND_SERVICE Low

Artifact: modules/essentials/templates/nodelocaldns.yaml
Type: kubernetes
Vulnerability KSV106
Severity: LOW
Message: container should drop all
Link: KSV106
Comment on lines +224 to +230
clusterIP: None
ports:
- name: metrics
port: 9253
targetPort: 9253
selector:
k8s-app: node-local-dns

Check warning

Code scanning / Trivy

User Pods should not be placed in kube-system namespace Medium

Artifact: modules/essentials/templates/nodelocaldns.yaml
Type: kubernetes
Vulnerability KSV037
Severity: MEDIUM
Message: Service 'node-local-dns' should not be set with 'kube-system' namespace
Link: KSV037
@uchinda-sph uchinda-sph marked this pull request as draft April 21, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant