궁금한게 많은 개발자 노트

[ K8S ] CKS - Seccomp Profile 본문

DevOps/CKS

[ K8S ] CKS - Seccomp Profile

궁금한게 많은 개발자 2026. 3. 26. 19:31
Create a pod named audit-pod in the default namespace using the nginx image. Ensure that the pod uses the seccomp profile located at /var/lib/kubelet/seccomp/profiles/audit.json on the worker node.

 

[ 포함된 개념 ]

  • Seccomp(Secure Computing Mode): 리눅스 커널 기능으로, 컨테이너가 사용할 수 있는 시스템 콜을 제한합니다.
    • 컨테이너 프로세스 > 시스템 콜 호출 > Seccomp 필터 평가 > 허용 or 거부
    • profile file인 audit.json에 허용/거부할 시스템콜 목록을 정의
    • Seccomp 프로파일 타입
      • Unconfined > seccomp 비활성화 (기본값)
      • RuntimeDefault > 컨테이너 런타임 기본 프로파일
      • Localhost > 노드 로컬 파일 사용 
    • seccompProfile 위치: Pod 수준 vs 컨테이너 수준 주의
  • 상대 경로 주의: K8S에서 Seccomp프로필을 지정할 때는 노드의 절대 경로가 아니라, Kubelet의 기본 경로인 /var/lib/kubelet/seccomp/를 제외한 상대 경로만 작성해야 함

[ 풀이 방법 ]

# pod yaml생성
$ kubectl run audit-pod --image=nginx --dry-run=client -o yaml > seccomp-pod.yaml
$ vi seccomp.yaml
apiVersion: v1
kind: Pod
metadata:
  name: audit-pod
spec:
  securityContext:
    seccompProfile:
      type: Localhost
      localhostProfile: profiles/audit.json  # /var/lib/kubelet/seccomp/ 이후의 경로만 작성!
  containers:
  - name: audit-pod
    image: nginx
    
$ kubectl apply -f seccomp.yaml
Comments