From cf858d854fe68c4f6afad23d21b69bef3fbdafdb Mon Sep 17 00:00:00 2001 From: Riita <42636694+riita10069@users.noreply.github.com> Date: Wed, 20 Oct 2021 19:17:34 +0900 Subject: [PATCH 0001/1077] Update nodes.md --- .../ja/docs/concepts/architecture/nodes.md | 131 +++++++++++++----- 1 file changed, 97 insertions(+), 34 deletions(-) diff --git a/content/ja/docs/concepts/architecture/nodes.md b/content/ja/docs/concepts/architecture/nodes.md index bf5fa1acb9..ec52ee7b1b 100644 --- a/content/ja/docs/concepts/architecture/nodes.md +++ b/content/ja/docs/concepts/architecture/nodes.md @@ -137,7 +137,7 @@ kubectl describe node <ノード名をここに挿入> `SchedulingDisabled`はKubernetesのAPIにおけるConditionではありません;その代わり、cordonされたノードはUnschedulableとしてマークされます。 {{< /note >}} -ノードのConditionはJSONオブジェクトで表現されます。例えば、正常なノードの場合は以下のような構造体が表示されます。 +Nodeの状態は、Nodeリソースの`.status`の一部として表現されます。例えば、正常なノードの場合は以下のようなjson構造が表示されます。 ```json "conditions": [ @@ -173,36 +173,25 @@ CapacityとAllocatableについて深く知りたい場合は、ノード上で ### Info {#info} カーネルのバージョン、Kubernetesのバージョン(kubeletおよびkube-proxyのバージョン)、(使用されている場合)Dockerのバージョン、OS名など、ノードに関する一般的な情報です。 -この情報はノードからkubeletを通じて取得されます。 +この情報はノードからkubeletを通じて取得され、Kubernetes APIに公開されます。 -## 管理 {#management} -[Pod](/ja/docs/concepts/workloads/pods/pod/)や[Service](/ja/docs/concepts/services-networking/service/)と違い、ノードは本質的にはKubernetesによって作成されません。GCPのようなクラウドプロバイダーによって外的に作成されるか、VMや物理マシンのプールに存在するものです。そのため、Kubernetesがノードを作成すると、そのノードを表すオブジェクトが作成されます。作成後、Kubernetesはそのノードが有効かどうかを確認します。 たとえば、次の内容からノードを作成しようとしたとします: +## ハートビート +ハートビートは、Kubernetesノードから送信され、ノードが利用可能か判断するのに役立ちます。 +以下の2つのハートビートがあります: +* ノードの`.status`の更新 +* [Lease object](/docs/reference/generated/kubernetes-api/{{< latest-version >}}#lease-v1-coordination-k8s-io)です。 +各ノードは`kube-node-lease`という{{< glossary_tooltip term_id="namespace" text="namespace">}}に関連したLeaseオブジェクトを持ちます。 +Leaseは軽量なリソースで、クラスターのスケールに応じてノードのハートビートにおけるパフォーマンスを改善します。 -```json -{ - "kind": "Node", - "apiVersion": "v1", - "metadata": { - "name": "10.240.79.157", - "labels": { - "name": "my-first-k8s-node" - } - } -} -``` +kubeletが`NodeStatus`とLeaseオブジェクトの作成および更新を担当します。 -Kubernetesは内部的にNodeオブジェクトを作成し、 `metadata.name`フィールドに基づくヘルスチェックによってノードを検証します。ノードが有効な場合、つまり必要なサービスがすべて実行されている場合は、Podを実行する資格があります。それ以外の場合、該当ノードが有効になるまではいかなるクラスターの活動に対しても無視されます。 -Nodeオブジェクトの名前は有効な[DNSサブドメイン名](/ja/docs/concepts/overview/working-with-objects/names#dns-subdomain-names)である必要があります。 +- kubeletは、ステータスに変化があったり、設定した間隔の間に更新がない時に`NodeStatus`を更新します。`NodeStatus`更新のデフォルト間隔は5分です。(到達不能の場合のデフォルトタイムアウトである40秒よりもはるかに長いです) +- kubeletは10秒間隔(デフォルトの更新間隔)でLeaseオブジェクトの生成と更新を実施します。Leaseの更新は`NodeStatus`の更新とは独立されて行われます。Leaseの更新が失敗した場合、kubeletは200ミリ秒から始まり7秒を上限とした指数バックオフでリトライします。 -{{< note >}} -Kubernetesは無効なノードのためにオブジェクトを保存し、それをチェックし続けます。 -このプロセスを停止するには、Nodeオブジェクトを明示的に削除する必要があります。 -{{< /note >}} -現在、Kubernetesのノードインターフェースと相互作用する3つのコンポーネントがあります。ノードコントローラー、kubelet、およびkubectlです。 -### ノードコントローラー +## ノードコントローラー ノード{{< glossary_tooltip text="コントローラー" term_id="controller" >}}は、ノードのさまざまな側面を管理するKubernetesのコントロールプレーンコンポーネントです。 @@ -216,16 +205,6 @@ Kubernetesは無効なノードのためにオブジェクトを保存し、そ ノードが到達不能(例えば、ノードがダウンしているなどので理由で、ノードコントローラーがハートビートの受信を停止した場合)になると、ノードコントローラーは、NodeStatusのNodeReady conditionをConditionUnknownに変更する役割があります。その後も該当ノードが到達不能のままであった場合、Graceful Terminationを使って全てのPodを退役させます。デフォルトのタイムアウトは、ConditionUnknownの報告を開始するまで40秒、その後Podの追い出しを開始するまで5分に設定されています。 ノードコントローラーは、`--node-monitor-period`に設定された秒数ごとに各ノードの状態をチェックします。 -#### ハートビート -ハートビートは、Kubernetesノードから送信され、ノードが利用可能か判断するのに役立ちます。 -2つのハートビートがあります:`NodeStatus`の更新と[Lease object](/docs/reference/generated/kubernetes-api/{{< latest-version >}}#lease-v1-coordination-k8s-io)です。 -各ノードは`kube-node-lease`という{{< glossary_tooltip term_id="namespace" text="namespace">}}に関連したLeaseオブジェクトを持ちます。 -Leaseは軽量なリソースで、クラスターのスケールに応じてノードのハートビートにおけるパフォーマンスを改善します。 - -kubeletが`NodeStatus`とLeaseオブジェクトの作成および更新を担当します。 - -- kubeletは、ステータスに変化があったり、設定した間隔の間に更新がない時に`NodeStatus`を更新します。`NodeStatus`更新のデフォルト間隔は5分です。(到達不能の場合のデフォルトタイムアウトである40秒よりもはるかに長いです) -- kubeletは10秒間隔(デフォルトの更新間隔)でLeaseオブジェクトの生成と更新を実施します。Leaseの更新は`NodeStatus`の更新とは独立されて行われます。Leaseの更新が失敗した場合、kubeletは200ミリ秒から始まり7秒を上限とした指数バックオフでリトライします。 #### 信頼性 @@ -269,6 +248,90 @@ Pod以外のプロセス用にリソースを明示的に予約したい場合 kubeletはリソースの割当を決定する際にトポロジーのヒントを利用できます。 詳細は、[ノードのトポロジー管理ポリシーを制御する](/docs/tasks/administer-cluster/topology-manager/)を参照してください。 +## Graceful node shutdown {#graceful-node-shutdown} + +{{< feature-state state="beta" for_k8s_version="v1.21" >}} + +kubeletは、ノードのシステムシャットダウンを検出すると、ノード上で動作しているポッドを終了させます。 + +Kubelet は、ノードのシャットダウン時に、ポッドが通常の[通常のポッド終了プロセス](/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination)に従うようにします。 + +Graceful node shutdownはsystemdに依存しているため、[systemd inhibitor locks](https://www.freedesktop.org/wiki/Software/systemd/inhibit/)を +利用してノードのシャットダウンを一定時間遅らせることができます。 + +Graceful node shutdownは、v1.21でデフォルトで有効になっている`GracefulNodeShutdown` [feature gate](/ja/docs/reference/command-line-tools-reference/feature-gates/)で制御されます。 + +なお、デフォルトでは、後述の設定オプション`ShutdownGracePeriod`および`ShutdownGracePeriodCriticalPods`の両方がゼロに設定されているため、Graceful node shutdownは有効になりません。この機能を有効にするには、この2つのkubeletの設定を適切に設定し、ゼロ以外の値を設定する必要があります。 + +Graceful shutdownには, kubeletは以下の2段階でPodを終了させます。 + +1. そのノード上で動作している通常のPodを終了させます。 +2. そのノード上で動作している[critical pods](/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical)を終了させます。 + +Graceful node shutdownには、2つの[`KubeletConfiguration`](/docs/tasks/administer-cluster/kubelet-config-file/)オプションを設定します。: +* `ShutdownGracePeriod`: + * ノードがシャットダウンを遅らせるべき合計期間を指定します。これは、通常のPodと[critical pods](/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical)の両方のPod終了の合計猶予期間です。 +* `ShutdownGracePeriodCriticalPods`: + * ノードのシャットダウン時に[critical pods](/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical)を終了させるために使用する期間を指定します。この値は、ShutdownGracePeriodよりも小さくする必要があります。 + +例えば、`ShutdownGracePeriod=30s`、`ShutdownGracePeriodCriticalPods=10s`とすると、 +kubeletはノードのシャットダウンを30秒遅らせます。シャットダウンの間、最初の20(30-10)秒は通常のポッドを優雅に終了させるために確保され、 +残りの10秒は重要なポッドを終了させるために確保されることになります。 + +{{< note >}} +Graceful node shutdown中にPodが退避された場合、それらのPodの`.status`は`Failed`になります。 +`kubectl get pods`を実行すると、退避させられたPodのステータスが `Shutdown` と表示されます。 +また、`kubectl describe pod`を実行すると、ノードのシャットダウンのためにPodが退避されたことがわかります。 + +``` +Status: Failed +Reason: Shutdown +Message: Node is shutting, evicting pods +``` + +失敗したポッドオブジェクトは、明示的に削除されるか、[GCによってクリーンアップ](/docs/concepts/workloads/pods/pod-lifecycle/#pod-garbage-collection)されるまで保存されます。 +これは、ノードが突然終了した場合とは異なった振る舞いです。 + +{{< /note >}} + +## Swap memory management {#swap-memory} + +{{< feature-state state="alpha" for_k8s_version="v1.22" >}} + +Kubernetes 1.22以前では、ノードはスワップメモリの使用をサポートしておらず、ノード上でスワップが検出された場合、 +kubeletはデフォルトで起動に失敗していました。1.22以降では、スワップメモリのサポートをノードごとに有効にすることができます。 + + + +ノードでスワップを有効にするには、kubelet の `NodeSwap` [フィーチャーゲート](/ja/docs/reference/command-line-tools-reference/feature-gates/)を有効にし、 +`--fail-swap-on`コマンドラインフラグまたは`failSwapOn`[KubeletConfiguration](/docs/reference/config-api/kubelet-config.v1beta1/#kubelet-config-k8s-io-v1beta1-KubeletConfiguration)を false に設定する必要があります。 + + +ユーザーはオプションで、ノードがスワップメモリをどのように使用するかを指定するために、`memorySwap.swapBehavior`を設定することもできます。ノードがスワップメモリをどのように使用するかを指定します。例えば、以下のようになります。 + +```yaml +memorySwap: + swapBehavior: LimitedSwap +``` + +swapBehaviorで使用できる設定オプションは以下の通りです。: +- `LimitedSwap`: Kubernetesのワークロードが、使用できるスワップ量に制限を設けます。Kubernetesが管理していないノード上のワークロードは、依然としてスワップを使用できます。 +- `UnlimitedSwap`: Kubernetesのワークロードが使用できるスワップ量に制限を設けません。システムの限界まで、要求されただけのスワップメモリを使用することができます。 + +`memorySwap`の設定が指定されておらず、[フィーチャーゲート](/ja/docs/reference/command-line-tools-reference/feature-gates/)が有効な場合、 +デフォルトのkubeletは`LimitedSwap`の設定と同じ動作を適用します。 + +LimitedSwap`設定の動作は、ノードがコントロールグループ(「cgroups」とも呼ばれる)のv1とv2のどちらで動作しているかによって異なります。 + +Kubernetesのワークロードでは、メモリとスワップを組み合わせて使用することができ、ポッドのメモリ制限が設定されている場合はその制限まで使用できます。 +- **cgroupsv1:** Kubernetesのワークロードは、メモリとスワップを組み合わせて使用することができ、ポッドのメモリ制限が設定されている場合はその制限まで使用できます。 +- **cgroupsv2:** Kubernetesのワークロードは、スワップメモリを使用できません。 + +詳しくは、[KEP-2400](https://github.com/kubernetes/enhancements/issues/2400)と +[design proposal](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/2400-node-swap/README.md) +をご覧いただき、テストにご協力、ご意見をお聞かせください。 + + ## {{% heading "whatsnext" %}} * [ノードコンポーネント](/ja/docs/concepts/overview/components/#node-components)について学習する。 From 2fdb8e2c1753e9bb102eb48c0c11c3848be5984e Mon Sep 17 00:00:00 2001 From: Riita <42636694+riita10069@users.noreply.github.com> Date: Wed, 20 Oct 2021 23:10:30 +0900 Subject: [PATCH 0002/1077] Update pod-security-standards.md --- .../security/pod-security-standards.md | 163 +++++++++++++++--- 1 file changed, 138 insertions(+), 25 deletions(-) diff --git a/content/ja/docs/concepts/security/pod-security-standards.md b/content/ja/docs/concepts/security/pod-security-standards.md index 7b0f16dff1..dd3f91e79f 100644 --- a/content/ja/docs/concepts/security/pod-security-standards.md +++ b/content/ja/docs/concepts/security/pod-security-standards.md @@ -49,6 +49,25 @@ _Pod Security Policy_ はクラスターレベルのリソースで、Pod定義 項目 ポリシー + + ホストのプロセス + +

Windows ポッドは、Windows ノードへの特権的なアクセスを可能にするHostProcessコンテナを実行する機能を提供します。ベースラインポリシーでは、ホストへの特権的なアクセスは禁止されています。HostProcessポッドは、Kubernetes v1.22時点ではアルファ版の機能です。 + ホストのネームスペースの共有は無効化すべきです。

+

制限されるフィールド

+ +

認められる値

+ + + ホストのネームスペース @@ -57,7 +76,7 @@ _Pod Security Policy_ はクラスターレベルのリソースで、Pod定義 spec.hostNetwork
spec.hostPID
spec.hostIPC
-
認められる値: false
+
認められる値: false, Undefined/nil
@@ -67,6 +86,7 @@ _Pod Security Policy_ はクラスターレベルのリソースで、Pod定義
制限されるフィールド:
spec.containers[*].securityContext.privileged
spec.initContainers[*].securityContext.privileged
+ spec.ephemeralContainers[*].securityContext.privileged

認められる値: false, undefined/nil
@@ -77,7 +97,22 @@ _Pod Security Policy_ はクラスターレベルのリソースで、Pod定義
制限されるフィールド:
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
@@ -96,6 +131,7 @@ _Pod Security Policy_ はクラスターレベルのリソースで、Pod定義
制限されるフィールド:
spec.containers[*].ports[*].hostPort
spec.initContainers[*].ports[*].hostPort
+ spec.ephemeralContainers[*].ports[*].hostPort

認められる値: 0, undefined (または既知のリストに限定)
@@ -105,7 +141,7 @@ _Pod Security Policy_ はクラスターレベルのリソースで、Pod定義 サポートされるホストでは、AppArmorの'runtime/default'プロファイルがデフォルトで適用されます。デフォルトのポリシーはポリシーの上書きや無効化を防ぎ、許可されたポリシーのセットを上書きできないよう制限すべきです。

制限されるフィールド:
metadata.annotations['container.apparmor.security.beta.kubernetes.io/*']
-
認められる値: 'runtime/default', undefined
+
認められる値: 'runtime/default', undefined, localhost/*
@@ -116,7 +152,24 @@ _Pod Security Policy_ はクラスターレベルのリソースで、Pod定義 spec.securityContext.seLinuxOptions
spec.containers[*].securityContext.seLinuxOptions
spec.initContainers[*].securityContext.seLinuxOptions
+ spec.ephemeralContainers[*].securityContext.seLinuxOptions.type

認められる値: undefined/nil
+ 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/nil
+ Undefined/"" @@ -126,9 +179,29 @@ _Pod Security Policy_ はクラスターレベルのリソースで、Pod定義
制限されるフィールド:
spec.containers[*].securityContext.procMount
spec.initContainers[*].securityContext.procMount
+ spec.ephemeralContainers[*].securityContext.procMount

認められる値: undefined/nil, 'Default'
+ + Seccomp + +

Seccompプロファイルを明示的にUnconfinedに設定することはできません。

+

Restricted Fields

+ +

Allowed Values

+ + + Sysctl @@ -169,27 +242,27 @@ _Pod Security Policy_ はクラスターレベルのリソースで、Pod定義 HostPathボリュームの制限に加え、制限プロファイルではコアでない種類のボリュームの利用をPersistentVolumeにより定義されたものに限定します。

制限されるフィールド:
- spec.volumes[*].hostPath
- spec.volumes[*].gcePersistentDisk
- spec.volumes[*].awsElasticBlockStore
- spec.volumes[*].gitRepo
- spec.volumes[*].nfs
- spec.volumes[*].iscsi
- spec.volumes[*].glusterfs
- spec.volumes[*].rbd
- spec.volumes[*].flexVolume
- spec.volumes[*].cinder
- spec.volumes[*].cephFS
- spec.volumes[*].flocker
- spec.volumes[*].fc
- spec.volumes[*].azureFile
- spec.volumes[*].vsphereVolume
- spec.volumes[*].quobyte
- spec.volumes[*].azureDisk
- spec.volumes[*].portworxVolume
- spec.volumes[*].scaleIO
- spec.volumes[*].storageos
- spec.volumes[*].csi
+ spec.volumes[*].hostPath
+ spec.volumes[*].gcePersistentDisk
+ spec.volumes[*].awsElasticBlockStore
+ spec.volumes[*].gitRepo
+ spec.volumes[*].nfs
+ spec.volumes[*].iscsi
+ spec.volumes[*].glusterfs
+ spec.volumes[*].rbd
+ spec.volumes[*].flexVolume
+ spec.volumes[*].cinder
+ spec.volumes[*].cephfs
+ spec.volumes[*].flocker
+ spec.volumes[*].fc
+ spec.volumes[*].azureFile
+ spec.volumes[*].vsphereVolume
+ spec.volumes[*].quobyte
+ spec.volumes[*].azureDisk
+ spec.volumes[*].portworxVolume
+ spec.volumes[*].scaleIO
+ spec.volumes[*].storageos
+ spec.volumes[*].photonPersistentDisk

認められる値: undefined/nil
@@ -200,6 +273,7 @@ _Pod Security Policy_ はクラスターレベルのリソースで、Pod定義
制限されるフィールド:
spec.containers[*].securityContext.allowPrivilegeEscalation
spec.initContainers[*].securityContext.allowPrivilegeEscalation
+ spec.ephemeralContainers[*].securityContext.allowPrivilegeEscalation

認められる値: false
@@ -211,6 +285,7 @@ _Pod Security Policy_ はクラスターレベルのリソースで、Pod定義 spec.securityContext.runAsNonRoot
spec.containers[*].securityContext.runAsNonRoot
spec.initContainers[*].securityContext.runAsNonRoot
+ spec.ephemeralContainers[*].securityContext.runAsNonRoot

認められる値: true
@@ -242,6 +317,36 @@ _Pod Security Policy_ はクラスターレベルのリソースで、Pod定義 undefined / nil
+ + Capabilities (v1.22+) + +

+ コンテナはすべてのケイパビリティを削除する必要があり、NET_BIND_SERVICEケイパビリティを追加することだけが許可されています。 +

+

Restricted Fields

+ +

Allowed Values

+ +
+

Restricted Fields

+ +

Allowed Values

+ + + @@ -281,9 +386,17 @@ Gatekeeper](https://github.com/open-policy-agent/gatekeeper)があります。 ### WindowsのPodにはどのプロファイルを適用すればよいですか? Kubernetesでは、Linuxベースのワークロードと比べてWindowsの使用は制限や差異があります。 -特に、PodのSecurityContextフィールドは[Windows環境では効果がありません](/docs/setup/production-environment/windows/intro-windows-in-kubernetes/#v1-podsecuritycontext)。 +特に、PodのSecurityContextフィールドは[Windows環境では効果がありません](/ja/docs/setup/production-environment/windows/intro-windows-in-kubernetes/#v1-podsecuritycontext)。 したがって、現段階では標準化されたセキュリティポリシーは存在しません。 +Windows Podに制限付きプロファイルを適用すると、実行時にPodに影響が出る場合があります。 +制限付きプロファイルでは、Linux 固有の制限 (seccomp プロファイルや特権昇格の不許可など) を適用する必要があります。 +kubelet および/またはそのコンテナランタイムがこれらの Linux 固有の値を無視した場合、Windows Podは制限付きプロファイル内で正常に動作します。 +ただし、強制力がないため、Windows コンテナを使用するPodについては、ベースラインプロファイルと比較して追加の制限はありません。 + +HostProcess Podを作成するための HostProcess フラグの使用は、特権的なポリシーに沿ってのみ行われるべきです。 +Windows HostProcess Podの作成は、ベースラインおよび制限されたポリシーの下でブロックされているため、いかなる HostProcess Podも特権的であるとみなされるべきです。 + ### サンドボックス化されたPodはどのように扱えばよいでしょうか? 現在のところ、Podがサンドボックス化されていると見なされるかどうかを制御できるAPI標準はありません。 From 79a6b1972ff56469407e476e3b7955b7931fb3e8 Mon Sep 17 00:00:00 2001 From: Riita <42636694+riita10069@users.noreply.github.com> Date: Sat, 30 Oct 2021 00:29:55 +0900 Subject: [PATCH 0003/1077] Update nodes.md --- content/ja/docs/concepts/architecture/nodes.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content/ja/docs/concepts/architecture/nodes.md b/content/ja/docs/concepts/architecture/nodes.md index ec52ee7b1b..e1dcea5be5 100644 --- a/content/ja/docs/concepts/architecture/nodes.md +++ b/content/ja/docs/concepts/architecture/nodes.md @@ -248,7 +248,7 @@ Pod以外のプロセス用にリソースを明示的に予約したい場合 kubeletはリソースの割当を決定する際にトポロジーのヒントを利用できます。 詳細は、[ノードのトポロジー管理ポリシーを制御する](/docs/tasks/administer-cluster/topology-manager/)を参照してください。 -## Graceful node shutdown {#graceful-node-shutdown} +## Graceful Node Shutdown {#graceful-node-shutdown} {{< feature-state state="beta" for_k8s_version="v1.21" >}} @@ -256,10 +256,10 @@ kubeletは、ノードのシステムシャットダウンを検出すると、 Kubelet は、ノードのシャットダウン時に、ポッドが通常の[通常のポッド終了プロセス](/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination)に従うようにします。 -Graceful node shutdownはsystemdに依存しているため、[systemd inhibitor locks](https://www.freedesktop.org/wiki/Software/systemd/inhibit/)を +Graceful Node Shutdownはsystemdに依存しているため、[systemd inhibitor locks](https://www.freedesktop.org/wiki/Software/systemd/inhibit/)を 利用してノードのシャットダウンを一定時間遅らせることができます。 -Graceful node shutdownは、v1.21でデフォルトで有効になっている`GracefulNodeShutdown` [feature gate](/ja/docs/reference/command-line-tools-reference/feature-gates/)で制御されます。 +Graceful Node Shutdownは、v1.21でデフォルトで有効になっている`GracefulNodeShutdown` [feature gate](/ja/docs/reference/command-line-tools-reference/feature-gates/)で制御されます。 なお、デフォルトでは、後述の設定オプション`ShutdownGracePeriod`および`ShutdownGracePeriodCriticalPods`の両方がゼロに設定されているため、Graceful node shutdownは有効になりません。この機能を有効にするには、この2つのkubeletの設定を適切に設定し、ゼロ以外の値を設定する必要があります。 @@ -268,7 +268,7 @@ Graceful shutdownには, kubeletは以下の2段階でPodを終了させます 1. そのノード上で動作している通常のPodを終了させます。 2. そのノード上で動作している[critical pods](/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical)を終了させます。 -Graceful node shutdownには、2つの[`KubeletConfiguration`](/docs/tasks/administer-cluster/kubelet-config-file/)オプションを設定します。: +Graceful Node Shutdownには、2つの[`KubeletConfiguration`](/docs/tasks/administer-cluster/kubelet-config-file/)オプションを設定します。: * `ShutdownGracePeriod`: * ノードがシャットダウンを遅らせるべき合計期間を指定します。これは、通常のPodと[critical pods](/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/#marking-pod-as-critical)の両方のPod終了の合計猶予期間です。 * `ShutdownGracePeriodCriticalPods`: @@ -279,7 +279,7 @@ kubeletはノードのシャットダウンを30秒遅らせます。シャッ 残りの10秒は重要なポッドを終了させるために確保されることになります。 {{< note >}} -Graceful node shutdown中にPodが退避された場合、それらのPodの`.status`は`Failed`になります。 +Graceful Node Shutdown中にPodが退避された場合、それらのPodの`.status`は`Failed`になります。 `kubectl get pods`を実行すると、退避させられたPodのステータスが `Shutdown` と表示されます。 また、`kubectl describe pod`を実行すると、ノードのシャットダウンのためにPodが退避されたことがわかります。 @@ -294,7 +294,7 @@ Message: Node is shutting, evicting pods {{< /note >}} -## Swap memory management {#swap-memory} +## スワップメモリの管理 {#swap-memory} {{< feature-state state="alpha" for_k8s_version="v1.22" >}} @@ -321,7 +321,7 @@ swapBehaviorで使用できる設定オプションは以下の通りです。: `memorySwap`の設定が指定されておらず、[フィーチャーゲート](/ja/docs/reference/command-line-tools-reference/feature-gates/)が有効な場合、 デフォルトのkubeletは`LimitedSwap`の設定と同じ動作を適用します。 -LimitedSwap`設定の動作は、ノードがコントロールグループ(「cgroups」とも呼ばれる)のv1とv2のどちらで動作しているかによって異なります。 +`LimitedSwap`設定の動作は、ノードがコントロールグループ(「cgroups」とも呼ばれる)のv1とv2のどちらで動作しているかによって異なります。 Kubernetesのワークロードでは、メモリとスワップを組み合わせて使用することができ、ポッドのメモリ制限が設定されている場合はその制限まで使用できます。 - **cgroupsv1:** Kubernetesのワークロードは、メモリとスワップを組み合わせて使用することができ、ポッドのメモリ制限が設定されている場合はその制限まで使用できます。 From 54cd481f36cd36a4c2270b37eccfcd34e139a66e Mon Sep 17 00:00:00 2001 From: Riita <42636694+riita10069@users.noreply.github.com> Date: Sat, 30 Oct 2021 00:32:32 +0900 Subject: [PATCH 0004/1077] Update nodes.md --- content/ja/docs/concepts/architecture/nodes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/ja/docs/concepts/architecture/nodes.md b/content/ja/docs/concepts/architecture/nodes.md index e1dcea5be5..000c4944e6 100644 --- a/content/ja/docs/concepts/architecture/nodes.md +++ b/content/ja/docs/concepts/architecture/nodes.md @@ -248,7 +248,7 @@ Pod以外のプロセス用にリソースを明示的に予約したい場合 kubeletはリソースの割当を決定する際にトポロジーのヒントを利用できます。 詳細は、[ノードのトポロジー管理ポリシーを制御する](/docs/tasks/administer-cluster/topology-manager/)を参照してください。 -## Graceful Node Shutdown {#graceful-node-shutdown} +## ノードの正常終了 {#graceful-node-shutdown} {{< feature-state state="beta" for_k8s_version="v1.21" >}} From 7d24269a648b223a693743add270714cd9a0d977 Mon Sep 17 00:00:00 2001 From: Riita <42636694+riita10069@users.noreply.github.com> Date: Tue, 16 Nov 2021 19:32:40 +0900 Subject: [PATCH 0005/1077] Update pod-security-standards.md --- .../security/pod-security-standards.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/content/ja/docs/concepts/security/pod-security-standards.md b/content/ja/docs/concepts/security/pod-security-standards.md index dd3f91e79f..3a7bf61003 100644 --- a/content/ja/docs/concepts/security/pod-security-standards.md +++ b/content/ja/docs/concepts/security/pod-security-standards.md @@ -52,7 +52,7 @@ _Pod Security Policy_ はクラスターレベルのリソースで、Pod定義 ホストのプロセス -

Windows ポッドは、Windows ノードへの特権的なアクセスを可能にするHostProcessコンテナを実行する機能を提供します。ベースラインポリシーでは、ホストへの特権的なアクセスは禁止されています。HostProcessポッドは、Kubernetes v1.22時点ではアルファ版の機能です。 +

Windows Podは、Windowsノードへの特権的なアクセスを可能にするHostProcessコンテナを実行する機能を提供します。ベースラインポリシーでは、ホストへの特権的なアクセスは禁止されています。HostProcess Podは、Kubernetes v1.22時点ではアルファ版の機能です。 ホストのネームスペースの共有は無効化すべきです。

制限されるフィールド

Policies other than "none" require the TopologyManager feature gate to be enabled. -Dynamic Kubelet Config (deprecated): This field should not be updated without a full node -reboot. It is safest to keep this value the same as the local config. Default: "none"

-->

topologyManagerPolicy是要使用的拓扑管理器策略名称。合法值包括:

@@ -1028,8 +816,6 @@ Default: "none"

  • single-numa-node:kubelet 仅允许在 CPU 和设备资源上对齐到同一 NUMA 节点的 Pod。
  • 如果策略不是 "none",则要求启用TopologyManager特性门控。

    -

    DynamicKubeletConfig (已弃用): -更新此字段时需要对整个节点执行重启。最安全的做法是确保此值与本地配置相同。

    默认值:"none"

    @@ -1068,34 +854,25 @@ the minimum percentage of a resource reserved for exclusive use by the guaranteed QoS tier. Currently supported resources: "memory" Requires the QOSReserved feature gate to be enabled. -Dynamic Kubelet Config (deprecated): This field should not be updated without a full node -reboot. It is safest to keep this value the same as the local config. Default: nil -->

    qosReserved是一组从资源名称到百分比值的映射,用来为Guaranteed QoS 类型的负载预留供其独占使用的资源百分比。目前支持的资源为:"memory"。 需要启用QOSReserved特性门控。

    -

    DynamicKubeletConfig (已弃用): -更新此字段时需要对整个节点执行重启。最安全的做法是确保此值与本地配置相同。

    默认值:nil

    runtimeRequestTimeout
    -meta/v1.Duration +meta/v1.Duration

    runtimeRequestTimeout用来设置除长期运行的请求(pulllogsexecattach)之外所有运行时请求的超时时长。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑可能干扰与 kubelet 服务器交互的组件。

    默认值:"2m"

    @@ -1123,15 +900,10 @@ themselves if they should try to access their own Service. Values:

    一般而言,用户必须设置--hairpin-mode=hairpin-veth才能实现发夹模式的网络地址转译 (NAT),因为混杂模式的网桥要求存在一个名为cbr0的容器网桥。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑取决于网络插件,可能需要重启节点。

    默认值:"promiscuous-bridge"

    @@ -1142,20 +914,9 @@ Default: "promiscuous-bridge"

    maxPods是此 kubelet 上课运行的 Pod 个数上限。此值必须为非负整数。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑变更可能导致 kubelet 重启时 Pod 无法被准入, -而且可能改变Node.status.capacity[v1.ResourcePods]中报告的数值, -从而影响将来的调度决策。增大此个数值也可能会降低性能,因为会有更多的 Pod -塞到同一节点运行。

    默认值:110

    @@ -1166,15 +927,10 @@ Default: 110

    podCIDR是用来设置 Pod IP 地址的 CIDR 值,仅用于独立部署模式。 运行于集群模式时,这一数值会从控制面获得。

    -

    DynamicKubeletConfig (已弃用): -此字段应该总是设置为默认的空字符串值。并且仅用来设置独立运行的 kubelet, -因为这种 kubelet 模式下无法利用动态 kubelet 配置能力。

    默认值:""

    @@ -1184,14 +940,9 @@ Default: ""

    podPidsLimit是每个 Pod 中可使用的 PID 个数上限。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑减小此值可能会导致变更后无法创建容器进程。

    默认值:-1

    @@ -1202,17 +953,11 @@ Default: -1

    resolvConf是一个域名解析配置文件,用作容器 DNS 解析配置的基础。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑变更仅会对更新完成后所创建的 Pod 起作用。 -建议在变更此字段之前先腾空节点。如果此值设置为空字符串,则会覆盖 DNS 解析的默认配置, +

    如果此值设置为空字符串,则会覆盖 DNS 解析的默认配置, 本质上相当于禁用了 DNS 查询。

    默认值:"/etc/resolv.conf"

    @@ -1238,37 +983,25 @@ Default: false

    cpuCFSQuota允许为设置了 CPU 限制的容器实施 CPU CFS 配额约束。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑禁止此功能可能会降低节点稳定性。

    默认值:true

    cpuCFSQuotaPeriod
    -meta/v1.Duration +meta/v1.Duration

    cpuCFSQuotaPeriod设置 CPU CFS 配额周期值,cpu.cfs_period_us。 此值需要介于 1 微秒和 1 秒之间,包含 1 微秒和 1 秒。 此功能要求启用CustomCPUCFSQuotaPeriod特性门控被启用。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑为容器所设置的限制值可能导致cpu.cfs_period_us -设置发生变化。这一变化会在节点被重新配置时触发容器重启。

    默认值:"100ms"

    @@ -1280,16 +1013,11 @@ Default: "100ms"

    nodeStatusMaxImages限制Node.status.images中报告的镜像数量。 此值必须大于 -2。

    注意:如果设置为 -1,则不会对镜像数量做限制;如果设置为 0,则不会返回任何镜像。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑节点状态中可能报告不同的数值。

    默认值:50

    @@ -1300,14 +1028,9 @@ Default: 50

    maxOpenFiles是 kubelet 进程可以打开的文件个数。此值必须不能为负数。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑可能影响到 kubelet 与节点文件系统间交互的能力。

    默认值:1000000

    @@ -1317,18 +1040,9 @@ Default: 1000000

    contentType是向 API 服务器发送请求时使用的内容类型。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑这样做可能影响 kubelet 与 API 服务器通信的能力。 -如果 kubelet 因为此字段的变更而失去与 API 服务器间的连接, -则之前所作的变更无法通过动态 kubelet 配置来实现回退。

    默认值:"application/vnd.kubernetes.protobuf"

    @@ -1338,15 +1052,9 @@ Default: "application/vnd.kubernetes.protobuf"

    kubeAPIQPS设置与 Kubernetes API 服务器通信时要使用的 QPS(每秒查询数)。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑这可能因为 kubelet 与 API 服务器之间流量的变化而影响集群扩缩能力。

    默认值:5

    @@ -1357,16 +1065,10 @@ Default: 5

    kubeAPIBurst设置与 Kubernetes API 服务器通信时突发的流量级别。 此字段取值不可以是负数。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑这可能因为 kubelet 与 API 服务器之间流量的变化而影响集群扩缩能力。

    默认值:10

    @@ -1379,16 +1081,11 @@ Default: 10 at a time. We recommend ∗not∗ changing the default value on nodes that run docker daemon with version < 1.9 or an Aufs storage backend. Issue #10959 has more details. -If DynamicKubeletConfig (deprecated; default off) is on, when -dynamically updating this field, consider that -it may impact the performance of image pulls. Default: true -->

    serializeImagePulls被启用时会通知 kubelet 每次仅拉取一个镜像。 我们建议不要在所运行的 docker 守护进程版本低于 1.9、使用 aufs 存储后端的节点上更改默认值。详细信息可参见 Issue #10959。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑这可能会影响镜像拉取的性能。

    默认值:true

    @@ -1400,26 +1097,21 @@ Default: true

    evictionHard是一个映射,是从信号名称到定义硬性驱逐阈值的映射。 例如:{"memory.available": "300Mi"}。 如果希望显式地禁用,可以在任意资源上将其阈值设置为 0% 或 100%。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑这可能会触发或延迟 Pod 驱逐操作。

    默认值:

    -  memory.available:  "100Mi"
    -  nodefs.available:  "10%"
    -  nodefs.inodesFree: "5%"
    -  imagefs.available: "15%"
    +   memory.available:  "100Mi"
    +   nodefs.available:  "10%"
    +   nodefs.inodesFree: "5%"
    +   imagefs.available: "15%"
       
    @@ -1430,17 +1122,10 @@ Default:

    evictionSoft是一个映射,是从信号名称到定义软性驱逐阈值的映射。 例如:{"memory.available": "300Mi"}

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑这可能会触发或延迟 Pod 驱逐操作, -并且可能造成节点所报告的可分配资源数量发生变化。

    默认值:nil

    @@ -1451,34 +1136,24 @@ Default: nil

    evictionSoftGracePeriod是一个映射,是从信号名称到每个软性驱逐信号的宽限期限。 例如:{"memory.available": "30s"}

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑这可能会触发或延迟 Pod 驱逐操作。

    默认值:nil

    evictionPressureTransitionPeriod
    -meta/v1.Duration +meta/v1.Duration

    evictionPressureTransitionPeriod设置 kubelet 离开驱逐压力状况之前必须要等待的时长。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑减少此字段值可能会在节点过量分配时降低节点稳定性。

    默认值:"5m"

    @@ -1493,10 +1168,6 @@ effectively caps the Pod's terminationGracePeriodSeconds value during soft evict Note: Due to issue #64530, the behavior has a bug where this value currently just overrides the grace period during soft eviction, which can increase the grace period from what is set on the Pod. This bug will be fixed in a future release. -If DynamicKubeletConfig (deprecated; default off) is on, when -dynamically updating this field, consider that -lowering it decreases the amount of time Pods will have to gracefully clean -up before being killed during a soft eviction. Default: 0 -->

    evictionMaxPodGracePeriod是指达到软性逐出阈值而引起 Pod 终止时, @@ -1505,9 +1176,6 @@ Pod 可以获得的terminationGracePeriodSeconds

    注意:由于 Issue #64530 的原因,系统中存在一个缺陷,即此处所设置的值会在软性逐出时覆盖 Pod 的宽限期设置,从而有可能增加 Pod 上原本设置的宽限期限时长。 这个缺陷会在未来版本中修复。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑缩短此宽限期限值会导致软性逐出期间 Pod -在被杀死之前用来体面地完成清理工作可用的时间。

    默认值:0

    @@ -1520,16 +1188,11 @@ Pod 的宽限期设置,从而有可能增加 Pod 上原本设置的宽限期 which describe the minimum amount of a given resource the kubelet will reclaim when performing a pod eviction while that resource is under pressure. For example: {"imagefs.available": "2Gi"}. -If DynamicKubeletConfig (deprecated; default off) is on, when -dynamically updating this field, consider that -it may change how well eviction can manage resource pressure. Default: nil -->

    evictionMinimumReclaim是一个映射,定义信号名称与最小回收量数值之间的关系。 最小回收量指的是资源压力较大而执行 Pod 驱逐操作时,kubelet 对给定资源的最小回收量。 例如:{"imagefs.available": "2Gi"}

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑这可能会改变驱逐操作应对资源压力的效果。

    默认值:nil

    @@ -1541,20 +1204,10 @@ Default: nil

    podsPerCore设置的是每个核上 Pod 个数上限。此值不能超过maxPods。 所设值必须是非负整数。如果设置为 0,则意味着对 Pod 个数没有限制。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑变更可能导致 kubelet 重启时 Pod 无法被准入, -还可能导致Node.status.capacity.pods所报告的数值发生变化, -进而影响到将来的调度决策。增大此值也会降低性能,因为在同一个处理器核上需要运行更多的 Pod。

    默认值:0

    @@ -1566,24 +1219,15 @@ Default: 0

    enableControllerAttachDetach用来允许 Attach/Detach 控制器管理调度到本节点的卷的挂接(attachment)和解除挂接(detachement), 并且禁止 kubelet 执行任何 attach/detach 操作。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑在运行中的节点上更改由哪个组件来负责卷管理时, -这一变更可能导致节点在被更新前尚未腾空时卷无法被解除挂接。 -如果 kubelet 尚未更新volumes.kubernetes.io/controller-managed-attach-detach -注解时 Pod 已经被调度到了该节点,节点上的卷也会无法解除挂接。 -一般而言,最安全的做法是将此字段设置为与本地配置相同的值。

    +

    注意:kubelet 不支持挂接 CSI 卷和解除挂接, +因此对于该用例,此选项必须为 true。

    默认值:true

    @@ -1595,18 +1239,11 @@ Default: true

    protectKernelDefaults设置为true时,会令 kubelet 在发现内核参数与预期不符时出错退出。若此字段设置为false,则 kubelet 会尝试更改内核参数以满足其预期。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑启用此设置会在内核参数与 kubelet 预期不匹配时导致 -kubelet 进入崩溃循环(Crash-Loop)状态。

    默认值:false

    @@ -1619,18 +1256,12 @@ kubelet 进入崩溃循环(Crash-Loop)状态。

    are present on host. These rules will serve as utility rules for various components, e.g. kube-proxy. The rules will be created based on iptablesMasqueradeBit and iptablesDropBit. -If DynamicKubeletConfig (deprecated; default off) is on, when -dynamically updating this field, consider that -disabling it will prevent the Kubelet from healing locally misconfigured iptables rules. Default: true -->

    makeIPTablesUtilChains设置为true时,相当于允许 kubelet 确保一组 iptables 规则存在于宿主机上。这些规则会为不同的组件(例如 kube-proxy) 提供工具性质的规则。它们是基于iptablesMasqueradeBitiptablesDropBit 来创建的。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑禁用此行为会导致 kubelet 无法在本地 iptables -规则出错时实现自愈。

    默认值:true

    @@ -1643,18 +1274,11 @@ Default: true Values must be within the range [0, 31]. Must be different from other mark bits. Warning: Please match the value of the corresponding parameter in kube-proxy. TODO: clean up IPTablesMasqueradeBit in kube-proxy. -If DynamicKubeletConfig (deprecated; default off) is on, when -dynamically updating this field, consider that -it needs to be coordinated with other components, like kube-proxy, and the update -will only be effective if MakeIPTablesUtilChains is enabled. Default: 14 -->

    iptablesMasqueradeBit是 iptables fwmark 空间中用来为 SNAT 作标记的位。此值必须介于[0, 31]区间,必须与其他标记位不同。

    警告:请确保此值设置与 kube-proxy 中对应的参数设置取值相同。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑此处的变更要与其他组件(如 kube-proxy)相应的变更协调一致。 -只有当makeIPTablesUtilChains能力被启用时,这里的更新才会起作用。

    默认值:14

    @@ -1665,17 +1289,10 @@ Default: 14

    iptablesDropBit是 iptables fwmark 空间中用来标记丢弃包的数据位。 此值必须介于[0, 31]区间,必须与其他标记位不同。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑此处的变更要与其他组件(如 kube-proxy)相应的变更协调一致。 -只有当makeIPTablesUtilChains能力被启用时,这里的更新才会起作用。

    默认值:15

    @@ -1686,22 +1303,12 @@ Default: 15

    featureGates是一个从功能特性名称到布尔值的映射,用来启用或禁用实验性的功能。 此字段可逐条更改文件 "k8s.io/kubernetes/pkg/features/kube_features.go" 中所给的内置默认值。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑你所启用或禁止的功能特性的文档。 -尽管我们鼓励功能特性的开发人员使动态启用或禁用功能特性成为可能, -某些变更可能要求重新启动节点,某些特性可能要求在从启用到禁用切换时作出精细的协调。

    默认值:nil

    @@ -1711,14 +1318,9 @@ Default: nil

    failSwapOn通知 kubelet 在节点上启用交换分区时拒绝启动。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑缩短此周期长度可能产生性能影响。

    默认值:true

    @@ -1739,15 +1341,10 @@ Default: true

    containerLogMaxSize是定义容器日志文件被轮转之前可以到达的最大尺寸。 例如:"5Mi" 或 "256Ki"。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑可能会触发日志轮转。

    默认值:"10Mi"

    @@ -1758,14 +1355,9 @@ Default: "10Mi"

    containerLogMaxFiles设置每个容器可以存在的日志文件个数上限。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑降低此值可能导致日志文件被删除。

    默认值:"5"

    @@ -1803,20 +1395,11 @@ managers are running. Valid values include:

    pairs that describe resources reserved for non-kubernetes components. Currently only cpu and memory are supported. See http://kubernetes.io/docs/user-guide/compute-resources for more detail. -If DynamicKubeletConfig (deprecated; default off) is on, when -dynamically updating this field, consider that -it may not be possible to increase the reserved resources, because this -requires resizing cgroups. Always look for a NodeAllocatableEnforced event -after updating this field to ensure that the update was successful. Default: nil -->

    systemReserved是一组资源名称=资源数量对, 用来描述为非 Kubernetes 组件预留的资源(例如:'cpu=200m,memory=150G')。

    目前仅支持 CPU 和内存。更多细节可参见 http://kubernetes.io/zh/docs/user-guide/compute-resources。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑增加预留资源也许是不可能的,因为需要改变控制组大小。 -在更改了此字段之后,应该总是关注NodeAllocatableEnforced事件, -以确保更新是成功的。

    默认值:Nil

    @@ -1830,21 +1413,12 @@ that describe resources reserved for kubernetes system components. Currently cpu, memory and local storage for root file system are supported. See https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ for more details. -If DynamicKubeletConfig (deprecated; default off) is on, when -dynamically updating this field, consider that -it may not be possible to increase the reserved resources, because this -requires resizing cgroups. Always look for a NodeAllocatableEnforced event -after updating this field to ensure that the update was successful. Default: nil -->

    kubeReserved是一组资源名称=资源数量对, 用来描述为 Kubernetes 系统组件预留的资源(例如:'cpu=200m,memory=150G')。 目前支持 CPU、内存和根文件系统的本地存储。 更多细节可参见 https://kubernetes.io/zh/docs/concepts/configuration/manage-resources-containers/。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑增加预留资源也许是不可能的,因为需要改变控制组大小。 -在更改了此字段之后,应该总是关注NodeAllocatableEnforced事件, -以确保更新是成功的。

    默认值:Nil

    @@ -1893,18 +1467,14 @@ Default: ""

    systemReservedCgroup帮助 kubelet 识别用来为 OS 系统级守护进程实施 systemReserved计算资源预留时使用的顶级控制组(CGroup)。 -参考[Node Allocatable](https://git.k8s.io/community/contributors/design-proposals/node/node-allocatable.md) +参考 Node Allocatable 以了解详细信息。

    -

    DynamicKubeletConfig(已弃用): -此字段更新时需要整个节点重启。最安全的做法是保持此值与本地配置相同。

    默认值:""

    @@ -1916,18 +1486,14 @@ Default: ""

    kubeReservedCgroup 帮助 kubelet 识别用来为 Kubernetes 节点系统级守护进程实施 kubeReserved计算资源预留时使用的顶级控制组(CGroup)。 -参阅Node Allocatable +参阅 Node Allocatable 了解进一步的信息。

    -

    DynamicKubeletConfig(已弃用): -此字段更新时需要整个节点重启。最安全的做法是保持此值与本地配置相同。

    默认值:""

    @@ -1945,13 +1511,6 @@ When kube-reserved is in the list, kubeReservedCgroup must be speci This field is supported only when cgroupsPerQOS is set to true. Refer to Node Allocatable for more information. -If DynamicKubeletConfig (deprecated; default off) is on, when -dynamically updating this field, consider that -removing enforcements may reduce the stability of the node. Alternatively, adding -enforcements may reduce the stability of components which were using more than -the reserved amount of resources; for example, enforcing kube-reserved may cause -Kubelets to OOM if it uses more than the reserved resources, and enforcing system-reserved -may cause system daemons to OOM if they use more than the reserved resources. Default: ["pods"] -->

    此标志设置 kubelet 需要执行的各类节点可分配资源策略。此字段接受一组选项列表。 @@ -1963,11 +1522,6 @@ Default: ["pods"]

    这个字段只有在cgroupsPerQOS被设置为true才被支持。

    参阅Node Allocatable 了解进一步的信息。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑去掉此机制可能会降低节点稳定性。 -反之,添加此机制可能会降低原来使用资源超出预留量的组件的稳定性。 -例如,实施 kube-reserved 在 kubelet 使用资源超出预留量时可能导致 kubelet 发生 OOM, -而实施 system-reserved 机制可能导致使用资源超出预留量的系统守护进程发生 OOM。

    默认值:["pods"]

    @@ -1996,14 +1550,9 @@ Default: []

    volumePluginDir是用来搜索其他第三方卷插件的目录的路径。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑更改volumePluginDir可能干扰使用第三方卷插件的负载。

    默认值:"/usr/libexec/kubernetes/kubelet-plugins/volume/exec/"

    @@ -2014,15 +1563,10 @@ Default: "/usr/libexec/kubernetes/kubelet-plugins/volume/exec/"

    providerID字段被设置时,指定的是一个外部提供者(即云驱动)实例的唯一 ID, 该提供者可用来唯一性地标识特定节点。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑可能影响到 kubelet 与云驱动之间进行交互的能力。

    默认值:""

    @@ -2034,15 +1578,10 @@ Default: "quot;

    kernelMemcgNotification字段如果被设置了,会告知 kubelet 集成内核的 memcg 通知机制来确定是否超出内存逐出阈值,而不是使用轮询机制来判定。

    -

    DynamicKubeletConfig (已弃用,默认为关闭)被启用时, -如果动态更新了此字段,请考虑这样做可能影响到 kubelet 与内核的交互方式。

    默认值:false

    @@ -2078,7 +1617,7 @@ Default: true shutdownGracePeriod
    -meta/v1.Duration +meta/v1.Duration +list when the node is shutting down. +For example, to allow critical pods 10s to shutdown, priority>=10000 pods 20s to +shutdown, and all remaining pods 30s to shutdown. +-->

    shutdownGracePeriodByPodPriority设置基于 Pod 相关的优先级类值而确定的体面关闭时间。当 kubelet 收到关闭请求的时候,kubelet 会针对节点上运行的所有 Pod 发起关闭操作,这些关闭操作会根据 Pod 的优先级确定其宽限期限, @@ -2140,6 +1683,15 @@ list when the node is shutting down.-->

  • priority: 0 shutdownGracePeriodSeconds: 30
  • +

    在退出之前,kubelet 要等待的时间上限为节点上所有优先级类的 shutdownGracePeriodSeconds的最大值。 当所有 Pod 都退出或者到达其宽限期限时,kubelet 会释放关闭防护锁。 @@ -2314,6 +1866,202 @@ SerializedNodeConfigSource 允许对 `v1.NodeConfigSource` 执行序列化操作 +## `CredentialProvider` {#kubelet-config-k8s-io-v1beta1-CredentialProvider} + + +**出现在:** + +- [CredentialProviderConfig](#kubelet-config-k8s-io-v1beta1-CredentialProviderConfig) + + +CredentialProvider 代表的是要被 kubelet 调用的一个 exec 插件。 +这一插件只会在所拉取的镜像与该插件所处理的镜像匹配时才会被调用(参见 matchImages)。 + + + + + + + + + + + + + + + + + + + + + + + + +
    字段描述
    name [必需]
    +string +
    + +

    + name 是凭据提供者的名称(必需)。此名称必须与 kubelet + 所看到的提供者可执行文件的名称匹配。可执行文件必须位于 kubelet 的 + bin 目录(通过 --image-credential-provider-bin-dir 设置)下。 +

    +
    matchImages [必需]
    +[]string +
    + +

    matchImages 是一个必须设置的字符串列表,用来匹配镜像以便确定是否要调用此提供者。 +如果字符串之一与 kubelet 所请求的镜像匹配,则此插件会被调用并给予提供凭证的机会。 +镜像应该包含镜像库域名和 URL 路径。

    + +

    matchImages 中的每个条目都是一个模式字符串,其中可以包含端口号和路径。 +域名部分可以包含统配符,但端口或路径部分不可以。通配符可以用作子域名,例如 +'*.k8s.io' 或 'k8s.*.io',以及顶级域名,如 'k8s.*'。

    +

    对类似 'app*.k8s.io' 这类部分子域名的匹配也是支持的。 +每个通配符只能用来匹配一个子域名段,所以 '*.io' 不会匹配 '*.k8s.io'。

    + +

    镜像与 matchImages 之间存在匹配时,以下条件都要满足:

    +
      + +
    • 二者均包含相同个数的域名部分,并且每个域名部分都对应匹配;
    • +
    • matchImages 条目中的 URL 路径部分必须是目标镜像的 URL 路径的前缀;
    • +
    • 如果 matchImages 条目中包含端口号,则端口号也必须与镜像端口号匹配。
    • +
    + +

    matchImages 的一些示例如下:

    +
      +
    • 123456789.dkr.ecr.us-east-1.amazonaws.com
    • +
    • *.azurecr.io
    • +
    • gcr.io
    • +
    • ..registry.io
    • +
    • registry.io:8080/path
    • +
    +
    defaultCacheDuration [必需]
    +meta/v1.Duration +
    + +

    + defaultCacheDuration 是插件在内存中缓存凭据的默认时长, + 在插件响应中没有给出缓存时长时,使用这里设置的值。此字段是必需的。 +

    +
    apiVersion [必需]
    +string +
    + +

    + 要求 exec 插件 CredentialProviderRequest 请求的输入版本。 + 所返回的 CredentialProviderResponse 必须使用与输入相同的编码版本。当前支持的值有: +

    +
      +
    • credentialprovider.kubelet.k8s.io/v1beta1
    • +
    +
    args
    +[]string +
    + +

    在执行插件可执行文件时要传递给命令的参数。

    +
    env
    +[]ExecEnvVar +
    + +

    + env 定义要提供给插件进程的额外的环境变量。 + 这些环境变量会与主机上的其他环境变量以及 client-go 所使用的环境变量组合起来, + 一起传递给插件。 +

    +
    + +## `ExecEnvVar` {#kubelet-config-k8s-io-v1beta1-ExecEnvVar} + + +**出现在:** + +- [CredentialProvider](#kubelet-config-k8s-io-v1beta1-CredentialProvider) + + +ExecEnvVar 用来在执行基于 exec 的凭据插件时设置环境变量。 + + + + + + + + + + + + +
    字段描述
    name [必需]
    +string +
    + + + 无描述 + +
    value [必需]
    +string +
    + + + 无描述 + +
    + + ## `KubeletAnonymousAuthentication` {#kubelet-config-k8s-io-v1beta1-KubeletAnonymousAuthentication} @@ -2491,7 +2239,7 @@ API 来提供持有者令牌身份认证。

    cacheAuthorizedTTL
    -meta/v1.Duration +meta/v1.Duration cacheUnauthorizedTTL
    -meta/v1.Duration +meta/v1.Duration flushFrequency [必需]
    -time.Duration +time.Duration

    - - 对日志进行清洗的最大间隔秒数。如果所选的日志后端在写入日志消息时不提供缓存, -则此配置会被忽略。 + + 对日志进行清洗的最大间隔纳秒数(例如,1s = 1000000000)。 + 如果所选的日志后端在写入日志消息时不提供缓存,则此配置会被忽略。

    @@ -2827,19 +2578,6 @@ Only supported for "text" log format.--> -sanitization [必需]
    -bool - - -

    - - [试验功能] 当启用此选项时,被标记为敏感的字段(密码、秘钥、令牌)不会被日志记录。 -运行时日志过滤功能可能会引入非常大的计算开销,因此在生产环境中不应启用。 -

    - - - options [必需]
    FormatOptions From aea9e7b7a1aa7d4644e93f89b39a995f9960c935 Mon Sep 17 00:00:00 2001 From: Sean Wei Date: Sat, 21 May 2022 02:27:18 +0800 Subject: [PATCH 0890/1077] [zh] Sync contribute --- .../contribute/participate/pr-wranglers.md | 8 ++--- .../zh/docs/contribute/style/content-guide.md | 33 +++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/content/zh/docs/contribute/participate/pr-wranglers.md b/content/zh/docs/contribute/participate/pr-wranglers.md index d9af8cc1d3..20230e4d3b 100644 --- a/content/zh/docs/contribute/participate/pr-wranglers.md +++ b/content/zh/docs/contribute/participate/pr-wranglers.md @@ -11,11 +11,11 @@ weight: 20 -SIG Docs 的[批准人(Approvers)](/zh/docs/contribute/participate/roles-and-responsibilites/#approvers)们每周轮流负责 +SIG Docs 的[批准人(Approvers)](/zh/docs/contribute/participate/roles-and-responsibilities/#approvers)们每周轮流负责 [管理仓库的 PR](https://github.com/kubernetes/website/wiki/PR-Wranglers)。 本节介绍 PR 管理者的职责。关于如何提供较好的评审意见, @@ -206,7 +206,7 @@ In late 2021, SIG Docs introduced the PR Wrangler Shadow Program. The program wa - Others can reach out on the [#sig-docs Slack channel](https://kubernetes.slack.com/messages/sig-docs) for requesting to shadow an assigned PR Wrangler for a specific week. Feel free to reach out to Brad Topol (`@bradtopol`) or one of the [SIG Docs co-chairs/leads](https://github.com/kubernetes/community/tree/master/sig-docs#leadership). -- Once you've signed up to shadow a PR Wrangler, introduce yourself to the PR Wrangler on the [Kubernetes Slack](slack.k8s.io). +- Once you've signed up to shadow a PR Wrangler, introduce yourself to the PR Wrangler on the [Kubernetes Slack](https://slack.k8s.io). --> ### 成为一名影子 @@ -221,4 +221,4 @@ In late 2021, SIG Docs introduced the PR Wrangler Shadow Program. The program wa [SIG Docs 联席主席/主管](https://github.com/kubernetes/community/tree/master/sig-docs#leadership)。 - 注册成为一名 PR 管理者的影子时, - 请你在 [Kubernetes Slack](slack.k8s.io) 向这名 PR 管理者做一次自我介绍。 + 请你在 [Kubernetes Slack](https://slack.k8s.io) 向这名 PR 管理者做一次自我介绍。 diff --git a/content/zh/docs/contribute/style/content-guide.md b/content/zh/docs/contribute/style/content-guide.md index 1f787a1b93..91e9d0ee96 100644 --- a/content/zh/docs/contribute/style/content-guide.md +++ b/content/zh/docs/contribute/style/content-guide.md @@ -15,19 +15,19 @@ weight: 10 本页包含 Kubernetes 文档的一些指南。 -如果你不清楚哪些事情是可以做的,请加入到 -[Kubernetes Slack](http://slack.k8s.io/) 的 `#sig-docs` 频道提问! -你可以在 http://slack.k8s.io 注册到 Kubernetes Slack。 +如果你不清楚哪些事情是可以做的,请加入到 +[Kubernetes Slack](https://slack.k8s.io/) 的 `#sig-docs` 频道提问! +你可以在 https://slack.k8s.io 注册到 Kubernetes Slack。 关于为 Kubernetes 文档创建新内容的更多信息,可参考 [样式指南](/zh/docs/contribute/style/style-guide)。 @@ -42,7 +42,7 @@ Source for the Kubernetes website, including the docs, resides in the Located in the `kubernetes/website/content//docs` folder, the majority of Kubernetes documentation is specific to the [Kubernetes -project](https://github.com/kubernetes/kubernetes). +project](https://github.com/kubernetes/kubernetes). ## What's allowed @@ -72,12 +72,12 @@ Kubernetes 网站(包括其文档)源代码位于 ### Third party content Kubernetes documentation includes applied examples of projects in the Kubernetes project—projects that live in the [kubernetes](https://github.com/kubernetes) and -[kubernetes-sigs](https://github.com/kubernetes-sigs) GitHub organizations. +[kubernetes-sigs](https://github.com/kubernetes-sigs) GitHub organizations. -Links to active content in the Kubernetes project are always allowed. +Links to active content in the Kubernetes project are always allowed. -Kubernetes requires some third party content to function. Examples include container runtimes (containerd, CRI-O, Docker), -[networking policy](/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/) (CNI plugins), [Ingress controllers](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/), and [logging](https://kubernetes.io/docs/concepts/cluster-administration/logging/). +Kubernetes requires some third party content to function. Examples include container runtimes (containerd, CRI-O, Docker), +[networking policy](/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/) (CNI plugins), [Ingress controllers](/docs/concepts/services-networking/ingress-controllers/), and [logging](/docs/concepts/cluster-administration/logging/). Docs can link to third-party open source software (OSS) outside the Kubernetes project only if it's necessary for Kubernetes to function. --> @@ -94,7 +94,7 @@ Kubernetes 需要某些第三方内容才能正常工作。例如 容器运行时(containerd、CRI-O、Docker), [联网策略](/zh/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/) (CNI 插件),[Ingress 控制器](/zh/docs/concepts/services-networking/ingress-controllers/) -以及[日志](https://kubernetes.io/zh/docs/concepts/cluster-administration/logging/)等。 +以及[日志](/zh/docs/concepts/cluster-administration/logging/)等。 只有对应的第三方开源软件(OSS)是运行 Kubernetes 所必需的,才可以在文档中包含 指向这些 Kubernetes 项目之外的软件的链接。 @@ -109,7 +109,8 @@ Dual-sourced content requires double the effort (or more!) to maintain and grows stale more quickly. {{< note >}} -If you're a maintainer for a Kubernetes project and need help hosting your own docs, + +If you're a maintainer for a Kubernetes project and need help hosting your own docs, ask for help in [#sig-docs on Kubernetes Slack](https://kubernetes.slack.com/messages/C1J0BPD2M/). {{< /note >}} --> @@ -128,15 +129,13 @@ ask for help in [#sig-docs on Kubernetes Slack](https://kubernetes.slack.com/mes ### 更多信息 {#more-information} -如果你对允许出现的内容有疑问,请加入到 [Kubernetes Slack](http://slack.k8s.io/) +如果你对允许出现的内容有疑问,请加入到 [Kubernetes Slack](https://slack.k8s.io/) 的 `#sig-docs` 频道提问! ## {{% heading "whatsnext" %}} * 阅读[样式指南](/zh/docs/contribute/style/style-guide)。 - - From 18578288959f949ed9cf0418b2d72e34bc485797 Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Sat, 21 May 2022 09:53:34 +0100 Subject: [PATCH 0891/1077] Revert pull request 33842 This reverts commit a5907b3e72bbd7865346e72975d64d0163f0f935 due to an issue that has caused build failures. Verified locally. --- .../docs/reference/using-api/api-concepts.md | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/content/zh/docs/reference/using-api/api-concepts.md b/content/zh/docs/reference/using-api/api-concepts.md index 729eefae64..bf31ae7a78 100644 --- a/content/zh/docs/reference/using-api/api-concepts.md +++ b/content/zh/docs/reference/using-api/api-concepts.md @@ -1066,6 +1066,8 @@ string, working as an enum, and the only accepted values are: `All` : Every stage runs as normal, except for the final storage stage where side effects are prevented. + +For example: --> ### 发起试运行请求 {#make-a-dry-run-request} @@ -1138,11 +1140,11 @@ generated fields may differ. Some values of an object are typically generated before the object is persisted. It is important not to rely upon the values of these fields set by a dry-run request, since these values will likely be different in dry-run mode from when the real request is made. Some of these fields are: * `name`: if `generateName` is set, `name` will have a unique random name -* `creationTimestamp` / `deletionTimestamp`: records the time of creation/deletion -* `UID`: [uniquely identifies](/docs/concepts/overview/working-with-objects/names/#uids) the object and is randomly generated (non-deterministic) +* `creationTimestamp`/`deletionTimestamp`: records the time of creation/deletion +* `UID`: uniquely identifies the object and is randomly generated (non-deterministic) * `resourceVersion`: tracks the persisted version of the object * Any field set by a mutating admission controller -* For the `Service` resource: Ports or IP addresses that the kube-apiserver assigns to Service objects +* For the `Service` resource: Ports or IPs that kube-apiserver assigns to v1.Service objects --> ### 生成值 {#generated-values} @@ -1151,12 +1153,11 @@ Some values of an object are typically generated before the object is persisted. 值很可能不同。这类字段有: * `name`:如果设置了 `generateName` 字段,则 `name` 会获得一个唯一的随机名称 -* `creationTimestamp` / `deletionTimestamp`:记录对象的创建/删除时间 -* `UID`:[唯一标识](/zh/docs/concepts/overview/working-with-objects/names/#uids)对象, - 取值随机生成(非确定性) +* `creationTimestamp`/`deletionTimestamp`:记录对象的创建/删除时间 +* `UID`:唯一性标识对象,取值随机生成(非确定性) * `resourceVersion`: 跟踪对象的持久化(存储)版本 * 变更性准入控制器所设置的字段 -* 对于 `Service` 资源:`kube-apiserver` 为 `Service` 对象分配的端口和 IP 地址 +* 对于 `Service` 资源:`kube-apiserver` 为 `v1.Service` 对象分配的端口和 IP {{< table caption="list 操作的 resourceVersionMatch 与分页参数" >}} From 8b29e8229be8d6cb2a4c723d98e8e42009c3acf8 Mon Sep 17 00:00:00 2001 From: Manish Kumar Date: Sat, 21 May 2022 16:56:00 +0530 Subject: [PATCH 0892/1077] Update container-runtimes.md (#33851) * Update container-runtimes.md * Update content/en/docs/setup/production-environment/container-runtimes.md Co-authored-by: Tim Bannister Co-authored-by: Tim Bannister --- .../setup/production-environment/container-runtimes.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/content/en/docs/setup/production-environment/container-runtimes.md b/content/en/docs/setup/production-environment/container-runtimes.md index 6f9b174631..4e6c2885fa 100644 --- a/content/en/docs/setup/production-environment/container-runtimes.md +++ b/content/en/docs/setup/production-environment/container-runtimes.md @@ -200,6 +200,14 @@ To use the `systemd` cgroup driver in `/etc/containerd/config.toml` with `runc`, [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] SystemdCgroup = true ``` +{{< note >}} +If you installed containerd from a package (for example, RPM or `.deb`), you may find +that the CRI integration plugin is disabled by default. + +You need CRI support enabled to use containerd with Kubernetes. Make sure that `cri` +is not included in the`disabled_plugins` list within `/etc/containerd/config.toml`; +if you made changes to that file, also restart `containerd`. +{{< /note >}} If you apply this change, make sure to restart containerd: From 58aae61611d07b65278e05c699ee08608f97dd78 Mon Sep 17 00:00:00 2001 From: Tom Kivlin <52716470+tomkivlin@users.noreply.github.com> Date: Sat, 21 May 2022 12:59:36 +0100 Subject: [PATCH 0893/1077] Remove refs to dockershim - Removed refs deprecated with dockershim - Tweaked header levels --- .../compute-storage-net/network-plugins.md | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/content/en/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins.md b/content/en/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins.md index dc3940d5e9..b6736d745d 100644 --- a/content/en/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins.md +++ b/content/en/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins.md @@ -24,26 +24,19 @@ CNI specification (plugins can be compatible with multiple spec versions). ## Installation -A CNI plugin is required to implement the [Kubernetes network model](/docs/concepts/services-networking/#the-kubernetes-network-model). The CRI manages its own CNI plugins. There are two Kubelet command line parameters to keep in mind when using plugins: - -* `cni-bin-dir`: Kubelet probes this directory for plugins on startup -* `network-plugin`: The network plugin to use from `cni-bin-dir`. It must match the name reported by a plugin probed from the plugin directory. For CNI plugins, this is `cni`. +A CNI plugin is required to implement the [Kubernetes network model](/docs/concepts/services-networking/#the-kubernetes-network-model). The CRI manages its own CNI plugins, meaning the Kubelet isn't involved in installing or managing the plugins. Plugins are installed according to their own documentation. ## Network Plugin Requirements -Besides providing the [`NetworkPlugin` interface](https://github.com/kubernetes/kubernetes/tree/{{< param "fullversion" >}}/pkg/kubelet/dockershim/network/plugins.go) to configure and clean up pod networking, the plugin may also need specific support for kube-proxy. The iptables proxy obviously depends on iptables, and the plugin may need to ensure that container traffic is made available to iptables. For example, if the plugin connects containers to a Linux bridge, the plugin must set the `net/bridge/bridge-nf-call-iptables` sysctl to `1` to ensure that the iptables proxy functions correctly. If the plugin does not use a Linux bridge (but instead something like Open vSwitch or some other mechanism) it should ensure container traffic is appropriately routed for the proxy. +The plugin may also need specific support for kube-proxy. The iptables proxy obviously depends on iptables, and the plugin may need to ensure that container traffic is made available to iptables. For example, if the plugin connects containers to a Linux bridge, the plugin must set the `net/bridge/bridge-nf-call-iptables` sysctl to `1` to ensure that the iptables proxy functions correctly. If the plugin does not use a Linux bridge (but instead something like Open vSwitch or some other mechanism) it should ensure container traffic is appropriately routed for the proxy. By default if no kubelet network plugin is specified, the `noop` plugin is used, which sets `net/bridge/bridge-nf-call-iptables=1` to ensure simple configurations (like Docker with a bridge) work correctly with the iptables proxy. -### CNI +### Loopback CNI -The CNI plugin is selected by passing Kubelet the `--network-plugin=cni` command-line option. Kubelet reads a file from `--cni-conf-dir` (default `/etc/cni/net.d`) and uses the CNI configuration from that file to set up each pod's network. The CNI configuration file must match the [CNI specification](https://github.com/containernetworking/cni/blob/master/SPEC.md#network-configuration), and any required CNI plugins referenced by the configuration must be present in `--cni-bin-dir` (default `/opt/cni/bin`). +In addition to the CNI plugin installed on the nodes, Kubernetes requires the standard CNI [`lo`](https://github.com/containernetworking/plugins/blob/master/plugins/main/loopback/loopback.go) plugin, at minimum version 0.2.0 -If there are multiple CNI configuration files in the directory, the kubelet uses the configuration file that comes first by name in lexicographic order. - -In addition to the CNI plugin specified by the configuration file, Kubernetes requires the standard CNI [`lo`](https://github.com/containernetworking/plugins/blob/master/plugins/main/loopback/loopback.go) plugin, at minimum version 0.2.0 - -#### Support hostPort +### Support hostPort The CNI networking plugin supports `hostPort`. You can use the official [portmap](https://github.com/containernetworking/plugins/tree/master/plugins/meta/portmap) plugin offered by the CNI plugin team or use your own plugin with portMapping functionality. @@ -80,7 +73,7 @@ For example: } ``` -#### Support traffic shaping +### Support traffic shaping **Experimental Feature** @@ -134,6 +127,6 @@ metadata: ## Usage Summary -* `--network-plugin=cni` specifies that we use the `cni` network plugin with actual CNI plugin binaries located in `--cni-bin-dir` (default `/opt/cni/bin`) and CNI plugin configuration located in `--cni-conf-dir` (default `/etc/cni/net.d`). +Once the Kubelet is installed and communicating with the Kubernetes API Server, a CNI plugin can be installed using the instructions for that plugin. ## {{% heading "whatsnext" %}} From 3b60dec955cdf3c66f6c6d81af59c099171938fa Mon Sep 17 00:00:00 2001 From: Tom Kivlin <52716470+tomkivlin@users.noreply.github.com> Date: Sat, 21 May 2022 13:20:51 +0100 Subject: [PATCH 0894/1077] Added info about v1.24 changes --- .../extend-kubernetes/compute-storage-net/network-plugins.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/en/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins.md b/content/en/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins.md index b6736d745d..799b4c0850 100644 --- a/content/en/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins.md +++ b/content/en/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins.md @@ -24,7 +24,9 @@ CNI specification (plugins can be compatible with multiple spec versions). ## Installation -A CNI plugin is required to implement the [Kubernetes network model](/docs/concepts/services-networking/#the-kubernetes-network-model). The CRI manages its own CNI plugins, meaning the Kubelet isn't involved in installing or managing the plugins. Plugins are installed according to their own documentation. +A CNI plugin is required to implement the [Kubernetes network model](/docs/concepts/services-networking/#the-kubernetes-network-model). +The CRI manages its own CNI plugins, with Kubelet no longer managing the plugins since the [dockershim was removed in v1.24](https://github.com/kubernetes/kubernetes/pull/106907). +CNI plugins are installed according to their own documentation. ## Network Plugin Requirements From 4c6c5ba3eb4cd9051a8c85e8a7a4c943ca9e8696 Mon Sep 17 00:00:00 2001 From: yuli Date: Fri, 20 May 2022 00:43:43 +0800 Subject: [PATCH 0895/1077] [zh]Sync reference-13 [zh]Sync reference-13 [zh]Sync reference-13 [zh]Sync reference-13 [zh]Sync reference-13 --- content/zh/docs/reference/kubectl/_index.md | 1083 ++++++++++++++++++- 1 file changed, 1082 insertions(+), 1 deletion(-) diff --git a/content/zh/docs/reference/kubectl/_index.md b/content/zh/docs/reference/kubectl/_index.md index 5c679220a6..38659b2e8d 100644 --- a/content/zh/docs/reference/kubectl/_index.md +++ b/content/zh/docs/reference/kubectl/_index.md @@ -1,4 +1,1085 @@ --- -title: "kubectl" +title: 命令行工具 (kubectl) +content_type: reference weight: 60 +no_list: true +card: + name: reference + weight: 20 --- + + + +{{< glossary_definition prepend="Kubernetes 提供" term_id="kubectl" length="short" >}} + + +这个工具叫做 `kubectl`。 + + +`针对配置信息,`kubectl` 在 `$HOME/.kube` 目录中查找一个名为 `config` 的配置文件。 +你可以通过设置 `KUBECONFIG` 环境变量或设置 +[`--kubeconfig`](/zh/docs/concepts/configuration/organize-cluster-access-kubeconfig/) +参数来指定其它 [kubeconfig](/zh/docs/concepts/configuration/organize-cluster-access-kubeconfig/) 文件。 + + +本文概述了 `kubectl` 语法和命令操作描述,并提供了常见的示例。 +有关每个命令的详细信息,包括所有受支持的参数和子命令, +请参阅 [kubectl](/docs/reference/generated/kubectl/kubectl-commands/) 参考文档。 + + +有关安装说明,请参见[安装 kubectl](/zh/docs/tasks/tools/#kubectl); +如需快速指南,请参见[备忘单](/zh/docs/reference/kubectl/cheatsheet/)。 +如果你更习惯使用 `docker` 命令行工具, +[Docker 用户的 `kubectl`](/zh/docs/reference/kubectl/docker-cli-to-kubectl/) +介绍了一些 Kubernetes 的等价命令。 + + + +## 语法 + +使用以下语法从终端窗口运行 `kubectl` 命令: + +```shell +kubectl [command] [TYPE] [NAME] [flags] +``` + + +其中 `command`、`TYPE`、`NAME` 和 `flags` 分别是: + + +* `command`:指定要对一个或多个资源执行的操作,例如 `create`、`get`、`describe`、`delete`。 + +* `TYPE`:指定[资源类型](#resource-types)。资源类型不区分大小写, + 可以指定单数、复数或缩写形式。例如,以下命令输出相同的结果: + + ```shell + kubectl get pod pod1 + kubectl get pods pod1 + kubectl get po pod1 + ``` + + +* `NAME`:指定资源的名称。名称区分大小写。 + 如果省略名称,则显示所有资源的详细信息。例如:`kubectl get pods`。 + + 在对多个资源执行操作时,你可以按类型和名称指定每个资源,或指定一个或多个文件: + + + * 要按类型和名称指定资源: + + * 要对所有类型相同的资源进行分组,请执行以下操作:`TYPE1 name1 name2 name<#>`。
    + 例子:`kubectl get pod example-pod1 example-pod2` + + * 分别指定多个资源类型:`TYPE1/name1 TYPE1/name2 TYPE2/name3 TYPE<#>/name<#>`。
    + 例子:`kubectl get pod/example-pod1 replicationcontroller/example-rc1` + + * 用一个或多个文件指定资源:`-f file1 -f file2 -f file<#>` + + * [使用 YAML 而不是 JSON](/zh/docs/concepts/configuration/overview/#general-configuration-tips), + 因为 YAML 对用户更友好, 特别是对于配置文件。
    + 例子:`kubectl get -f ./pod.yaml` + + +* `flags`: 指定可选的参数。例如,可以使用 `-s` 或 `--server` 参数指定 + Kubernetes API 服务器的地址和端口。 + + +{{< caution >}} +从命令行指定的参数会覆盖默认值和任何相应的环境变量。 +{{< /caution >}} + + +如果你需要帮助,在终端窗口中运行 `kubectl help`。 + + +## 集群内身份验证和命名空间覆盖 + + +默认情况下,`kubectl` 命令首先确定它是否在 Pod 中运行,从而被视为在集群中运行。 +它首先检查 `KUBERNETES_SERVICE_HOST` 和 `KUBERNETES_SERVICE_PORT` 环境变量以及 +`/var/run/secrets/kubernetes.io/serviceaccount/token` 中是否存在服务帐户令牌文件。 +如果三个条件都被满足,则假定在集群内进行身份验证。 + + +为保持向后兼容性,如果在集群内身份验证期间设置了 `POD_NAMESPACE` +环境变量,它将覆盖服务帐户令牌中的默认命名空间。 +任何依赖默认命名空间的清单或工具都会受到影响。 + + +**`POD_NAMESPACE` 环境变量** + + +如果设置了 `POD_NAMESPACE` 环境变量,对命名空间资源的 CLI 操作对象将使用该变量值作为默认值。 +例如,如果该变量设置为 `seattle`,`kubectl get pods` 将返回 `seattle` 命名空间中的 Pod。 +这是因为 Pod 是一个命名空间资源,且命令中没有提供命名空间。 + + +直接使用 `--namespace ` 会覆盖此行为。 + + +**kubectl 如何处理 ServiceAccount 令牌** + + +假设: +* 有 Kubernetes 服务帐户令牌文件挂载在 + `/var/run/secrets/kubernetes.io/serviceaccount/token` 上,并且 +* 设置了 `KUBERNETES_SERVICE_HOST` 环境变量,并且 +* 设置了 `KUBERNETES_SERVICE_PORT` 环境变量,并且 +* 你没有在 kubectl 命令行上明确指定命名空间。 + + +然后 kubectl 假定它正在你的集群中运行。 +kubectl 工具查找该 ServiceAccount 的命名空间 +(该命名空间与 Pod 的命名空间相同)并针对该命名空间进行操作。 +这与集群外运行的情况不同; +当 kubectl 在集群外运行并且你没有指定命名空间时, +kubectl 命令会针对 `default` 命名空间进行操作。 + + +## 操作 + + +下表包含所有 kubectl 操作的简短描述和普通语法: + + +操作 | 语法 | 描述 +-------------------- | -------------------- | -------------------- +`alpha` | `kubectl alpha SUBCOMMAND [flags]` | 列出与 alpha 特性对应的可用命令,这些特性在 Kubernetes 集群中默认情况下是不启用的。 +`annotate` | kubectl annotate (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags] | 添加或更新一个或多个资源的注解。 +`api-resources` | `kubectl api-resources [flags]` | 列出可用的 API 资源。 +`api-versions` | `kubectl api-versions [flags]` | 列出可用的 API 版本。 + +`apply` | `kubectl apply -f FILENAME [flags]`| 从文件或 stdin 对资源应用配置更改。 +`attach` | `kubectl attach POD -c CONTAINER [-i] [-t] [flags]` | 挂接到正在运行的容器,查看输出流或与容器(stdin)交互。 +`auth` | `kubectl auth [flags] [options]` | 检查授权。 +`autoscale` | kubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags] | 自动扩缩由副本控制器管理的一组 pod。 +`certificate` | `kubectl certificate SUBCOMMAND [options]` | 修改证书资源。 +`cluster-info` | `kubectl cluster-info [flags]` | 显示有关集群中主服务器和服务的端口信息。 +`completion` | `kubectl completion SHELL [options]` | 为指定的 Shell(Bash 或 Zsh)输出 Shell 补齐代码。 +`config` | `kubectl config SUBCOMMAND [flags]` | 修改 kubeconfig 文件。有关详细信息,请参阅各个子命令。 + +`convert` | `kubectl convert -f FILENAME [options]` | 在不同的 API 版本之间转换配置文件。配置文件可以是 YAML 或 JSON 格式。注意 - 需要安装 `kubectl-convert` 插件。 +`cordon` | `kubectl cordon NODE [options]` | 将节点标记为不可调度。 +`cp` | `kubectl cp [options]` | 从容器复制文件、目录或将文件、目录复制到容器。 +`create` | `kubectl create -f FILENAME [flags]` | 从文件或 stdin 创建一个或多个资源。 +`delete` | kubectl delete (-f FILENAME | TYPE [NAME | /NAME | -l label | --all]) [flags] | 基于文件、标准输入或通过指定标签选择器、名称、资源选择器或资源本身,删除资源。 +`describe` | kubectl describe (-f FILENAME | TYPE [NAME_PREFIX | /NAME | -l label]) [flags] | 显示一个或多个资源的详细状态。 +`diff` | `kubectl diff -f FILENAME [flags]`| 在当前起作用的配置和文件或标准输之间作对比 (**BETA**) + +`drain` | `kubectl drain NODE [options]` | 腾空节点以准备维护。 +`edit` | kubectl edit (-f FILENAME | TYPE NAME | TYPE/NAME) [flags] | 使用默认编辑器编辑和更新服务器上一个或多个资源的定义。 +`exec` | `kubectl exec POD [-c CONTAINER] [-i] [-t] [flags] [-- COMMAND [args...]]` | 对 Pod 中的容器执行命令。 +`explain` | `kubectl explain [--recursive=false] [flags]` | 获取多种资源的文档。例如 Pod、Node、Service 等。 +`expose` | kubectl expose (-f FILENAME | TYPE NAME | TYPE/NAME) [--port=port] [--protocol=TCP|UDP] [--target-port=number-or-name] [--name=name] [--external-ip=external-ip-of-service] [--type=type] [flags] | 将副本控制器、服务或 Pod 作为新的 Kubernetes 服务暴露。 +`get` | kubectl get (-f FILENAME | TYPE [NAME | /NAME | -l label]) [--watch] [--sort-by=FIELD] [[-o | --output]=OUTPUT_FORMAT] [flags] | 列出一个或多个资源。 +`kustomize` | kubectl kustomize [flags] [options]` | 列出从 kustomization.yaml 文件中的指令生成的一组 API 资源。参数必须是包含文件的目录的路径,或者是 git 存储库 URL,其路径后缀相对于存储库根目录指定了相同的路径。 + +`label` | kubectl label (-f FILENAME | TYPE NAME | TYPE/NAME) KEY_1=VAL_1 ... KEY_N=VAL_N [--overwrite] [--all] [--resource-version=version] [flags] | 添加或更新一个或多个资源的标签。 +`logs` | `kubectl logs POD [-c CONTAINER] [--follow] [flags]` | 打印 Pod 中容器的日志。 +`options` | `kubectl options` | 全局命令行选项列表,这些选项适用于所有命令。 +`patch` | kubectl patch (-f FILENAME | TYPE NAME | TYPE/NAME) --patch PATCH [flags] | 使用策略合并流程更新资源的一个或多个字段。 +`plugin` | `kubectl plugin [flags] [options]` | 提供用于与插件交互的实用程序。 +`port-forward` | `kubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] [flags]` | 将一个或多个本地端口转发到一个 Pod。 +`proxy` | `kubectl proxy [--port=PORT] [--www=static-dir] [--www-prefix=prefix] [--api-prefix=prefix] [flags]` | 运行访问 Kubernetes API 服务器的代理。 +`replace` | `kubectl replace -f FILENAME` | 基于文件或标准输入替换资源。 +`rollout` | `kubectl rollout SUBCOMMAND [options]` | 管理资源的上线。有效的资源类型包括:Deployment、 DaemonSet 和 StatefulSet。 +`run` | kubectl run NAME --image=image [--env="key=value"] [--port=port] [--dry-run=server | client | none] [--overrides=inline-json] [flags] | 在集群上运行指定的镜像。 + +`scale` | kubectl scale (-f FILENAME | TYPE NAME | TYPE/NAME) --replicas=COUNT [--resource-version=version] [--current-replicas=count] [flags] | 更新指定副本控制器的大小。 +`set` | `kubectl set SUBCOMMAND [options]` | 配置应用资源。 +`taint` | `kubectl taint NODE NAME KEY_1=VAL_1:TAINT_EFFECT_1 ... KEY_N=VAL_N:TAINT_EFFECT_N [options]` | 更新一个或多个节点上的污点。 +`top` | `kubectl top [flags] [options]` | 显示资源(CPU、内存、存储)的使用情况。 +`uncordon` | `kubectl uncordon NODE [options]` | 将节点标记为可调度。 +`version` | `kubectl version [--client] [flags]` | 显示运行在客户端和服务器上的 Kubernetes 版本。 +`wait` | kubectl wait ([-f FILENAME] | resource.group/resource.name | resource.group [(-l label | --all)]) [--for=delete|--for condition=available] [options] | 实验特性:等待一种或多种资源的特定状况。 + + +了解更多有关命令操作的信息, +请参阅 [kubectl](/zh/docs/reference/kubectl/kubectl/) 参考文档。 + + +## 资源类型 + + +下表列出所有受支持的资源类型及其缩写别名。 + + +(以下输出可以通过 `kubectl api-resources` 获取,内容以 Kubernetes 1.19.1 版本为准。) + + +| 资源名 | 缩写名 | API 分组 | 按命名空间 | 资源类型 | +|---|---|---|---|---| +| `bindings` | | | true | Binding | +| `componentstatuses` | `cs` | | false | ComponentStatus | +| `configmaps` | `cm` | | true | ConfigMap | +| `endpoints` | `ep` | | true | Endpoints | +| `events` | `ev` | | true | Event | +| `limitranges` | `limits` | | true | LimitRange | +| `namespaces` | `ns` | | false | Namespace | +| `nodes` | `no` | | false | Node | +| `persistentvolumeclaims` | `pvc` | | true | PersistentVolumeClaim | +| `persistentvolumes` | `pv` | | false | PersistentVolume | +| `pods` | `po` | | true | Pod | +| `podtemplates` | | | true | PodTemplate | +| `replicationcontrollers` | `rc` | | true | ReplicationController | +| `resourcequotas` | `quota` | | true | ResourceQuota | +| `secrets` | | | true | Secret | +| `serviceaccounts` | `sa` | | true | ServiceAccount | +| `services` | `svc` | | true | Service | +| `mutatingwebhookconfigurations` | | admissionregistration.k8s.io | false | MutatingWebhookConfiguration | +| `validatingwebhookconfigurations` | | admissionregistration.k8s.io | false | ValidatingWebhookConfiguration | +| `customresourcedefinitions` | `crd,crds` | apiextensions.k8s.io | false | CustomResourceDefinition | +| `apiservices` | | apiregistration.k8s.io | false | APIService | +| `controllerrevisions` | | apps | true | ControllerRevision | +| `daemonsets` | `ds` | apps | true | DaemonSet | +| `deployments` | `deploy` | apps | true | Deployment | +| `replicasets` | `rs` | apps | true | ReplicaSet | +| `statefulsets` | `sts` | apps | true | StatefulSet | +| `tokenreviews` | | authentication.k8s.io | false | TokenReview | +| `localsubjectaccessreviews` | | authorization.k8s.io | true | LocalSubjectAccessReview | +| `selfsubjectaccessreviews` | | authorization.k8s.io | false | SelfSubjectAccessReview | +| `selfsubjectrulesreviews` | | authorization.k8s.io | false | SelfSubjectRulesReview | +| `subjectaccessreviews` | | authorization.k8s.io | false | SubjectAccessReview | +| `horizontalpodautoscalers` | `hpa` | autoscaling | true | HorizontalPodAutoscaler | +| `cronjobs` | `cj` | batch | true | CronJob | +| `jobs` | | batch | true | Job | +| `certificatesigningrequests` | `csr` | certificates.k8s.io | false | CertificateSigningRequest | +| `leases` | | coordination.k8s.io | true | Lease | +| `endpointslices` | | discovery.k8s.io | true | EndpointSlice | +| `events` | `ev` | events.k8s.io | true | Event | +| `ingresses` | `ing` | extensions | true | Ingress | +| `flowschemas` | | flowcontrol.apiserver.k8s.io | false | FlowSchema | +| `prioritylevelconfigurations` | | flowcontrol.apiserver.k8s.io | false | PriorityLevelConfiguration | +| `ingressclasses` | | networking.k8s.io | false | IngressClass | +| `ingresses` | `ing` | networking.k8s.io | true | Ingress | +| `networkpolicies` | `netpol` | networking.k8s.io | true | NetworkPolicy | +| `runtimeclasses` | | node.k8s.io | false | RuntimeClass | +| `poddisruptionbudgets` | `pdb` | policy | true | PodDisruptionBudget | +| `podsecuritypolicies` | `psp` | policy | false | PodSecurityPolicy | +| `clusterrolebindings` | | rbac.authorization.k8s.io | false | ClusterRoleBinding | +| `clusterroles` | | rbac.authorization.k8s.io | false | ClusterRole | +| `rolebindings` | | rbac.authorization.k8s.io | true | RoleBinding | +| `roles` | | rbac.authorization.k8s.io | true | Role | +| `priorityclasses` | `pc` | scheduling.k8s.io | false | PriorityClass | +| `csidrivers` | | storage.k8s.io | false | CSIDriver | +| `csinodes` | | storage.k8s.io | false | CSINode | +| `storageclasses` | `sc` | storage.k8s.io | false | StorageClass | +| `volumeattachments` | | storage.k8s.io | false | VolumeAttachment | + + + +## 输出选项 + + +有关如何格式化或排序某些命令的输出的信息,请参阅以下章节。有关哪些命令支持不同输出选项的详细信息, +请参阅 [kubectl](/zh/docs/reference/kubectl/kubectl/) 参考文档。 + + +### 格式化输出 + + +所有 `kubectl` 命令的默认输出格式都是人类可读的纯文本格式。要以特定格式在终端窗口输出详细信息, +可以将 `-o` 或 `--output` 参数添加到受支持的 `kubectl` 命令中。 + + +#### 语法 + +```shell +kubectl [command] [TYPE] [NAME] -o +``` + + +取决于具体的 `kubectl` 操作,支持的输出格式如下: + + +输出格式 | 描述 +--------------| ----------- +`-o custom-columns=` | 使用逗号分隔的[自定义列](#custom-columns)列表打印表。 +`-o custom-columns-file=` | 使用 `` 文件中的[自定义列](#custom-columns)模板打印表。 +`-o json` | 输出 JSON 格式的 API 对象 +`-o jsonpath=