هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
ماذا يفعل
kube-bench (Aqua Security) runs the checks of the CIS Kubernetes Benchmark on a node: file permissions of manifests and certificates, API server flags (--anonymous-auth=false, --profiling=false, audit logging), kubelet settings, etcd TLS. Each check is PASS, FAIL, WARN or INFO, with a remediation text. There are profiles for kubeadm, EKS, AKS, GKE, k3s and RKE2.
It is part of CKS (cluster setup: fix the FAIL items it finds).
طريقة الكتابة
kube-bench [run] [--targets master,node,etcd,policies] [--benchmark NAME]الأجزاء الرئيسية
Targets
master- Control-plane components (API server, scheduler, controller manager).
node- kubelet and worker config.
etcd- etcd settings.
controlplane- Authentication and logging.
policies- RBAC, Pod Security, network policies, secrets.
الخيارات 7
الأكثر استخدامًا
Flags
لا يوجد شيء يطابق هذا الفلتر.
أمثلة 10
$ مستخدم عادي# بصلاحية root (أو مع sudo)
1Run as a Kubernetes Job
2Run on a control-plane node
kube-bench run --targets master [FAIL] 1.2.16 Ensure that the --profiling argument is set to false (Automated)3Show only failures
kube-bench run --targets master,node | grep -E "^\[FAIL\]"4Fix a finding (example: profiling)
vim /etc/kubernetes/manifests/kube-apiserver.yaml - --profiling=false kube-bench run --check 1.2.165Check one worker node
kube-bench run --targets node6Use the AKS profile
kubectl apply -f https://raw.githubusercontent.com/aquasecurity/kube-bench/main/job-aks.yaml7k3s profile
kube-bench run --benchmark k3s-cis-1.88JSON report for tracking
kube-bench run --json --outputfile kube-bench.json jq '.Totals' kube-bench.json9Check kubelet file permissions by hand
stat -c "%a %U:%G %n" /var/lib/kubelet/config.yaml /etc/kubernetes/kubelet.conf10Check the API server audit flags
grep -E "audit-log-path|audit-policy-file" /etc/kubernetes/manifests/kube-apiserver.yaml
لا يوجد شيء يطابق هذا الفلتر.
انتبه
- After changing a static pod manifest, the API server restarts; a typo stops it — check with
crictl ps. - Managed clusters (AKS/EKS) hide the control plane; only node and policy checks apply.
الملفات
cfg/- Benchmark definitions (in the container or release).
نصائح للحفظ
- Run it after every cluster upgrade and keep the JSON reports to show progress.
رموز الخروج
0 | Success (also when checks fail, unless --exit-code is set). |
1 | Error. |