Skip to content

Commit b44af54

Browse files
authored
Merge pull request kubernetes#2773 from saschagrunert/kep-update
Update SeccompDefault KEP upgrade strategy
2 parents b9d243c + a70cc18 commit b44af54

File tree

1 file changed

+54
-8
lines changed
  • keps/sig-node/2413-seccomp-by-default

1 file changed

+54
-8
lines changed

keps/sig-node/2413-seccomp-by-default/README.md

+54-8
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ Everything else related to the feature.
7373

7474
## Proposal
7575

76-
We introduce a feature gate that enables a seccomp for all workloads by default.
77-
There are a few options for what should be the default seccomp profile.
76+
We introduce a feature gate as well as corresponding kubelet flag that enables a
77+
seccomp for all workloads by default. There are a few options for what should
78+
be the default seccomp profile.
7879

7980
The most preferred solution is to promote the `RuntimeDefault` profile
8081
(previously the `runtime/default` annotation) to the new default one.
@@ -126,7 +127,9 @@ administrates may have to take action if they enable the feature.
126127

127128
The feature gate `SeccompDefault` will ensure that the API graduation can be
128129
done in the standard Kubernetes way. The implementation will be mainly a switch
129-
from `Unconfined` to `RuntimeDefault`.
130+
from `Unconfined` to `RuntimeDefault`. This will only apply if the corresponding
131+
kubelet configuration `SeccompDefault` or the new CLI flag `--seccomp-default`
132+
is enabled together with the feature gate.
130133

131134
Documentation around the feature will be added to the [k/website seccomp
132135
section](https://kubernetes.io/docs/tutorials/clusters/seccomp).
@@ -140,7 +143,7 @@ be extended to cover the new behavior if enabled.
140143

141144
#### Alpha
142145

143-
- [ ] Implement the new feature gate
146+
- [ ] Implement the new feature gate and kubelet configuration
144147
- [ ] Ensure proper tests are in place
145148
- [ ] Update documentation to make the feature visible
146149

@@ -156,9 +159,51 @@ be extended to cover the new behavior if enabled.
156159

157160
### Upgrade / Downgrade Strategy
158161

159-
It's recommended to test the existing workloads with the `RuntimeDefault`
160-
profile before turning the feature on. Beside that, the feature can be enabled
161-
on a per node basis to reduce the risk of failing production workloads.
162+
The strategy for enabling the feature should be done in multiple steps, whereas
163+
risks and mitigations are available for each one.
164+
165+
1. **Feature gate enabling**:
166+
Enabling the feature gate at the kubelet level will not turn on the feature,
167+
but will make it possible by using the `SeccompDefault` kubelet configuration
168+
or the `--seccomp-default` CLI flag.
169+
2. **Testing the Application**:
170+
Before enabling the feature on a node, ensure in a dedicated test environment
171+
that the application code does not trigger syscalls blocked by the
172+
`RuntimeDefault` profile (for [CRI-O][default-crio] or
173+
[containerd][default-containerd]). This can be done by:
174+
- *Recommended*: Analyzing the code for any executed syscalls which may be
175+
blocked by the default profiles. If that's the case, either craft a custom
176+
seccomp profile based on the default or change the application deployment
177+
to `Unconfined`.
178+
- *Recommended*: Run the application against an e2e test suite to trigger
179+
relevant code paths. Monitor the application hosts audit logs (via auditd
180+
or `/var/log/audit/audit.log`) for blocking syscalls via `type=SECCOMP`. If
181+
that's the case, use the same mitigation as mentioned above.
182+
- *Optional*: Create a custom seccomp profile based on the default and change
183+
their default action from `SCMP_ACT_ERRNO` to `SCMP_ACT_LOG`. This means
184+
that the seccomp filter will have no effect on the application at all, but
185+
the audit logs will now indicate which syscalls may be blocked.
186+
- *Optional*: Use cluster additions like the [Security Profiles
187+
Operator][spo] for profiling the application via its log enrichment feature
188+
or recording a profile by using its recording feature.
189+
3. **Deploying the modified application**:
190+
Based on the outcome of 2., it may be required the change the application
191+
deployment by either specifying `Unconfined` or a custom seccomp profile.
192+
This is not the case if the application works as intended with
193+
`RuntimeDefault`.
194+
4. **Enable the kubelet configuration**:
195+
The feature is now ready to be enabled by the kubelet configuration or its
196+
corresponding CLI flag. This should be done on a per-node basis to reduce the
197+
overall risk of missing a syscall during the investigations in point 2. If
198+
it's possible to monitor audit logs within the cluster, then it's recommended
199+
to do this for eventually missed seccomp events. If the application works as
200+
intended then the feature can be enabled for further nodes within the
201+
cluster.
202+
203+
[default-crio]: https://github.com/cri-o/cri-o/blob/v1.21.0/vendor/github.com/containers/common/pkg/seccomp/seccomp.json
204+
[default-containerd]: https://github.com/containerd/containerd/blob/36cc874494a56a253cd181a1a685b44b58a2e34a/contrib/seccomp/seccomp_default.go#L51
205+
[spo]: https://github.com/kubernetes-sigs/security-profiles-operator
206+
[spo-log]: https://github.com/kubernetes-sigs/security-profiles-operator
162207

163208
### Version Skew Strategy
164209

@@ -176,6 +221,7 @@ _This section must be completed when targeting alpha to a release._
176221
- [x] Feature gate (also fill in values in `kep.yaml`)
177222
- Feature gate name: `SeccompDefault`
178223
- Components depending on the feature gate: `kubelet`
224+
- kubelet configuration `SeccompDefault` or CLI option `--seccomp-default`
179225

180226
- **Does enabling the feature change any default behavior?**
181227

@@ -376,7 +422,7 @@ feature at all. This means we fallback to the currently implemented "unconfined
376422
when not set" behavior.
377423

378424
A possible starting point to defining this profile is to look at docker,
379-
containerd and cri-o default profiles.
425+
containerd and CRI-O default profiles.
380426

381427
The advantages of defining a `KubernetesDefault` profile are:
382428

0 commit comments

Comments
 (0)