TMAegisBeta
Thêm quy tắc cho aks

Azure Kubernetes Service (AKS)

TMA-AKS-4.6.3

The default namespace should not be used

ThấpCấp 2Tự độngaks

Mô tả

Avoid placing application workloads in the default namespace, and instead deploy them into dedicated namespaces that reflect the intended team, application, or environment boundary. In AKS, namespaces are the built-in way to logically divide cluster resources and scope access, while the default namespace exists mainly so a cluster can be used immediately without first creating a new namespace. Requires kubectl read access; fails when the default namespace holds objects other than the kubernetes Service, kube-root-ca.crt ConfigMap and default ServiceAccount.

Cách kiểm tra

Phương pháp kiểm tra: Lệnh shell

shell
out=$(kubectl get pods,services,configmaps,secrets,serviceaccounts,deployments,statefulsets,daemonsets,jobs,cronjobs,ingresses,roles,rolebindings -n default -o name) || exit 1
bad=$(printf '%s\n' "$out" | grep -v '^$' | sed 's#^\([a-z]*\)\.[^/]*/#\1/#' | grep -Evx 'service/kubernetes|configmap/kube-root-ca\.crt|serviceaccount/default')
if [ -z "$bad" ]; then echo compliant; else printf '%s\n' "$bad" | head -n 25; fi
Đầu ra mong đợi
compliant

Cách khắc phục

Phương pháp khắc phục: Hướng dẫn hoặc bản vá hạ tầng

Create purpose-specific namespaces for teams, applications, and environments, then require all new resources to be deployed into those namespaces instead of default. In AKS, namespaces are the logical boundary for workload administration, so remediation should include migrating existing resources into managed namespaces, applying namespace-scoped RBAC and other controls, and reserving cluster-wide access for true platform administrators only.

Thuộc tính

Hệ điều hành
Bất kỳ
Thẻ
akspolicies
Tham chiếu
CIS Azure Kubernetes Service (AKS) Benchmark v2.0.0 - 4.6.3 The default namespace should not be used

Kiểm tra máy này

Chạy lệnh này trên máy bạn được phép kiểm tra. Lần quét chỉ ở chế độ đọc.

shell
tmaegis scan --target aks --level 2