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
The pod is started normally, but the output includes a warning:
311
304
```
312
-
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")
313
-
pod/nginx created
305
+
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")
@@ -80,20 +80,21 @@ The output is similar to this:
80
80
namespace/example created
81
81
```
82
82
83
-
## Apply Pod Security Standards
83
+
## Enable Pod Security Standards checking for that namespace
84
84
85
85
1. Enable Pod Security Standards on this namespace using labels supported by
86
-
built-in Pod Security Admission. In this step we will warn on baseline pod
87
-
security standard as per the latest version (default value)
86
+
built-in Pod Security Admission. In this step you will configure a check to
87
+
warn on Pods that don't meet the latest version of the _baseline_ pod
88
+
security standard.
88
89
89
90
```shell
90
91
kubectl label --overwrite ns example \
91
92
pod-security.kubernetes.io/warn=baseline \
92
93
pod-security.kubernetes.io/warn-version=latest
93
94
```
94
95
95
-
2.Multiple pod security standards can be enabled on any namespace, using labels.
96
-
Following command will `enforce` the `baseline` Pod Security Standard, but
96
+
2.You can configure multiple pod security standard checks on any namespace, using labels.
97
+
The following command will `enforce` the `baseline` Pod Security Standard, but
97
98
`warn` and `audit` for `restricted` Pod Security Standards as per the latest
98
99
version (default value)
99
100
@@ -107,51 +108,34 @@ namespace/example created
107
108
pod-security.kubernetes.io/audit-version=latest
108
109
```
109
110
110
-
## Verify the Pod Security Standards
111
+
## Verify the Pod Security Standard enforcement
111
112
112
-
1. Create a minimal pod in `example` namespace:
113
+
1. Create a baseline Pod in the`example` namespace:
113
114
114
115
```shell
115
-
cat <<EOF > /tmp/pss/nginx-pod.yaml
116
-
apiVersion: v1
117
-
kind: Pod
118
-
metadata:
119
-
name: nginx
120
-
spec:
121
-
containers:
122
-
- image: nginx
123
-
name: nginx
124
-
ports:
125
-
- containerPort: 80
126
-
EOF
116
+
kubectl apply -n example -f https://k8s.io/examples/security/example-baseline-pod.yaml
127
117
```
128
-
129
-
1. Apply the pod spec to the cluster in`example` namespace:
130
-
131
-
```shell
132
-
kubectl apply -n example -f /tmp/pss/nginx-pod.yaml
133
-
```
134
-
The output is similar to this:
118
+
The Pod does start OK; the output includes a warning. For example:
135
119
136
120
```
137
121
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")
138
122
pod/nginx created
139
123
```
140
124
141
-
1. Apply the pod spec to the cluster in`default` namespace:
125
+
1.Create a baseline Pod in the `default` namespace:
0 commit comments