-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add localnode dns cache #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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
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
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
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
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
Type: kubernetes
Vulnerability KSV009
Severity: HIGH
Message: DaemonSet 'node-local-dns' should not set 'spec.template.spec.hostNetwork' to true
Link: KSV009
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
Type: kubernetes
Vulnerability KSV023
Severity: MEDIUM
Message: DaemonSet 'node-local-dns' should not set 'spec.template.volumes.hostPath'
Link: KSV023
- 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
Type: kubernetes
Vulnerability KSV021
Severity: LOW
Message: Container 'node-cache' of DaemonSet 'node-local-dns' should set 'securityContext.runAsGroup' > 10000
Link: KSV021
- 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
Type: kubernetes
Vulnerability KSV022
Severity: MEDIUM
Message: Container 'node-cache' of DaemonSet 'node-local-dns' should not set 'securityContext.capabilities.add'
Link: KSV022
- 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
Type: kubernetes
Vulnerability KSV030
Severity: LOW
Message: Either Pod or Container should set 'securityContext.seccompProfile.type' to 'RuntimeDefault'
Link: KSV030
- 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
Type: kubernetes
Vulnerability KSV106
Severity: LOW
Message: container should drop all
Link: KSV106
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
Type: kubernetes
Vulnerability KSV037
Severity: MEDIUM
Message: Service 'node-local-dns' should not be set with 'kube-system' namespace
Link: KSV037
No description provided.