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
kubectl wait --for=condition=Ready pod -l app=ubuntu-deployment --timeout=300s
130
+
kubectl wait --for=condition=Ready pod -l app=opensuse-deployment --timeout=300s
131
131
```
132
132
133
133
=== Proposal generation
134
134
135
-
After a few seconds, you should see a new `WorkloadPolicyProposal` resource created for the Ubuntu deployment.
135
+
After a few seconds, you should see a new `WorkloadPolicyProposal` resource created for the openSUSE deployment.
136
136
137
137
```bash
138
-
kubectl get workloadpolicyproposals.security.rancher.io deploy-ubuntu-deployment -o yaml
138
+
kubectl get workloadpolicyproposals.security.rancher.io deploy-opensuse-deployment -o yaml
139
139
```
140
140
141
141
```yaml
142
142
apiVersion: security.rancher.io/v1alpha1
143
143
kind: WorkloadPolicyProposal
144
144
metadata:
145
-
name: deploy-ubuntu-deployment
145
+
name: deploy-opensuse-deployment
146
146
namespace: default
147
147
ownerReferences:
148
148
- apiVersion: apps/v1
149
149
blockOwnerDeletion: true
150
150
controller: true
151
151
kind: Deployment
152
-
name: ubuntu-deployment
152
+
name: opensuse-deployment
153
153
uid: f5e1a25e-8a80-4c2a-b21a-b70f28a0651c
154
154
uid: 6aeac998-d4b6-4e17-9ce1-4d76bc4def61
155
155
spec:
156
156
rulesByContainer:
157
-
ubuntu:
157
+
opensuse:
158
158
executables:
159
159
allowed:
160
160
- /usr/bin/ls
161
161
- /usr/bin/sleep
162
162
selector:
163
163
matchLabels:
164
-
app: ubuntu
164
+
app: opensuse
165
165
type: deployment
166
166
```
167
167
168
168
Some notes on this proposal:
169
-
* The proposal includes a list of observed executables for the `ubuntu` container. As expected, it captured the `ls` and `sleep` commands.
169
+
* The proposal includes a list of observed executables for the `opensuse` container. As expected, it captured the `ls` and `sleep` commands.
170
170
* As the name suggests, this is only a proposal and not a definitive policy yet, so nothing is enforced at this stage. To enforce it, we will create a `WorkloadPolicy`.
171
171
* This proposal is tied to a specific workload. Its name is always in the form of `<workload-type>-<workload-name>`. There is also an owner reference to the Deployment so that when the workload is deleted, the proposal can be cleaned up automatically.
172
172
@@ -176,46 +176,46 @@ This proposal looks reasonable for our Deployment, so the next step is convertin
176
176
To do that, we label the `WorkloadPolicyProposal` with the `security.rancher.io/policy-ready` label set to `true`.
After a few seconds, you should see a new Custom Resource called `WorkloadPolicy`.
189
189
190
190
```bash
191
-
kubectl get workloadpolicy.security.rancher.io deploy-ubuntu-deployment -o yaml
191
+
kubectl get workloadpolicy.security.rancher.io deploy-opensuse-deployment -o yaml
192
192
```
193
193
194
194
```yaml
195
195
apiVersion: security.rancher.io/v1alpha1
196
196
kind: WorkloadPolicy
197
197
metadata:
198
-
name: deploy-ubuntu-deployment
198
+
name: deploy-opensuse-deployment
199
199
namespace: default
200
200
ownerReferences:
201
201
- apiVersion: security.rancher.io/v1alpha1
202
202
blockOwnerDeletion: true
203
203
controller: true
204
204
kind: WorkloadPolicyProposal
205
-
name: deploy-ubuntu-deployment
205
+
name: deploy-opensuse-deployment
206
206
uid: 3dcb1758-cbde-4523-bbbf-4170758aa1dd
207
207
uid: 394449cb-db06-4a15-aec0-6274d1f34d8e
208
208
spec:
209
209
mode: monitor
210
210
rulesByContainer:
211
-
ubuntu:
211
+
opensuse:
212
212
executables:
213
213
allowed:
214
214
- /usr/bin/ls
215
215
- /usr/bin/sleep
216
216
selector:
217
217
matchLabels:
218
-
app: ubuntu-deployment
218
+
app: opensuse-deployment
219
219
```
220
220
221
221
The syntax is very similar to the proposal, but there is one important difference: the `spec.mode: monitor` field.
@@ -238,9 +238,9 @@ WARNING: The `security.rancher.io/policy` label must be set at Pod creation time
238
238
WARNING: By default in the runtime-enforcer Helm chart, pods with a non-existing policy will be prevented from running. This ensures that when a pod starts, it has all protection ready. To enable fail-open behavior, set `agent.nriFailopen=true`.
Violations are also visible directly on the WorkloadPolicy status. After the controller's next sync tick (up to 30 seconds), you can inspect them with `kubectl`:
0 commit comments