1
1
---
2
- title : Apply Pod Security Standards at the Cluster Level
2
+ title : クラスターレベルでのPodセキュリティの標準の適用
3
3
content_type : tutorial
4
4
weight : 10
5
5
---
6
6
7
7
{{% alert title="Note" %}}
8
- This tutorial applies only for new clusters.
8
+ このチュートリアルは、新しいクラスターにのみ適用されます。
9
9
{{% /alert %}}
10
10
11
- Pod Security admission (PSA) is enabled by default in v1.23 and later, as it has
12
- [ graduated to beta] ( /blog/2021/12/09/pod-security-admission-beta/ ) .
13
- Pod Security
14
- is an admission controller that carries out checks against the Kubernetes
15
- [ Pod Security Standards] ( /docs/concepts/security/pod-security-standards/ ) when new pods are
16
- created. This tutorial shows you how to enforce the ` baseline ` Pod Security
17
- Standard at the cluster level which applies a standard configuration
18
- to all namespaces in a cluster.
11
+ Podセキュリティアドミッション(PSA)は、[ ベータへ進み] ( /blog/2021/12/09/pod-security-admission-beta/ ) 、v1.23以降でデフォルトで有効になっています。
12
+ Podセキュリティアドミッションは、Podが作成される際に、[ Podセキュリティの標準] ( /ja/docs/concepts/security/pod-security-standards/ ) の適用の認可を制御するものです。
13
+ このチュートリアルでは、クラスター内の全ての名前空間に標準設定を適用することで、クラスターレベルで` baseline ` Podセキュリティの標準を強制する方法を示します。
19
14
20
- To apply Pod Security Standards to specific namespaces, refer to
21
- [ Apply Pod Security Standards at the namespace level] ( /docs/tutorials/security/ns-level-pss ) .
15
+ Podセキュリティの標準を特定の名前空間に適用するには、[ 名前空間レベルでのPodセキュリティの標準の適用] ( /ja/docs/tutorials/security/ns-level-pss/ ) を参照してください。
22
16
23
- If you are running a version of Kubernetes other than v{{< skew currentVersion >}},
24
- check the documentation for that version.
17
+ v{{< skew currentVersion >}}以外のKubernetesバージョンを実行している場合は、そのバージョンのドキュメントを確認してください。
25
18
26
19
## {{% heading "prerequisites" %}}
27
20
28
- Install the following on your workstation :
21
+ ワークステーションに以下をインストールしてください :
29
22
30
23
- [ KinD] ( https://kind.sigs.k8s.io/docs/user/quick-start/#installation )
31
- - [ kubectl] ( /docs/tasks/tools/ )
24
+ - [ kubectl] ( /ja/ docs/tasks/tools/ )
32
25
33
- This tutorial demonstrates what you can configure for a Kubernetes cluster that you fully
34
- control. If you are learning how to configure Pod Security Admission for a managed cluster
35
- where you are not able to configure the control plane, read
36
- [ Apply Pod Security Standards at the namespace level] ( /docs/tutorials/security/ns-level-pss ) .
26
+ このチュートリアルでは、完全な制御下にあるKubernetesクラスターの何を設定できるかをデモンストレーションします。
37
27
38
- ## Choose the right Pod Security Standard to apply
28
+ コントロールプレーンを設定できない管理されたクラスターのPodセキュリティアドミッションに対しての設定方法を知りたいのであれば、 [ 名前空間レベルでのPodセキュリティの標準の適用 ] ( /ja/docs/tutorials/security/ns-level-pss/ ) を参照してください。
39
29
40
- [ Pod Security Admission] ( /docs/concepts/security/pod-security-admission/ )
41
- lets you apply built-in [ Pod Security Standards] ( /docs/concepts/security/pod-security-standards/ )
42
- with the following modes: ` enforce ` , ` audit ` , and ` warn ` .
30
+ ## 適用する正しいPodセキュリティの標準の選択
43
31
44
- To gather information that helps you to choose the Pod Security Standards
45
- that are most appropriate for your configuration, do the following:
32
+ [ Podのセキュリティアドミッション] ( /ja/docs/concepts/security/pod-security-admission/ ) は、以下のモードでビルトインの[ Podセキュリティの標準] ( /ja/docs/concepts/security/pod-security-standards/ ) の適用を促します: ` enforce ` 、` audit ` 、` warn ` 。
46
33
47
- 1 . Create a cluster with no Pod Security Standards applied:
34
+
35
+ 設定に最適なPodセキュリティの標準を選択するにあたって助けになる情報を収集するために、以下を行ってください:
36
+
37
+ 1 . Podセキュリティの標準を適用していないクラスターを作成します:
48
38
49
39
``` shell
50
40
kind create cluster --name psa-wo-cluster-pss
51
41
```
52
- The output is similar to :
42
+ 出力は次のようになります :
53
43
```
54
44
Creating cluster "psa-wo-cluster-pss" ...
55
45
✓ Ensuring node image (kindest/node:v{{< skew currentVersion >}}.0) 🖼
@@ -66,12 +56,12 @@ that are most appropriate for your configuration, do the following:
66
56
Thanks for using kind! 😊
67
57
```
68
58
69
- 1 . Set the kubectl context to the new cluster :
59
+ 1 . kubectl contextを新しいクラスターにセットします :
70
60
71
61
``` shell
72
62
kubectl cluster-info --context kind-psa-wo-cluster-pss
73
63
```
74
- The output is similar to this :
64
+ 出力は次のようになります :
75
65
76
66
```
77
67
Kubernetes control plane is running at https://127.0.0.1:61350
@@ -81,12 +71,12 @@ that are most appropriate for your configuration, do the following:
81
71
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
82
72
```
83
73
84
- 1 . Get a list of namespaces in the cluster :
74
+ 1 . クラスター内の名前空間の一覧を取得します :
85
75
86
76
``` shell
87
77
kubectl get ns
88
78
```
89
- The output is similar to this :
79
+ 出力は次のようになります :
90
80
```
91
81
NAME STATUS AGE
92
82
default Active 9m30s
@@ -96,30 +86,29 @@ that are most appropriate for your configuration, do the following:
96
86
local-path-storage Active 9m26s
97
87
```
98
88
99
- 1 . Use ` --dry-run=server ` to understand what happens when different Pod Security Standards
100
- are applied:
89
+ 1 . 異なるPodセキュリティの標準が適用されたときに何が起きるかを理解するために、` -dry-run=server ` を使います:
101
90
102
- 1 . Privileged
91
+ 1 . privileged
103
92
``` shell
104
93
kubectl label --dry-run=server --overwrite ns --all \
105
94
pod-security.kubernetes.io/enforce=privileged
106
95
```
107
96
108
- The output is similar to :
97
+ 出力は次のようになります :
109
98
```
110
99
namespace/default labeled
111
100
namespace/kube-node-lease labeled
112
101
namespace/kube-public labeled
113
102
namespace/kube-system labeled
114
103
namespace/local-path-storage labeled
115
104
```
116
- 2. Baseline
105
+ 2. baseline
117
106
` ` ` shell
118
107
kubectl label --dry-run=server --overwrite ns --all \
119
108
pod-security.kubernetes.io/enforce=baseline
120
109
` ` `
121
110
122
- The output is similar to :
111
+ 出力は次のようになります :
123
112
```
124
113
namespace/default labeled
125
114
namespace/kube-node-lease labeled
@@ -132,13 +121,13 @@ that are most appropriate for your configuration, do the following:
132
121
namespace/local-path-storage labeled
133
122
```
134
123
135
- 3. Restricted
124
+ 3. restricted
136
125
` ` ` shell
137
126
kubectl label --dry-run=server --overwrite ns --all \
138
127
pod-security.kubernetes.io/enforce=restricted
139
128
` ` `
140
129
141
- The output is similar to :
130
+ 出力は次のようになります :
142
131
```
143
132
namespace/default labeled
144
133
namespace/kube-node-lease labeled
@@ -154,37 +143,27 @@ that are most appropriate for your configuration, do the following:
154
143
namespace/local-path-storage labeled
155
144
```
156
145
157
- From the previous output, you' ll notice that applying the `privileged` Pod Security Standard shows no warnings
158
- for any namespaces. However, `baseline` and `restricted` standards both have
159
- warnings, specifically in the `kube-system` namespace.
146
+ この出力から、` privileged` Podセキュリティの標準を適用すると、名前空間のどれにも警告が示されないことに気付くでしょう。
147
+ これに対し、` baseline` と` restrict` の標準ではどちらも、とりわけ` kube-system` 名前空間に対して警告が示されています。
160
148
161
- ## Set modes, versions and standards
149
+ # # モード、バージョン、標準のセット
162
150
163
- In this section, you apply the following Pod Security Standards to the `latest` version :
151
+ このセクションでは、 ` latest` バージョンに以下のPodセキュリティの標準を適用します :
164
152
165
- * `baseline` standard in `enforce` mode.
166
- * `restricted` standard in `warn` and `audit` mode.
153
+ * ` enforce ` モードで ` baseline ` 標準。
154
+ * ` awrn ` および ` audit ` モードで ` restricted ` 標準。
167
155
168
- The `baseline` Pod Security Standard provides a convenient
169
- middle ground that allows keeping the exemption list short and prevents known
170
- privilege escalations.
156
+ ` baseline` Podセキュリティの標準は、免除リストを短く保てて、かつ既知の特権昇格を防ぐような、利便性のある中庸を提供します。
171
157
172
- Additionally, to prevent pods from failing in `kube-system`, you' ll exempt the namespace
173
- from having Pod Security Standards applied.
158
+ 加えて、` kube-system` 内の失敗からPodを守るために、適用されるPodセキュリティの標準の対象から名前空間を免除します。
174
159
175
- When you implement Pod Security Admission in your own environment, consider the
176
- following:
160
+ 環境にPodセキュリティアドミッションを実装する際には、以下の点を考慮してください:
177
161
178
- 1. Based on the risk posture applied to a cluster, a stricter Pod Security
179
- Standard like ` restricted` might be a better choice.
180
- 1. Exempting the ` kube-system` namespace allows pods to run as
181
- ` privileged` in this namespace. For real world use, the Kubernetes project
182
- strongly recommends that you apply strict RBAC
183
- policies that limit access to ` kube-system` , following the principle of least
184
- privilege.
185
- To implement the preceding standards, do the following:
186
- 1. Create a configuration file that can be consumed by the Pod Security
187
- Admission Controller to implement these Pod Security Standards:
162
+ 1. クラスターに適用されるリスク状況に基づくと、` restricted` のようにより厳格なPodセキュリティの標準のほうが、より良い選択肢かもしれません。
163
+ 1. ` kube-ssytem` 名前空間の免除は、Podがその名前空間で` privileged` として実行するのを許容することになります。
164
+ 実世界で使うにあたっては、以下の最小権限の原則に従って` kube-system` へのアクセスを制限する厳格なRBACポリシーを適用することを、Kubernetesプロジェクトは強く推奨します。
165
+ 上記の標準を実装するには、次のようにします:
166
+ 1. 目的のPodセキュリティの標準を実装するために、Podセキュリティアドミッションコントローラーで利用可能な設定ファイルを作成します:
188
167
189
168
```
190
169
mkdir -p /tmp/pss
@@ -211,13 +190,13 @@ following:
211
190
```
212
191
213
192
{{< note >}}
214
- `pod-security.admission.config.k8s.io/v1` configuration requires v1 .25+.
215
- For v1.23 and v1.24, use [v1beta1](https://v1-24.docs.kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-admission-controller/).
216
- For v1.22, use [v1alpha1](https://v1-22.docs.kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-admission-controller/).
193
+ `pod-security.admission.config.k8s.io/v1`設定はv1 .25+での対応です。
194
+ v1.23とv1.24では [v1beta1](https://v1-24.docs.kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-admission-controller/)を使用してください。
195
+ v1.22では [v1alpha1](https://v1-22.docs.kubernetes.io/docs/tasks/configure-pod-container/enforce-standards-admission-controller/)を使用してください。
217
196
{{< /note >}}
218
197
219
198
220
- 1. Configure the API server to consume this file during cluster creation :
199
+ 1. クラスターの作成中にこのファイルを取り込むAPIサーバーを設定します :
221
200
222
201
```
223
202
cat <<EOF > /tmp/pss/cluster-config.yaml
@@ -254,18 +233,15 @@ following:
254
233
```
255
234
256
235
{{<note>}}
257
- If you use Docker Desktop with KinD on macOS, you can
258
- add `/tmp` as a Shared Directory under the menu item
259
- **Preferences > Resources > File Sharing**.
236
+ macOSでDocker DesktopとKinDを利用している場合は、**Preferences > Resources > File Sharing**のメニュー項目からShared Directoryとして`/tmp`を追加できます。
260
237
{{</note>}}
261
238
262
- 1. Create a cluster that uses Pod Security Admission to apply
263
- these Pod Security Standards:
239
+ 1. 目的のPodセキュリティの標準を適用するために、Podセキュリティアドミッションを使うクラスターを作成します:
264
240
265
241
```shell
266
242
kind create cluster --name psa-with-cluster-pss --config /tmp/pss/cluster-config.yaml
267
243
```
268
- The output is similar to this :
244
+ 出力は次のようになります :
269
245
```
270
246
Creating cluster "psa-with-cluster-pss" ...
271
247
✓ Ensuring node image (kindest/node:v{{< skew currentVersion >}}.0) 🖼
@@ -282,33 +258,33 @@ following:
282
258
Have a question, bug, or feature request? Let us know! https://kind.sigs.k8s.io/#community 🙂
283
259
```
284
260
285
- 1 . Point kubectl to the cluster :
261
+ 1 . kubectlをクラスターに向けます :
286
262
``` shell
287
263
kubectl cluster-info --context kind-psa-with-cluster-pss
288
264
```
289
- The output is similar to this :
265
+ 出力は次のようになります :
290
266
```
291
267
Kubernetes control plane is running at https://127.0.0.1:63855
292
268
CoreDNS is running at https://127.0.0.1:63855/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
293
269
294
270
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
295
271
```
296
272
297
- 1 . Create a Pod in the default namespace :
273
+ 1 . デフォルトの名前空間にPodを作成します :
298
274
299
275
``` shell
300
276
kubectl apply -f https://k8s.io/examples/security/example-baseline-pod.yaml
301
277
```
302
278
303
- The pod is started normally, but the output includes a warning :
279
+ Podは正常に開始されますが、出力には警告が含まれます :
304
280
```
305
281
Warning: would violate PodSecurity "restricted:latest": allowPrivilegeEscalation != false (container "nginx" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "nginx" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "nginx" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "nginx" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")
306
282
pod/nginx created
307
283
```
308
284
309
- ## Clean up
285
+ ## 後片付け
310
286
311
- Now delete the clusters which you created above by running the following command :
287
+ では、上記で作成したクラスターを、以下のコマンドを実行して削除します :
312
288
313
289
``` shell
314
290
kind delete cluster --name psa-with-cluster-pss
@@ -319,15 +295,13 @@ kind delete cluster --name psa-wo-cluster-pss
319
295
320
296
## {{% heading "whatsnext" %}}
321
297
322
- - Run a
323
- [ shell script] ( /examples/security/kind-with-cluster-level-baseline-pod-security.sh )
324
- to perform all the preceding steps at once:
325
- 1 . Create a Pod Security Standards based cluster level Configuration
326
- 2 . Create a file to let API server consume this configuration
327
- 3 . Create a cluster that creates an API server with this configuration
328
- 4 . Set kubectl context to this new cluster
329
- 5 . Create a minimal pod yaml file
330
- 6 . Apply this file to create a Pod in the new cluster
331
- - [ Pod Security Admission] ( /docs/concepts/security/pod-security-admission/ )
332
- - [ Pod Security Standards] ( /docs/concepts/security/pod-security-standards/ )
333
- - [ Apply Pod Security Standards at the namespace level] ( /docs/tutorials/security/ns-level-pss/ )
298
+ - 前出の一連の手順を一度に全て行うために[ シェルスクリプト] ( /examples/security/kind-with-cluster-level-baseline-pod-security.sh ) を実行します:
299
+ 1 . クラスターレベルの設定に基づきPodセキュリティの標準を作成します。
300
+ 2 . APIサーバーでこの設定を取り込むようにファイルを作成します。
301
+ 3 . この設定のAPIサーバーを立てるクラスターを作成します。
302
+ 4 . この新しいクラスターにkubectl contextをセットします。
303
+ 5 . 最小限のPod YAMLファイルを作成します。
304
+ 6 . 新しいクラスター内でPodを作成するために、このファイルを適用します。
305
+ - [ Podのセキュリティアドミッション] ( /ja/docs/concepts/security/pod-security-admission/ )
306
+ - [ Podセキュリティの標準] ( /ja/docs/concepts/security/pod-security-standards/ )
307
+ - [ 名前空間レベルでのPodセキュリティの標準の適用] ( /docs/tutorials/security/ns-level-pss/ )
0 commit comments