Files
llm-wiki/raw/official-docs/k8s-application-security-checklist-readonly-fs.md

84 lines
7.6 KiB
Markdown

---
title: "Kubernetes Application Security Checklist — Container-level securityContext (readOnlyRootFilesystem)"
source_type: official-doc
url: https://kubernetes.io/docs/concepts/security/application-security-checklist/
archive_url:
related_branches: [feature-container-runtime-contract]
related_projects: [ca-skeleton]
tags: [official-doc, ca-skeleton, security, runtime, kubernetes, read-only-rootfs, privilege-escalation, drop-capabilities]
created: 2026-06-14
---
# Kubernetes Application Security Checklist — Container-level securityContext (readOnlyRootFilesystem)
> Layer: `raw/official-docs/` — Kubernetes 공식 문서의 **원문 발췌·출처 기록**.
> 검증된 요약은 `/ingest` 후 `wiki/concepts/`에 `source-summary-template` 형식으로 별도 작성. 원본은 raw에 영구 보관.
## Parent / 활용 branch
| Branch | 이 자료가 정당화하는 결정 |
|---|---|
| [[raw/branch-notes/feature-container-runtime-contract]] | D2 — "prod container 는 writable path 최소화 + read-only root filesystem 의무화 + temp directory 명시". Kubernetes Application Security Checklist 의 container-level securityContext 섹션이 `readOnlyRootFilesystem: true` 설정을 명시적으로 권고한다. |
## 출처 / Source
- 원본 URL: https://kubernetes.io/docs/concepts/security/application-security-checklist/
- 아카이브 URL: (미등록 — archive.org 스냅샷 추가 권고)
- 저자 / 조직: Kubernetes Authors / CNCF
- 발행일: (공식 문서, 지속 갱신)
- 마지막 확인일: 2026-06-14
## 왜 저장했는지 / Why archived
`feature-container-runtime-contract` D2 결정("read-only root filesystem 의무화")의 외부 공식 근거가 부재하여 `UNSUPPORTED_DECISION`으로 표기되어 있었다. Kubernetes 공식 문서가 container-level securityContext 에서 `readOnlyRootFilesystem: true` 를 명시적으로 권고하며, 이를 "most applications 에 적용되는 base security hardening" 으로 분류함을 직접 증명하여 D2 를 `official-vendor-doc` 강도로 보강한다.
## 핵심 인용 / Key quotes (verbatim, 3~5문장)
> [§Base security hardening — intro] "The following checklist provides base security hardening recommendations that would apply to most applications deploying to Kubernetes."
> [§Container-level `securityContext` recommendations] "Configure the root filesystem to be read-only with `readOnlyRootFilesystem: true`."
> [§Container-level `securityContext` recommendations] "Disable privilege escalations using `allowPrivilegeEscalation: false`."
> [§Container-level `securityContext` recommendations] "Avoid running privileged containers (set `privileged: false`)."
> [§Container-level `securityContext` recommendations] "Drop all capabilities from the containers and add back only specific ones that are needed for operation of the container."
## Claims Extracted / 추출된 주장
| Claim ID | Claim (이 자료가 직접 말하는 것) | Evidence quote | Strength | Applies to | Does not prove |
|---|---|---|---|---|---|
| K8S-ASC-C1 | Kubernetes 공식 checklist 는 `readOnlyRootFilesystem: true` 를 container-level securityContext 의 명시적 권고 항목으로 열거한다 | [§Container-level `securityContext` recommendations] "Configure the root filesystem to be read-only with `readOnlyRootFilesystem: true`." | `official-vendor-doc` | Kubernetes 에 배포되는 모든 컨테이너 (문서 타겟: developer 관점) | 특정 runtime(CRI-O, containerd)에서 기본 활성화된다는 뜻은 아님. Pod spec 에 명시하지 않으면 적용되지 않음 |
| K8S-ASC-C2 | 이 checklist 의 권고들은 "most applications deploying to Kubernetes" 에 적용되는 **base security hardening** 으로 범위가 명시되어 있다 | [§Base security hardening — intro] "The following checklist provides base security hardening recommendations that would apply to most applications deploying to Kubernetes." | `official-vendor-doc` | Kubernetes cluster 에 배포되는 대부분의 워크로드 | "모든 workload에서 기본 강제된다"거나 "production 환경에서 자동 적용된다"는 뜻이 아님. 적용은 각 팀/project의 결정 |
| K8S-ASC-C3 | Container-level securityContext 는 `allowPrivilegeEscalation: false` + `privileged: false` + capabilities drop ALL 을 포함한 **restricted baseline** 항목을 열거한다 | [§Container-level `securityContext` recommendations] "Disable privilege escalations using `allowPrivilegeEscalation: false`." + "Avoid running privileged containers (set `privileged: false`)." + "Drop all capabilities from the containers and add back only specific ones that are needed for operation of the container." | `official-vendor-doc` | Kubernetes 컨테이너 securityContext 설정 (developer 관점) | 이 4항목(readOnly + noPrivEsc + notPrivileged + dropCaps)이 모든 환경에서 동시 충족 가능하다는 보장 없음. 특정 workload (init container, privileged DaemonSet 등)는 예외 필요 |
### Strength 허용값 (참고)
- `official-vendor-doc` — 적용됨: Kubernetes 공식 docs.kubernetes.io 페이지
## Usage Boundaries / 적용 경계
- **이 자료가 직접 증명하는 것**:
- `K8S-ASC-C1`: `readOnlyRootFilesystem: true` 가 Kubernetes 공식 문서에서 명시적으로 권고된다는 사실.
- `K8S-ASC-C2`: 이 권고들이 "base" (advanced 가 아닌) + "most applications" 범위임을 공식적으로 명시한다는 사실.
- `K8S-ASC-C3`: `allowPrivilegeEscalation: false`, `privileged: false`, drop ALL capabilities 가 동일 섹션에서 함께 권고된다는 사실 (restricted baseline 컨텍스트).
- **이 자료가 증명하지 않는 것**:
- Pod Security Standard 의 `restricted` profile 이 자동으로 `readOnlyRootFilesystem: true` 를 강제한다는 것 (별도 PSA 문서 확인 필요).
- `readOnlyRootFilesystem: true` 적용 시 ca-tmpl 의 모든 write-path 가 emptyDir/tmpfs 로 정상 redirect 된다는 것 (구현 검증 필요 — `feature-container-runtime-contract` Claims To Verify 항목).
- 이 checklist 가 CIS Kubernetes Benchmark 또는 NIST SP 800-190 과 동일한 규범적 강제력을 갖는다는 것.
- **내 프로젝트에 적용하려면 추가 확인이 필요한 것**:
- ca-tmpl 에서 `readOnlyRootFilesystem: true` + `/tmp` tmpfs + `/var/tmp` emptyDir 설정 후 smoke test 로 startup/runtime write 실패 없음 확인 (Claims To Verify `planned` 항목).
- Spring Boot actuator, heap dump path (`/var/tmp/heap/`), temp upload (`/var/tmp/upload/`) 등 모든 write-path 가 emptyDir/tmpfs 로 redirect 되어 있는지 검증.
## 메모 / Notes
- 이 checklist 는 "not meant to be exhaustive and is intended to evolve over time" 으로 명시되어 있음. 향후 버전 변경 시 재확인 권고.
- Caution 섹션이 명시: "Some recommendations in this checklist may be too restrictive or too lax for your specific security needs." — workload 별 예외(예: init container, debug 도구 DaemonSet)는 팀 결정으로 문서화 필요.
- `advanced security hardening` 섹션(Seccomp, AppArmor, SELinux, RuntimeClass, gVisor/kata-containers)은 본 D2 결정 범위 밖 — 별도 branch 에서 다룰 것.
- 추가로 봐야 할 동일 출처 페이지: [Pod Security Standards](https://kubernetes.io/docs/concepts/security/pod-security-standards/) — `restricted` profile 이 `readOnlyRootFilesystem` 을 어떻게 처리하는지 확인.
## Related / 관련
- 같은 주제 다른 official-doc: [[raw/official-docs/container-distroless-google-github]] (distroless = attack surface 축소, 같은 security 방향)
- 이 자료를 인용한 wiki 요약: (미생성 — `/ingest``wiki/concepts/` 에 추가 예정)