설명
Pulumi로 배포하는 Linux Pod에서 파일과 시스템 접근을 제한하려면 AppArmor 프로필을 지정하세요. 어노테이션이 없을 때는 실제 런타임 기본값을 확인하세요.
잠재적 영향
프로필이 노드에 없으면 Pod가 시작되지 않을 수 있고, 규칙이 워크로드와 맞지 않으면 필요한 작업이 거부될 수 있습니다.
해결 방법
현재 API에서는 Pod 또는 컨테이너의 securityContext.appArmorProfile에 RuntimeDefault나 검토한 Localhost 프로필을 지정하세요. 컨테이너 설정이 우선합니다. 사용자 정의 프로필은 AppArmor가 켜진 모든 배치 대상 노드에 먼저 로드하세요.
예시
예시는 Kubernetes 1.30 이전의 어노테이션으로 nginx에 k8s-apparmor-example-allow-write를 요청합니다. 실제 배포에는 지원되는 이미지를 사용하고, 컨테이너에 적용된 프로필과 필요한 작업, 거부 로그를 확인하세요.
변경 전
yaml
resources:
pod:
type: kubernetes:core/v1:Pod
properties:
metadata:
annotations:
spec:
containers:
- image: nginx:1.14.2
name: nginx
변경 후
yaml
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