Skip to content

Commit 01a668b

Browse files
authored
Merge pull request #47023 from vinayakankugoyal/armor2
KEP-24: Graduate Kubernetes' support for AppArmor to GA.
2 parents e295a65 + 87a7055 commit 01a668b

File tree

3 files changed

+55
-1
lines changed

3 files changed

+55
-1
lines changed

content/en/docs/reference/command-line-tools-reference/feature-gates/apparmor.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ stages:
99
- stage: beta
1010
defaultValue: true
1111
fromVersion: "1.4"
12+
toVersion: "1.30"
13+
- stage: stable
14+
defaultValue: true
15+
fromVersion: "1.31"
1216
---
1317
Enable use of AppArmor mandatory access control for Pods running on Linux nodes.
1418
See [AppArmor Tutorial](/docs/tutorials/security/apparmor/) for more details.

content/en/docs/tasks/configure-pod-container/security-context.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,56 @@ securityContext:
419419
localhostProfile: my-profiles/profile-allow.json
420420
```
421421

422+
## Set the AppArmor Profile for a Container
423+
424+
To set the AppArmor profile for a Container, include the `appArmorProfile` field
425+
in the `securityContext` section of your Container. The `appArmorProfile` field
426+
is a
427+
[AppArmorProfile](/docs/reference/generated/kubernetes-api/{{< param "version"
428+
>}}/#apparmorprofile-v1-core) object consisting of `type` and `localhostProfile`.
429+
Valid options for `type` include `RuntimeDefault`(default), `Unconfined`, and
430+
`Localhost`. `localhostProfile` must only be set if `type` is `Localhost`. It
431+
indicates the name of the pre-configured profile on the node. The profile needs
432+
to be loaded onto all nodes suitable for the Pod, since you don't know where the
433+
pod will be scheduled.
434+
Approaches for setting up custom profiles are discussed in
435+
[Setting up nodes with profiles](/docs/tutorials/security/apparmor/#setting-up-nodes-with-profiles).
436+
437+
Note: If `containers[*].securityContext.appArmorProfile.type` is explicitly set
438+
to `RuntimeDefault`, then the Pod will not be admitted if AppArmor is not
439+
enabled on the Node. However if `containers[*].securityContext.appArmorProfile.type`
440+
is not specified, then the default (which is also `RuntimeDefault`) will only
441+
be applied if the node has AppArmor enabled. If the node has AppArmor disabled
442+
the Pod will be admitted but the Container will not be restricted by the
443+
`RuntimeDefault` profile.
444+
445+
Here is an example that sets the AppArmor profile to the node's container runtime
446+
default profile:
447+
448+
```yaml
449+
...
450+
containers:
451+
- name: container-1
452+
securityContext:
453+
appArmorProfile:
454+
type: RuntimeDefault
455+
```
456+
457+
Here is an example that sets the AppArmor profile to a pre-configured profile
458+
named `k8s-apparmor-example-deny-write`:
459+
460+
```yaml
461+
...
462+
containers:
463+
- name: container-1
464+
securityContext:
465+
appArmorProfile:
466+
type: Localhost
467+
localhostProfile: k8s-apparmor-example-deny-write
468+
```
469+
470+
For more details please see, [Restrict a Container's Access to Resources with AppArmor](/docs/tutorials/security/apparmor/).
471+
422472
## Assign SELinux labels to a Container
423473

424474
To assign SELinux labels to a Container, include the `seLinuxOptions` field in

content/en/docs/tutorials/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Before walking through each tutorial, you may want to bookmark the
4949

5050
* [Apply Pod Security Standards at Cluster level](/docs/tutorials/security/cluster-level-pss/)
5151
* [Apply Pod Security Standards at Namespace level](/docs/tutorials/security/ns-level-pss/)
52-
* [AppArmor](/docs/tutorials/security/apparmor/)
52+
* [Restrict a Container's Access to Resources with AppArmor](/docs/tutorials/security/apparmor/)
5353
* [Seccomp](/docs/tutorials/security/seccomp/)
5454
## {{% heading "whatsnext" %}}
5555

0 commit comments

Comments
 (0)