From 784f7623df19d5c679a414d0e4eb6b1b57417969 Mon Sep 17 00:00:00 2001 From: rollony Date: Sat, 13 Aug 2022 03:44:20 -0700 Subject: [PATCH] Translated /docs/concepts/security/pod-security-standards into Korean Reflected yoonian's comments Reflected yoonian's comments Reflected yoonian's comments --- .../security/pod-security-standards.md | 523 ++++++++++++++++++ ...ith-cluster-level-baseline-pod-security.sh | 70 +++ ...h-namespace-level-baseline-pod-security.sh | 28 + .../security/podsecurity-baseline.yaml | 9 + .../security/podsecurity-privileged.yaml | 7 + .../security/podsecurity-restricted.yaml | 9 + 6 files changed, 646 insertions(+) create mode 100644 content/ko/docs/concepts/security/pod-security-standards.md create mode 100644 content/ko/examples/security/kind-with-cluster-level-baseline-pod-security.sh create mode 100644 content/ko/examples/security/kind-with-namespace-level-baseline-pod-security.sh create mode 100644 content/ko/examples/security/podsecurity-baseline.yaml create mode 100644 content/ko/examples/security/podsecurity-privileged.yaml create mode 100644 content/ko/examples/security/podsecurity-restricted.yaml diff --git a/content/ko/docs/concepts/security/pod-security-standards.md b/content/ko/docs/concepts/security/pod-security-standards.md new file mode 100644 index 0000000000..8100e5a1d5 --- /dev/null +++ b/content/ko/docs/concepts/security/pod-security-standards.md @@ -0,0 +1,523 @@ +--- +# reviewers: +# - +title: 파드 시큐리티 스탠다드 +description: > + 파드 시큐리티 스탠다드에 정의된 여러 가지 정책 레벨에 대한 세부사항 +content_type: concept +weight: 10 +--- + + + +파드 시큐리티 스탠다드에서는 보안 범위를 넓게 다루기 위해 세 가지 _정책을_ 정의한다. +이러한 정책은 _점증적이며_ 매우 허용적인 것부터 매우 제한적인 것까지 있다. +이 가이드는 각 정책의 요구사항을 간략히 설명한다. + +| 프로필 | 설명 | +| ------ | ----------- | +| 특권(Privileged) | 무제한 정책으로, 가장 넓은 범위의 권한 수준을 제공한다. 이 정책은 알려진 권한 상승(privilege escalations)을 허용한다. | +| 기본(Baseline) | 알려진 권한 상승을 방지하는 최소한의 제한 정책이다. 기본(최소로 명시된) 파드 구성을 허용한다. | +| 제한(Restricted) | 엄격히 제한된 정책으로 현재 파드 하드닝 모범 사례를 따른다. | + + + +## 프로필 세부사항 + +### 특권(Privileged) {#privileged} + +**_특권_ 정책은 의도적으로 열려있으며 전적으로 제한이 없다.** 이러한 종류의 정책은 +권한이 있고 신뢰할 수 있는 사용자가 관리하는 시스템 및 인프라 수준의 워크로드를 대상으로 한다. + +특권 정책은 제한 사항이 없는 것으로 정의한다. 기본으로 허용하는 메커니즘(예를 들면, gatekeeper)은 당연히 특권 정책일 수 있다. +반대로, 기본적으로 거부하는 메커니즘(예를 들면, 파드 시큐리티 폴리시)의 경우 특권 정책은 +모든 제한 사항을 비활성화해야 한다. + +### 기본(Baseline) {#baseline} + +**_기본_ 정책은 알려진 권한 상승을 방지하면서 일반적인 컨테이너 워크로드에 대해 정책 채택을 쉽게 하는 것을 목표로 한다.** +이 정책은 일반적인(non-critical) 애플리케이션의 운영자 및 개발자를 대상으로 한다. +아래 명시한 제어 방식은 다음과 같이 +강행되거나 금지되어야 한다. + +{{< note >}} +다음 표에서 와일드카드(`*`)는 리스트에 포함된 모든 요소들을 가리킨다. +예를 들어, `spec.containers[*].securityContext`는 시큐리티 컨텍스트 오브젝트에 _정의되어 있는 모든 컨테이너를_ 가리킨다. +정의된 컨테이너 중 하나라도 요구사항을 충족시키지 못한다면, 파드 전체가 +검증 과정에서 실패한다. +{{< /note >}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
기본(Baseline) 정책 명세서
제어정책
호스트 프로세스 +

윈도우 파드는 호스트 프로세스 컨테이너를 실행할 권한을 제공하며, 이는 윈도우 노드에 대한 특권 접근을 가능하게 한다. 기본 정책에서의 호스트에 대한 특권 접근은 허용되지 않는다. {{< feature-state for_k8s_version="v1.23" state="beta" >}}

+

제한된 필드

+
    +
  • spec.securityContext.windowsOptions.hostProcess
  • +
  • spec.containers[*].securityContext.windowsOptions.hostProcess
  • +
  • spec.initContainers[*].securityContext.windowsOptions.hostProcess
  • +
  • spec.ephemeralContainers[*].securityContext.windowsOptions.hostProcess
  • +
+

허용된 값

+
    +
  • Undefined/nil
  • +
  • false
  • +
+
호스트 네임스페이스 +

호스트 네임스페이스 공유는 금지된다.

+

제한된 필드

+
    +
  • spec.hostNetwork
  • +
  • spec.hostPID
  • +
  • spec.hostIPC
  • +
+

허용된 값

+
    +
  • Undefined/nil
  • +
  • false
  • +
+
특권 컨테이너 +

특권 파드(Privileged Pods)는 대부분의 보안 메커니즘을 비활성화하므로 금지된다.

+

제한된 필드

+
    +
  • spec.containers[*].securityContext.privileged
  • +
  • spec.initContainers[*].securityContext.privileged
  • +
  • spec.ephemeralContainers[*].securityContext.privileged
  • +
+

허용된 값

+
    +
  • Undefined/nil
  • +
  • false
  • +
+
기능(Capabilities) +

아래 명시되지 않은 부가 기능을 추가하는 작업은 금지된다.

+

제한된 필드

+
    +
  • spec.containers[*].securityContext.capabilities.add
  • +
  • spec.initContainers[*].securityContext.capabilities.add
  • +
  • spec.ephemeralContainers[*].securityContext.capabilities.add
  • +
+

허용된 값

+
    +
  • Undefined/nil
  • +
  • AUDIT_WRITE
  • +
  • CHOWN
  • +
  • DAC_OVERRIDE
  • +
  • FOWNER
  • +
  • FSETID
  • +
  • KILL
  • +
  • MKNOD
  • +
  • NET_BIND_SERVICE
  • +
  • SETFCAP
  • +
  • SETGID
  • +
  • SETPCAP
  • +
  • SETUID
  • +
  • SYS_CHROOT
  • +
+
호스트 경로(hostPath) 볼륨 +

호스트 경로 볼륨은 금지된다.

+

제한된 필드

+
    +
  • spec.volumes[*].hostPath
  • +
+

허용된 값

+
    +
  • Undefined/nil
  • +
+
호스트 포트 +

호스트 포트는 허용되지 않아야 하며, 또는 적어도 알려진 목록 범위내로 제한되어야 한다.

+

제한된 필드

+
    +
  • spec.containers[*].ports[*].hostPort
  • +
  • spec.initContainers[*].ports[*].hostPort
  • +
  • spec.ephemeralContainers[*].ports[*].hostPort
  • +
+

허용된 값

+
    +
  • Undefined/nil
  • +
  • Known list
  • +
  • 0
  • +
+
AppArmor +

지원되는 호스트에서는, runtime/default AppArmor 프로필이 기본으로 적용된다. 기본 정책은 기본 AppArmor 프로필이 오버라이드 및 비활성화되는 것을 방지해야 하며, 또는 허용된 프로필에 한해서만 오버라이드 되도록 제한해야 한다.

+

제한된 필드

+
    +
  • metadata.annotations["container.apparmor.security.beta.kubernetes.io/*"]
  • +
+

허용된 값

+
    +
  • Undefined/nil
  • +
  • runtime/default
  • +
  • localhost/*
  • +
+
SELinux +

SELinux 타입을 설정하는 것은 제한되며, 맞춤 SELinux 사용자 및 역할 옵션을 설정하는 것은 금지되어 있다.

+

제한된 필드

+
    +
  • spec.securityContext.seLinuxOptions.type
  • +
  • spec.containers[*].securityContext.seLinuxOptions.type
  • +
  • spec.initContainers[*].securityContext.seLinuxOptions.type
  • +
  • spec.ephemeralContainers[*].securityContext.seLinuxOptions.type
  • +
+

허용된 값

+
    +
  • Undefined/""
  • +
  • container_t
  • +
  • container_init_t
  • +
  • container_kvm_t
  • +
+
+

제한된 필드

+
    +
  • spec.securityContext.seLinuxOptions.user
  • +
  • spec.containers[*].securityContext.seLinuxOptions.user
  • +
  • spec.initContainers[*].securityContext.seLinuxOptions.user
  • +
  • spec.ephemeralContainers[*].securityContext.seLinuxOptions.user
  • +
  • spec.securityContext.seLinuxOptions.role
  • +
  • spec.containers[*].securityContext.seLinuxOptions.role
  • +
  • spec.initContainers[*].securityContext.seLinuxOptions.role
  • +
  • spec.ephemeralContainers[*].securityContext.seLinuxOptions.role
  • +
+

허용된 값

+
    +
  • Undefined/""
  • +
+
/proc 마운트 타입 +

기본 /proc 마스크는 공격 가능 영역을 최소화하기 위해 설정되고 필수이다.

+

제한된 필드

+
    +
  • spec.containers[*].securityContext.procMount
  • +
  • spec.initContainers[*].securityContext.procMount
  • +
  • spec.ephemeralContainers[*].securityContext.procMount
  • +
+

허용된 값

+
    +
  • Undefined/nil
  • +
  • Default
  • +
+
Seccomp +

Seccomp 프로필은 Unconfined으로 설정하면 안된다.

+

제한된 필드

+
    +
  • spec.securityContext.seccompProfile.type
  • +
  • spec.containers[*].securityContext.seccompProfile.type
  • +
  • spec.initContainers[*].securityContext.seccompProfile.type
  • +
  • spec.ephemeralContainers[*].securityContext.seccompProfile.type
  • +
+

허용된 값

+
    +
  • Undefined/nil
  • +
  • RuntimeDefault
  • +
  • Localhost
  • +
+
Sysctls +

Sysctls는 보안 메커니즘을 비활성화 시키거나 호스트에 위치한 모든 컨테이너에 영향을 미칠 수 있으며, 허용된 "안전한" 서브넷을 제외한 곳에서는 허용되지 않아야 한다. 컨테이너 또는 파드 네임스페이스에 속해 있거나, 같은 노드 내의 다른 파드 및 프로세스와 격리된 상황에서만 sysctl 사용이 안전하다고 간주한다.

+

제한된 필드

+
    +
  • spec.securityContext.sysctls[*].name
  • +
+

허용된 값

+
    +
  • Undefined/nil
  • +
  • kernel.shm_rmid_forced
  • +
  • net.ipv4.ip_local_port_range
  • +
  • net.ipv4.ip_unprivileged_port_start
  • +
  • net.ipv4.tcp_syncookies
  • +
  • net.ipv4.ping_group_range
  • +
+
+ +### 제한(Restricted) {#restricted} + +**_제한_ 정책은 일부 호환성을 희생하면서 현재 사용되고 있는 파드 하드닝 모범 사례 시행하는 것을 목표로 한다.** +보안이 중요한 애플리케이션의 운영자 및 개발자는 물론 신뢰도가 낮은 사용자도 대상으로 한다. +아래에 나열된 제어 방식은 +강제되거나 금지되어야 한다. + +{{< note >}} +다음 표에서 와일드카드(`*`)는 리스트에 포함된 모든 요소들을 가리킨다. +예를 들어, `spec.containers[*].securityContext`는 시큐리티 컨텍스트 오브젝트에 _정의되어 있는 모든 컨테이너를_ 가리킨다. +나열된 컨테이너 중 하나라도 요구사항을 충족시키지 못한다면, 파드 전체가 +검증에 실패한다. +{{< /note >}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
제한 정책 명세서
제어정책
기본 프로필에 해당하는 모든 요소
볼륨 타입 +

제한 정책은 다음과 같은 볼륨 타입만 허용한다.

+

제한된 필드

+
    +
  • spec.volumes[*]
  • +
+

허용된 값

+ spec.volumes[*] 목록에 속한 모든 아이템은 다음 필드 중 하나를 null이 아닌 값으로 설정해야 한다. +
    +
  • spec.volumes[*].configMap
  • +
  • spec.volumes[*].csi
  • +
  • spec.volumes[*].downwardAPI
  • +
  • spec.volumes[*].emptyDir
  • +
  • spec.volumes[*].ephemeral
  • +
  • spec.volumes[*].persistentVolumeClaim
  • +
  • spec.volumes[*].projected
  • +
  • spec.volumes[*].secret
  • +
+
권한 상승(v1.8+) +

권한 상승(예를 들어, set-user-ID 또는 set-group-ID 파일 모드를 통한)은 허용되지 않아야 한다. v1.25+에서는 리눅스 전용 정책이다.(spec.os.name != windows)

+

제한된 필드

+
    +
  • spec.containers[*].securityContext.allowPrivilegeEscalation
  • +
  • spec.initContainers[*].securityContext.allowPrivilegeEscalation
  • +
  • spec.ephemeralContainers[*].securityContext.allowPrivilegeEscalation
  • +
+

허용된 값

+
    +
  • false
  • +
+
루트가 아닌 권한으로 실행 +

컨테이너는 루트가 아닌 사용자 권한으로 실행되어야 한다.

+

제한된 필드

+
    +
  • spec.securityContext.runAsNonRoot
  • +
  • spec.containers[*].securityContext.runAsNonRoot
  • +
  • spec.initContainers[*].securityContext.runAsNonRoot
  • +
  • spec.ephemeralContainers[*].securityContext.runAsNonRoot
  • +
+

허용된 값

+
    +
  • true
  • +
+ + pod-level에서 spec.securityContext.runAsNonRoottrue로 설정되면 + 컨테이너 필드는 undefined/nil로 설정될 수 있다. + +
루트가 아닌 사용자로 실행(v1.23+) +

컨테이너에서는 runAsUser 값을 0으로 설정하지 않아야 한다.

+

제한된 필드

+
    +
  • spec.securityContext.runAsUser
  • +
  • spec.containers[*].securityContext.runAsUser
  • +
  • spec.initContainers[*].securityContext.runAsUser
  • +
  • spec.ephemeralContainers[*].securityContext.runAsUser
  • +
+

허용된 값

+
    +
  • any non-zero value
  • +
  • undefined/null
  • +
+
Seccomp(v1.19+) +

Seccomp 프로필은 다음과 같은 값으로 설정되어야 한다.Unconfined 프로필 및 프로필의 absence는 금지되어 있다. v1.25+에서는 리눅스 전용 정책이다.(spec.os.name != windows)

+

제한된 필드

+
    +
  • spec.securityContext.seccompProfile.type
  • +
  • spec.containers[*].securityContext.seccompProfile.type
  • +
  • spec.initContainers[*].securityContext.seccompProfile.type
  • +
  • spec.ephemeralContainers[*].securityContext.seccompProfile.type
  • +
+

허용된 값

+
    +
  • RuntimeDefault
  • +
  • Localhost
  • +
+ + pod-level의 spec.securityContext.seccompProfile.type 필드가 적절하게 설정되면, + 컨테이너 필드는 undefined/nil로 설정될 수 있다. + 모든 컨테이너 레벨 필드가 설정되어 있다면, + pod-level 필드는 undefined/nil로 설정될 수 있다. + +
능력(Capabilities) (v1.22+) +

+ 컨테이너는 ALL 능력을 내려놓아야 하며, + NET_BIND_SERVICE 능력을 다시 추가하기 위한 목적일 때만 허용되어야 한다. v1.25+에서는 리눅스 전용 정책이다.(spec.os.name != windows)

+

+

제한된 필드

+
    +
  • spec.containers[*].securityContext.capabilities.drop
  • +
  • spec.initContainers[*].securityContext.capabilities.drop
  • +
  • spec.ephemeralContainers[*].securityContext.capabilities.drop
  • +
+

허용된 값

+
    +
  • ALL을 포함하고 있는 모든 능력 리스트
  • +
+
+

제한된 필드

+
    +
  • spec.containers[*].securityContext.capabilities.add
  • +
  • spec.initContainers[*].securityContext.capabilities.add
  • +
  • spec.ephemeralContainers[*].securityContext.capabilities.add
  • +
+

허용된 값

+
    +
  • Undefined/nil
  • +
  • NET_BIND_SERVICE
  • +
+
+ +## 정책 초기화 + +정책 초기화에서의 디커플링(Decoupling) 정책 정의는, +내재되어 있는 시행 메커니즘과 별개로 +클러스터 사이의 공통된 이해와 일관된 정책 언어 사용을 가능하게끔 한다. + +메커니즘이 발달함에 따라, 아래와 같이 정책별로 정의가 될 것이다. +개별 정책에 대한 시행 방식은 여기서 정의하고 있지 않는다. + +[**파드 시큐리티 어드미션 컨트롤러**](/docs/concepts/security/pod-security-admission/) + +- {{< example file="security/podsecurity-privileged.yaml" >}}특권 네임스페이스{{< /example >}} +- {{< example file="security/podsecurity-baseline.yaml" >}}기본 네임스페이스{{< /example >}} +- {{< example file="security/podsecurity-restricted.yaml" >}}제한 네임스페이스{{< /example >}} + +### 대안 + +{{% thirdparty-content %}} + +쿠버네티스 환경에서 정책을 시행하기 위한 대안이 개발되고 있으며 다음은 몇 가지 예시이다. + +- [Kubewarden](https://github.com/kubewarden) +- [Kyverno](https://kyverno.io/policies/pod-security/) +- [OPA Gatekeeper](https://github.com/open-policy-agent/gatekeeper) + +## 파드 OS 필드 + +쿠버네티스에서는 리눅스 또는 윈도우를 실행하는 노드를 사용할 수 있다. +하나의 클러스터에 두 종류의 노드를 혼합하여 사용할 수 있다. +윈도우 환경 쿠버네티스는 리눅스 기반 워크로드와 비교하였을 때 몇 가지 제한사항 및 차별점이 있다. +구체적으로 말하자면, 대부분의 파드 `securityContext` 필드는 +[윈도우 환경에서 효과가 없다](/ko/docs/concepts/windows/intro/#compatibility-v1-pod-spec-containers-securitycontext). + +{{< note >}} +v1.24 이전 Kubelet은 파드 OS 필드를 필수로 요구하지 않으며, 만일 클러스터 내에 v1.24 이전에 해당하는 노드가 있다면 v1.25 이전 버전의 제한 정책을 적용해야 한다. +{{< /note >}} + +### 제한 파드의 시큐리티 스탠다드 변화 +쿠버네티스 v1.25에서 나타난 또 다른 중요 변화는, _제한_ 파드 시큐리티가 `pod.spec.os.name` 필드를 사용하도록 업데이트 되었다는 것이다. +특정 OS에 특화된 일부 정책은 OS 이름에 근거하여 +다른 OS에 대해서는 완화될 수 있다 + + +#### 특정 OS 정책 제어 +`spec.os.name`의 값이 `windows`가 아닐 시에만 다음 제어 항목에 대한 제한 사항이 요구된다. +- 권한 상승 +- Seccomp +- Linux 기능 + +## FAQ + +### 왜 특권 프로필과 기본 프로필 사이의 프로필은 없는 것인가? + +여기서 정의된 세 가지 프로필은 가장 높은 보안에서(제한 프로필) 가장 낮은 보안까지(특권 프로필) +명백한 선형 관계를 가지며 넓은 범위의 워크로드를 다룬다. +기본 정책을 넘는 요청 권한은 일반적으로 애플리케이션 전용에 속하므로 이러한 틈새시장에 대해서는 표준 프로필을 제공하지 않는다. +이 경우에는 항상 특권 프로필을 사용해야 한다는 주장은 아니지만, +해당 영역의 정책은 케이스 별로 정의되어야 한다는 것이다. + +이외 프로필이 분명히 필요하다면 SIG Auth는 향후에 이러한 입장을 재고할 수 있다. + +### 시큐리티 컨텍스트와 시큐리티 프로필의 차이점은 무엇인가? + +[시큐리티 컨텍스트](/docs/tasks/configure-pod-container/security-context/)는 파드 및 컨테이너를 런타임에 설정한다. +시큐리티 컨텍스트는 파드 매니페스트 내 +파드 및 컨테이너 명세의 일부로 정의되고 컨테이너 런타임에 파라미터로 제공한다. + +시큐리티 프로필은 컨트롤 플레인 메커니즘으로, 시큐리티 컨텍스트의 상세 설정을 비롯하여 +시큐리티 컨텍스트 외부의 다른 관련된 파라미터도 적용한다. +2021년 7월부로, [파드 시큐리티 폴리시](/ko/docs/concepts/security/pod-security-policy/)는 +내장된 [파드 시큐리티 어드미션 컨트롤러](/docs/concepts/security/pod-security-admission/)에 의해 대체되어 사용이 중단되었다. + + +### 샌드박스 파드는 어떠한가? + +현재로서는, 파드가 샌드박스 특성을 가지는지 제어할 수 있는 API 표준이 존재하지 않는다. +샌드박스 파드는 샌드박스 런타임(예를 들면, gVisor 혹은 Kata 컨테이너)을 통해 식별할 수 있지만, +샌드박스 런타임이 무엇인지에 대한 표준 정의는 없는 상태이다. + +샌드박스 워크로드가 필요로하는 보호물은 다른 워크로드와 다를 수 있다. +예를 들어, 내재된 커널과 분리된 워크로드에서는 제한된 특수 권한의 필요성이 적어진다. +이는 높아진 권한을 요구하는 워크로드가 분리될 수 있도록 허용한다. + +추가적으로, 샌드박스 방식에 따라 샌드박스 워크로드에 대한 보호가 달라진다. +이와 같은 경우에는, 하나의 프로필만을 모든 샌드박스 워크로드에 대해 권장할 수 없다. diff --git a/content/ko/examples/security/kind-with-cluster-level-baseline-pod-security.sh b/content/ko/examples/security/kind-with-cluster-level-baseline-pod-security.sh new file mode 100644 index 0000000000..3a0e2acf48 --- /dev/null +++ b/content/ko/examples/security/kind-with-cluster-level-baseline-pod-security.sh @@ -0,0 +1,70 @@ +#!/bin/sh +mkdir -p /tmp/pss +cat < /tmp/pss/cluster-level-pss.yaml +apiVersion: apiserver.config.k8s.io/v1 +kind: AdmissionConfiguration +plugins: +- name: PodSecurity + configuration: + apiVersion: pod-security.admission.config.k8s.io/v1beta1 + kind: PodSecurityConfiguration + defaults: + enforce: "baseline" + enforce-version: "latest" + audit: "restricted" + audit-version: "latest" + warn: "restricted" + warn-version: "latest" + exemptions: + usernames: [] + runtimeClasses: [] + namespaces: [kube-system] +EOF +cat < /tmp/pss/cluster-config.yaml +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: +- role: control-plane + kubeadmConfigPatches: + - | + kind: ClusterConfiguration + apiServer: + extraArgs: + admission-control-config-file: /etc/config/cluster-level-pss.yaml + extraVolumes: + - name: accf + hostPath: /etc/config + mountPath: /etc/config + readOnly: false + pathType: "DirectoryOrCreate" + extraMounts: + - hostPath: /tmp/pss + containerPath: /etc/config + # optional: if set, the mount is read-only. + # default false + readOnly: false + # optional: if set, the mount needs SELinux relabeling. + # default false + selinuxRelabel: false + # optional: set propagation mode (None, HostToContainer or Bidirectional) + # see https://kubernetes.io/docs/concepts/storage/volumes/#mount-propagation + # default None + propagation: None +EOF +kind create cluster --name psa-with-cluster-pss --image kindest/node:v1.23.0 --config /tmp/pss/cluster-config.yaml +kubectl cluster-info --context kind-psa-with-cluster-pss +# (임의의) 서비스 어카운트 어드미션 컨트롤러가 사용 가능할 때까지 15초 간 대기 +sleep 15 +cat < /tmp/pss/nginx-pod.yaml +apiVersion: v1 +kind: Pod +metadata: + name: nginx +spec: + containers: + - image: nginx + name: nginx + ports: + - containerPort: 80 +EOF +kubectl apply -f /tmp/pss/nginx-pod.yaml diff --git a/content/ko/examples/security/kind-with-namespace-level-baseline-pod-security.sh b/content/ko/examples/security/kind-with-namespace-level-baseline-pod-security.sh new file mode 100644 index 0000000000..11ce4acc8c --- /dev/null +++ b/content/ko/examples/security/kind-with-namespace-level-baseline-pod-security.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# v1.23 출시 전까지, 노드 이미지 종류는 k/k 마스터 브랜치로부터 빌드 되어야 한다 +# Ref: https://kind.sigs.k8s.io/docs/user/quick-start/#building-images +kind create cluster --name psa-ns-level --image kindest/node:v1.23.0 +kubectl cluster-info --context kind-psa-ns-level +# (임의의) 서비스 어카운트 어드미션 컨트롤러가 사용 가능할 때까지 15초 간 대기 +sleep 15 +kubectl create ns example +kubectl label --overwrite ns example \ + pod-security.kubernetes.io/enforce=baseline \ + pod-security.kubernetes.io/enforce-version=latest \ + pod-security.kubernetes.io/warn=restricted \ + pod-security.kubernetes.io/warn-version=latest \ + pod-security.kubernetes.io/audit=restricted \ + pod-security.kubernetes.io/audit-version=latest +cat < /tmp/pss/nginx-pod.yaml +apiVersion: v1 +kind: Pod +metadata: + name: nginx +spec: + containers: + - image: nginx + name: nginx + ports: + - containerPort: 80 +EOF +kubectl apply -n example -f /tmp/pss/nginx-pod.yaml diff --git a/content/ko/examples/security/podsecurity-baseline.yaml b/content/ko/examples/security/podsecurity-baseline.yaml new file mode 100644 index 0000000000..6251af5d2f --- /dev/null +++ b/content/ko/examples/security/podsecurity-baseline.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: my-baseline-namespace + labels: + pod-security.kubernetes.io/enforce: baseline + pod-security.kubernetes.io/enforce-version: latest + pod-security.kubernetes.io/warn: baseline + pod-security.kubernetes.io/warn-version: latest \ No newline at end of file diff --git a/content/ko/examples/security/podsecurity-privileged.yaml b/content/ko/examples/security/podsecurity-privileged.yaml new file mode 100644 index 0000000000..12471cce28 --- /dev/null +++ b/content/ko/examples/security/podsecurity-privileged.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: my-privileged-namespace + labels: + pod-security.kubernetes.io/enforce: privileged + pod-security.kubernetes.io/enforce-version: latest \ No newline at end of file diff --git a/content/ko/examples/security/podsecurity-restricted.yaml b/content/ko/examples/security/podsecurity-restricted.yaml new file mode 100644 index 0000000000..8b9c30886d --- /dev/null +++ b/content/ko/examples/security/podsecurity-restricted.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: my-restricted-namespace + labels: + pod-security.kubernetes.io/enforce: restricted + pod-security.kubernetes.io/enforce-version: latest + pod-security.kubernetes.io/warn: restricted + pod-security.kubernetes.io/warn-version: latest \ No newline at end of file