Description
To restrict file and system access for a Linux Pod deployed with Pulumi, select an AppArmor profile. If the annotation is absent, check the runtime’s effective default.
Potential impact
A missing node profile can prevent the Pod from starting. Rules that do not suit the workload can block required operations.
Remediation
With the current API, set securityContext.appArmorProfile to use RuntimeDefault or a reviewed Localhost profile at the Pod or container level. A container setting takes precedence. Preload custom profiles on every eligible AppArmor-enabled node.
Examples
The pre-1.30 annotation requests k8s-apparmor-example-allow-write for nginx. For deployment, use a maintained image, check the profile actually applied, and review normal operations and denial logs.
Before
resources:
pod:
type: kubernetes:core/v1:Pod
properties:
metadata:
annotations:
spec:
containers:
- image: nginx:1.14.2
name: nginx
After
resources:
pod:
type: kubernetes:core/v1:Pod
properties:
metadata:
annotations:
container.apparmor.security.beta.kubernetes.io/nginx: localhost/k8s-apparmor-example-allow-write
spec:
containers:
- image: nginx:1.14.2
name: nginx