You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Create a baseline Pod in the `example` namespace:
163
174
-->
164
175
## 验证 Pod 安全标准 {#verify-the-pod-security-standards}
165
176
166
-
1. 在 `example` 名字空间中创建一个最小的 Pod:
167
-
168
-
```shell
169
-
cat <<EOF > /tmp/pss/nginx-pod.yaml
170
-
apiVersion: v1
171
-
kind: Pod
172
-
metadata:
173
-
name: nginx
174
-
spec:
175
-
containers:
176
-
- image: nginx
177
-
name: nginx
178
-
ports:
179
-
- containerPort: 80
180
-
EOF
181
-
```
182
-
183
-
<!--
184
-
2. Apply the pod spec to the cluster in`example` namespace:
185
-
-->
186
-
1. 将 Pod 规约应用到集群中的 `example` 名字空间中:
177
+
1. 在 `example` 名字空间中创建一个基线 Pod:
187
178
188
179
```shell
189
-
kubectl apply -n example -f /tmp/pss/nginx-pod.yaml
180
+
kubectl apply -n example -f https://k8s.io/examples/security/example-baseline-pod.yaml
190
181
```
191
-
192
-
<!-- The output is similar to this: -->
193
-
输出类似于:
182
+
<!--
183
+
The Pod does start OK; the output includes a warning. For example:
184
+
-->
185
+
Pod 确实启动正常;输出包括一条警告信息。例如:
194
186
195
187
```
196
-
Warning: would violate PodSecurity "restricted:latest": allowPrivilegeEscalation != false (container "nginx" must set securityContextallowPrivilegeEscalation=false), unrestricted capabilities (container "nginx" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "nginx" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "nginx" must set securityContextseccompProfile.type to "RuntimeDefault" or "Localhost")
188
+
Warning: would violate PodSecurity "restricted:latest": allowPrivilegeEscalation != false (container "nginx" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "nginx" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "nginx" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "nginx" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")
197
189
pod/nginx created
198
190
```
199
191
200
192
<!--
201
-
1. Apply the pod spec to the cluster in`default` namespace:
193
+
1. Create a baseline Pod in the `default` namespace:
0 commit comments