|
| 1 | +--- |
| 2 | +title: Gardener Benchmarking |
| 3 | +weight: 6 |
| 4 | + |
| 5 | +### FIXED, DO NOT MODIFY |
| 6 | +layout: learningpathall |
| 7 | +--- |
| 8 | + |
| 9 | + |
| 10 | +## Gardener Benchmark on GCP SUSE Arm64 VM |
| 11 | +This guide shows how to check the security health of a Gardener Kubernetes cluster running on a GCP SUSE Arm64 VM. We use a tool called **kube-bench**, which checks the cluster against CIS security standards |
| 12 | + |
| 13 | +### Prerequisites |
| 14 | +Before starting, make sure: |
| 15 | +- Gardener Local successfully installed |
| 16 | +- Garden cluster and Shoot cluster in Ready state |
| 17 | +- Docker running |
| 18 | +- Admin access on the VM |
| 19 | + |
| 20 | +**Why this matters:** |
| 21 | +If the cluster is not running or you don’t have admin access, security checks won’t work. |
| 22 | + |
| 23 | +**Verify cluster:** |
| 24 | + |
| 25 | +```console |
| 26 | +kubectl get shoots -n garden |
| 27 | +kubectl get nodes |
| 28 | +``` |
| 29 | +If the cluster is not ready, benchmarking does not make sense yet. |
| 30 | + |
| 31 | +### Download kube-bench |
| 32 | +Download the Arm64-compatible kube-bench binary from the official GitHub release. This tool will be used to check your Kubernetes cluster against CIS security benchmarks. |
| 33 | + |
| 34 | +```console |
| 35 | +curl -L \ |
| 36 | +https://github.com/aquasecurity/kube-bench/releases/download/v0.10.3/kube-bench_0.10.3_linux_arm64.tar.gz |
| 37 | +``` |
| 38 | + |
| 39 | +### Extract and Install kube-bench Configuration |
| 40 | +Extract the downloaded file and place the kube-bench binary and configuration files in standard system locations so the tool can run correctly. |
| 41 | + |
| 42 | +```console |
| 43 | +tar -xvf kube-bench_0.10.3_linux_arm64.tar.gz |
| 44 | +sudo mkdir -p /etc/kube-bench |
| 45 | +sudo cp -r cfg /etc/kube-bench/ |
| 46 | +sudo mv kube-bench /usr/local/bin/ |
| 47 | +``` |
| 48 | + |
| 49 | +**Verify binary:** |
| 50 | +Confirm that kube-bench is installed in the correct path and make it executable. This ensures the system can successfully run the benchmarking tool. |
| 51 | + |
| 52 | +```console |
| 53 | +ls -l /usr/local/bin/kube-bench |
| 54 | +``` |
| 55 | + |
| 56 | +**Make it executable:** |
| 57 | +Execute kube-bench to scan the Kubernetes cluster and evaluate its security based on industry standard CIS checks. |
| 58 | + |
| 59 | +```console |
| 60 | +sudo chmod +x /usr/local/bin/kube-bench |
| 61 | +``` |
| 62 | + |
| 63 | +### Run kube-bench Benchmark |
| 64 | +Execute kube-bench to scan the Kubernetes cluster and evaluate its security based on industry standard CIS checks. |
| 65 | + |
| 66 | +```console |
| 67 | +sudo /usr/local/bin/kube-bench --config-dir /etc/kube-bench/cfg |
| 68 | +``` |
| 69 | +You should see an output similar to: |
| 70 | + |
| 71 | +```output |
| 72 | +5.2.11 Add policies to each namespace in the cluster which has user workloads to restrict the |
| 73 | +admission of containers that have `.securityContext.windowsOptions.hostProcess` set to `true`. |
| 74 | +
|
| 75 | +5.2.12 Add policies to each namespace in the cluster which has user workloads to restrict the |
| 76 | +admission of containers with `hostPath` volumes. |
| 77 | +
|
| 78 | +5.2.13 Add policies to each namespace in the cluster which has user workloads to restrict the |
| 79 | +admission of containers which use `hostPort` sections. |
| 80 | +
|
| 81 | +5.3.1 If the CNI plugin in use does not support network policies, consideration should be given to |
| 82 | +making use of a different plugin, or finding an alternate mechanism for restricting traffic |
| 83 | +in the Kubernetes cluster. |
| 84 | +
|
| 85 | +5.3.2 Follow the documentation and create NetworkPolicy objects as you need them. |
| 86 | +
|
| 87 | +5.4.1 If possible, rewrite application code to read Secrets from mounted secret files, rather than |
| 88 | +from environment variables. |
| 89 | +
|
| 90 | +5.4.2 Refer to the Secrets management options offered by your cloud provider or a third-party |
| 91 | +secrets management solution. |
| 92 | +
|
| 93 | +5.5.1 Follow the Kubernetes documentation and setup image provenance. |
| 94 | +
|
| 95 | +5.7.1 Follow the documentation and create namespaces for objects in your deployment as you need |
| 96 | +them. |
| 97 | +
|
| 98 | +5.7.2 Use `securityContext` to enable the docker/default seccomp profile in your pod definitions. |
| 99 | +An example is as below: |
| 100 | + securityContext: |
| 101 | + seccompProfile: |
| 102 | + type: RuntimeDefault |
| 103 | +
|
| 104 | +5.7.3 Follow the Kubernetes documentation and apply SecurityContexts to your Pods. For a |
| 105 | +suggested list of SecurityContexts, you may refer to the CIS Security Benchmark for Docker |
| 106 | +Containers. |
| 107 | +
|
| 108 | +5.7.4 Ensure that namespaces are created to allow for appropriate segregation of Kubernetes |
| 109 | +resources and that all new resources are created in a specific namespace. |
| 110 | +
|
| 111 | +
|
| 112 | +== Summary policies == |
| 113 | +4 checks PASS |
| 114 | +4 checks FAIL |
| 115 | +27 checks WARN |
| 116 | +0 checks INFO |
| 117 | +
|
| 118 | +== Summary total == |
| 119 | +43 checks PASS |
| 120 | +38 checks FAIL |
| 121 | +49 checks WARN |
| 122 | +0 checks INFO |
| 123 | +``` |
| 124 | +### Benchmark summary on x86_64 |
| 125 | +To compare the benchmark results, the following results were collected by running the same benchmark on a `x86 - c4-standard-4` (4 vCPUs, 15 GB Memory) x86_64 VM in GCP, running SUSE: |
| 126 | + |
| 127 | +| Category / Subsection | PASS | FAIL | WARN | |
| 128 | +| ------------------------------------------- | :--: | :--: | :--: | |
| 129 | +| **1. Control Plane Security Configuration** | | | | |
| 130 | +| └─ 1.1 Control Plane Node Configuration Files | 0 | 18 | 3 | |
| 131 | +| └─ 1.2 API Server | 9 | 7 | 5 | |
| 132 | +| └─ 1.3 Controller Manager | 5 | 0 | 1 | |
| 133 | +| └─ 1.4 Scheduler | 1 | 1 | 0 | |
| 134 | +| **2. Etcd Node Configuration** | | | | |
| 135 | +| └─ 2.1-2.7 Etcd Node Config | 7 | 0 | 0 | |
| 136 | +| **3. Control Plane Configuration** | | | | |
| 137 | +| └─ 3.1 Authentication and Authorization | 0 | 0 | 3 | |
| 138 | +| └─ 3.2 Logging | 0 | 0 | 2 | |
| 139 | +| **4. Worker Node Security Configuration** | | | | |
| 140 | +| └─ 4.1 Worker Node Configuration Files | 2 | 5 | 4 | |
| 141 | +| └─ 4.2 Kubelet | 5 | 3 | 3 | |
| 142 | +| └─ 4.3 kube-proxy | 1 | 0 | 0 | |
| 143 | +| **5. Kubernetes Policies** | | | | |
| 144 | +| └─ 5.1 RBAC and Service Accounts | 0 | 6 | 7 | |
| 145 | +| └─ 5.2 Pod Security Standards | 0 | 0 | 13 | |
| 146 | +| └─ 5.3 Network Policies and CNI | 0 | 0 | 2 | |
| 147 | +| └─ 5.4 Secrets Management | 0 | 0 | 2 | |
| 148 | +| └─ 5.5 Extensible Admission Control | 0 | 0 | 1 | |
| 149 | +| └─ 5.7 General Policies | 0 | 0 | 4 | |
| 150 | +| **Total** | 34 | 42 | 54 | |
| 151 | + |
| 152 | +### Benchmark summary on Arm64 |
| 153 | +Results from the earlier run on the `c4a-standard-4` (4 vCPU, 16 GB memory) Arm64 VM in GCP (SUSE): |
| 154 | + |
| 155 | +| Category / Subsection | PASS | FAIL | WARN | |
| 156 | +|-------------------------------------------------|:----:|:----:|:----:| |
| 157 | +| **1. Control Plane Security Configuration** | | | | |
| 158 | +| └─ 1.1 Control Plane Node Configuration Files | 0 | 18 | 3 | |
| 159 | +| └─ 1.2 API Server | 9 | 7 | 5 | |
| 160 | +| └─ 1.3 Controller Manager | 5 | 0 | 1 | |
| 161 | +| └─ 1.4 Scheduler | 1 | 1 | 0 | |
| 162 | +| **2. Etcd Node Configuration** | | | | |
| 163 | +| └─ 2.1-2.7 Etcd Node Config | 7 | 0 | 0 | |
| 164 | +| **3. Control Plane Configuration** | | | | |
| 165 | +| └─ 3.1 Authentication and Authorization | 0 | 0 | 3 | |
| 166 | +| └─ 3.2 Logging | 1 | 0 | 1 | |
| 167 | +| **4. Worker Node Security Configuration** | | | | |
| 168 | +| └─ 4.1 Worker Node Configuration Files | 2 | 5 | 4 | |
| 169 | +| └─ 4.2 Kubelet | 5 | 3 | 3 | |
| 170 | +| └─ 4.3 kube-proxy | 1 | 0 | 0 | |
| 171 | +| **5. Kubernetes Policies** | | | | |
| 172 | +| └─ 5.1 RBAC and Service Accounts | 2 | 4 | 6 | |
| 173 | +| └─ 5.2 Pod Security Standards | 2 | 0 | 9 | |
| 174 | +| └─ 5.3 Network Policies and CNI | 0 | 0 | 2 | |
| 175 | +| └─ 5.4 Secrets Management | 0 | 0 | 2 | |
| 176 | +| └─ 5.5 Extensible Admission Control | 0 | 0 | 1 | |
| 177 | +| └─ 5.7 General Policies | 0 | 0 | 4 | |
| 178 | +| **Total** | 43 | 38 | 49 | |
| 179 | + |
| 180 | +### Gardener benchmarking comparison on Arm64 and x86_64 |
| 181 | + |
| 182 | +- **Strong Baseline Security:** The cluster passed **43 CIS checks**, indicating a solid foundational security posture out of the box on **Arm64 (C4A)** infrastructure. |
| 183 | +- **Control Plane Hardening Gaps:** A significant number of **FAIL results (38)** are concentrated in **control plane file permissions and API server settings**, which are commonly unmet in development and local/KinD-based setups. |
| 184 | +- **Healthy Etcd Configuration:** All **Etcd-related checks passed (7/7)**, demonstrating correct encryption, access controls, and secure peer/client configuration on **Arm64**. |
| 185 | +- **Worker Node Improvements Needed:** Worker node checks show mixed results, with failures mainly around **kubelet configuration and file permissions**, highlighting clear opportunities for security hardening. |
| 186 | +- **Policy-Level Defaults:** Most **Kubernetes policy checks surfaced as WARN**, reflecting features such as **Pod Security Standards, NetworkPolicies, and admission controls** being optional or not strictly enforced by default. |
| 187 | +- **Arm64 Parity with x86_64:** The overall benchmark profile aligns with typical results seen on **x86_64 clusters**, confirming that **Arm64 introduces no architecture-specific security limitations**. |
| 188 | +- **Production Readiness Signal:** With targeted remediation—especially for **control plane and kubelet configurations**—the **Arm64-based cluster** can achieve **full CIS compliance** while benefiting from **Arm’s cost and energy efficiency**. |
0 commit comments