Control: ReplicaSet containers Kubernetes dashboard should not be deployed
Description
This check ensures that the container in the ReplicaSet does not have Kubernetes dashboard deployed.
Usage
Run the control in your terminal:
powerpipe control run kubernetes_compliance.control.replicaset_container_kubernetes_dashboard_not_deployed
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run kubernetes_compliance.control.replicaset_container_kubernetes_dashboard_not_deployed --share
SQL
This control uses a named query:
select coalesce(uid, concat(path, ':', start_line)) as resource, case when c ->> 'image' is null or c ->> 'image' = '' then 'ok' when not pg_typeof(c->>'image') = 'text'::regtype then 'alarm' when c ->> 'image' = 'kubernetes-dashboard' or c ->> 'image' = 'kubernetesui' or labels ->> 'apps' = 'kubernetes-dashboard' or labels ->> 'k8s-app' = 'kubernetes-dashboard' then 'alarm' else 'ok' end as status, case when c ->> 'image' is null or c ->> 'image' = '' then c ->> 'name' || ' no image specified.' when not pg_typeof(c->>'image') = 'text'::regtype then c ->> 'name' || ' image invalid.' when c ->> 'image' = 'kubernetes-dashboard' or c ->> 'image' = 'kubernetesui' or labels ->> 'apps' = 'kubernetes-dashboard' or labels ->> 'k8s-app' = 'kubernetes-dashboard' then c ->> 'name' || ' kubernetes dashboard deployed.' else c ->> 'name' || ' kubernetes dashboard not deployed.' end as reason, name as replicaset_name , coalesce(context_name, '') as context_name, namespace, source_type, coalesce(path || ':' || start_line || '-' || end_line, '') as pathfrom kubernetes_replicaset, jsonb_array_elements(template -> 'spec' -> 'containers') as c;