For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/security/code_security/iac_security/iac_rules/k8s/dashboard_is_enabled.md.
A documentation index is available at /llms.txt.
If not needed, disable the dashboard to prevent it from being used as an attack vector. This rule inspects the image fields of containers and initContainers for “kubernetes-dashboard” or “kubernetesui”. Resources deploying these images are reported as incorrect values.
kind:DeploymentapiVersion:apps/v1metadata:labels:k8s-app:kubernetes-dashboardname:kubernetes-dashboard-1namespace:kube-systemspec:replicas:1revisionHistoryLimit:10selector:matchLabels:k8s-app:kubernetes-dashboardtemplate:metadata:labels:k8s-app:kubernetes-dashboardspec:containers:- name:kubernetes-dashboardimage:k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.1ports:- containerPort:8443protocol:TCPargs:- --auto-generate-certificatesvolumeMounts:- name:kubernetes-dashboard-certsmountPath:/certs- mountPath:/tmpname:tmp-volumelivenessProbe:httpGet:scheme:HTTPSpath:/port:8443initialDelaySeconds:30timeoutSeconds:30volumes:- name:kubernetes-dashboard-certssecret:secretName:kubernetes-dashboard-certs- name:tmp-volumeemptyDir:{}serviceAccountName:kubernetes-dashboard# Comment the following tolerations if Dashboard must not be deployed on mastertolerations:- key:node-role.kubernetes.io/mastereffect:NoSchedule---apiVersion:v1kind:Podmetadata:name:myapp-podlabels:app:myappspec:containers:- name:myapp-containerimage:busybox:1.28command:['sh','-c','echo The app is running! && sleep 3600']initContainers:- name:init-myserviceimage:k8s.gcr.io/kubernetesui:v1.10.1command:['sh','-c',"until nslookup myservice.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for myservice; sleep 2; done"]- name:init-mydbimage:busybox:1.28command:['sh','-c',"until nslookup mydb.$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace).svc.cluster.local; do echo waiting for mydb; sleep 2; done"]
1
2
rulesets:- Kubernetes / Kubernetes # Rules to enforce / Kubernetes.
Request a personalized demo
Get Started with Datadog
Ask AI
AI-generated responses may be inaccurate. Verify important info.