Merge branch 'main' into ja-fix-link

This commit is contained in:
Ryota Yamada
2022-01-03 23:22:49 +09:00
committed by GitHub
33 changed files with 1049 additions and 677 deletions
@@ -85,7 +85,11 @@ class third,fourth white
- Reading the PR description to understand the changes made, and read any linked issues - Reading the PR description to understand the changes made, and read any linked issues
- Reading any comments by other reviewers - Reading any comments by other reviewers
- Clicking the **Files changed** tab to see the files and lines changed - Clicking the **Files changed** tab to see the files and lines changed
- Previewing the changes in the Netlify preview build by scrolling to the PR's build check section at the bottom of the **Conversation** tab and clicking the **deploy/netlify** line's **Details** link. - Previewing the changes in the Netlify preview build by scrolling to the PR's build check section at the bottom of the **Conversation** tab.
Here's a screenshot (this shows GitHub's desktop site; if you're reviewing
on a tablet or smartphone device, the GitHub web UI is slightly different):
{{< figure src="/images/docs/github_netlify_deploy_preview.png" alt="GitHub pull request details including link to Netlify preview" >}}
To open the preview, click on the **Details** link of the **deploy/netlify** line in the list of checks.
4. Go to the **Files changed** tab to start your review. 4. Go to the **Files changed** tab to start your review.
1. Click on the `+` symbol beside the line you want to comment on. 1. Click on the `+` symbol beside the line you want to comment on.
@@ -0,0 +1,179 @@
---
reviewers:
- electrocucaracha
- raelga
title: Controlando el Acceso a la API de Kubernetes
content_type: concept
---
<!-- overview -->
Esta página proporciona información sobre cómo controlar el acceso a la API de Kubernetes.
<!-- body -->
Los usuarios acceden a la [API de Kubernetes](/docs/concepts/overview/kubernetes-api/) usando `kubectl`,
bibliotecas de cliente, o haciendo peticiones REST. Usuarios y
[Kubernetes service accounts](/docs/tasks/configure-pod-container/configure-service-account/) pueden ser
autorizados para acceder a la API.
Cuando una petición llega a la API, pasa por varias etapas, están ilustradas en el
siguiente diagrama:
![Diagrama de pasos para una petición a la API de Kubernetes](/images/docs/admin/access-control-overview.svg)
## Seguridad en la capa de transporte
En un {{< glossary_tooltip term_id="cluster" text="cluster" >}} típico de Kubernetes, la API sirve peticiones en el puerto 443, protegida por TLS.
El {{< glossary_tooltip term_id="kube-apiserver" text="API Server" >}} presenta un certificado. Este certificado puede ser firmando usando
un certificado de autoridad privada (CA) o basado en una llave pública relacionada
generalmente a un CA reconocido.
Si el cluster usa un certificado de autoridad privado, se necesita copiar este certificado
CA configurado dentro de su `~/.kube/config` en el cliente, entonces se podrá
confiar en la conexión y estar seguro que no será comprometida.
El cliente puede presentar un certificado TLS de cliente en esta etapa.
## Autenticación
Una vez que se estableció la conexión TLS, las peticiones HTTP avanzan a la etapa de autenticación.
Esto se muestra en el paso 1 del diagrama.
El script de creación del cluster o el administrador del cluster puede configurar el {{< glossary_tooltip term_id="kube-apiserver" text="API Server" >}} para ejecutar
uno o mas módulos de autenticación.
Los Autenticadores están descritos con más detalle en
[Authentication](/docs/reference/access-authn-authz/authentication/).
La entrada al paso de autenticación es la petición HTTP completa, aun así, esta tipicamente
examina las cabeceras y/o el certificado del cliente.
Los modulos de autenticación incluyen certificado de cliente, contraseña, tokens planos,
tokens de inicio y JSON Web Tokens (usados para los service accounts).
Múltiples módulos de autenticación puede ser especificados, en este caso cada uno es probado secuencialmente,
hasta que uno de ellos tiene éxito.
Si la petición no puede ser autenticada, la misma es rechazada con un código HTTP 401.
Si la autenticación tiene éxito, el usuario es validado con el `username` específico, y el nombre de usuario
esta disponible para los pasos siguientes. Algunos autenticadores
también proporcionan membresías de grupo al usuario, mientras que otros
no lo hacen.
Aunque Kubernetes utiliza los nombres de usuario para tomar decisiones durante el control de acceso y para registrar las peticiones de entrada, no tiene un objeto `User` ni tampoco almacena información sobre los usuarios en la API.
## Autorización
Después de autenticar la petición como proveniente de un usuario específico, la petición debe ser autorizada. Esto se muestra en el paso 2 del diagrama.
Una petición debe incluir el nombre de usuario solicitante, la acción solicitada y el objeto afectado por la acción. La petición es autorizada si hay una política existente que declare que el usuario tiene permisos para la realizar la acción.
Por ejemplo, si el usuario Bob tiene la siguiente política, entonces puede leer pods solamente en el namespace `projectCaribou`:
```json
{
"apiVersion": "abac.authorization.kubernetes.io/v1beta1",
"kind": "Policy",
"spec": {
"user": "bob",
"namespace": "projectCaribou",
"resource": "pods",
"readonly": true
}
}
```
Si Bob hace la siguiente petición, será autorizada dado que tiene permitido leer los objetos en el namespace `projectCaribou` :
```json
{
"apiVersion": "authorization.k8s.io/v1beta1",
"kind": "SubjectAccessReview",
"spec": {
"resourceAttributes": {
"namespace": "projectCaribou",
"verb": "get",
"group": "unicorn.example.org",
"resource": "pods"
}
}
}
```
En cambio, si Bob en su petición intenta escribir (`create` o `update`) en los objetos del namespace `projectCaribou`, la petición será denegada. Del mismo modo, si Bob hace una petición para leer (`get`) objetos en otro namespace como `projectFish`, la autorización también será denegada.
Las autorizaciones en Kubernetes requieren que se usen atributos REST comunes para interactuar con el existente sistema de control de toda la organización o del proveedor cloud. Es importante usar formatos REST porque esos sistemas de control pueden interactuar con otras APIs además de la API de Kubernetes.
Kubernetes soporta múltiples módulos de autorización, como el modo ABAC, el modo RBAC y el modo Webhook. Cuando un administrador crea un cluster, se realiza la configuración de los módulos de autorización que deben ser usados con la API del server. Si más de uno módulo de autorización es configurado, Kubernetes verificada cada uno y si alguno de ellos autoriza la petición entonces la misma se ejecuta. Si todos los modules deniegan la petición, entonces la misma es denegada (Con un error HTTP con código 403).
Para leer más acerca de las autorizaciones en Kubernetes, incluyendo detalles sobre cómo crear politicas usando los módulos de autorización soportados, vea [Authorization](/docs/reference/access-authn-authz/authorization/).
## Control de Admisión
Los módulos de Control de Admisión son módulos de software que solo pueden modificar o rechazar peticiones.
Adicionalmente a los atributos disponibles en los módulos de Autorización, los de
Control de Admisión pueden acceder al contenido del objeto que esta siendo creado o modificado.
Los Controles de Admisión actúan en las peticiones que crean, modifican, borran o se conectan (proxy) a un objeto.
Cuando múltiples módulos de control de admisión son configurados, son llamados en orden.
Esto se muestra en el paso 3 del diagrama.
A diferencia de los módulos de Autorización y Autenticación, si uno de los módulos de control de admisión
rechaza la petición, entonces es inmediatamente rechazada.
Adicionalmente a rechazar objetos, los controles de admisión también permiten establecer
valores predeterminados complejos.
Los módulos de Control de Admisión disponibles están descritos en [Admission Controllers](/docs/reference/access-authn-authz/admission-controllers/).
Cuando una petición pasa todos los controles de admisión, esta es validada usando la rutinas de validación
para el objeto API correspondiente y luego es escrita en el objeto.
## Puertos e IPs del API server
La discusión previa aplica a peticiones enviadas a un puerto seguro del servidor API
(el caso típico). El servidor API puede en realidad servir en 2 puertos:
Por defecto, la API de Kubernetes entrega HTTP en 2 puertos:
1. puerto `localhost`:
- debe usarse para testeo e iniciar el sistema y para otros componentes del nodo maestro
(scheduler, controller-manager) para hablar con la API
- no se usa TLS
- el puerto predeterminado es el `8080`
- la IP por defecto es localhost, la puede cambiar con el flag `--insecure-bind-address`.
- la petición no pasa por los mecanismos de autenticación ni autorización
- peticiones controladas por los modulos de control de admisión.
- protegidas por necesidad para tener acceso al host
2. “Puerto seguro”:
- usar siempre que sea posible
- usa TLS. Se configura el certificado con el flag `--tls-cert-file` y la clave con `--tls-private-key-file`.
- el puerto predeterminado es `6443`, se cambia con el flag `--secure-port`.
- la IP por defecto es la primer interface que no es la localhost. se cambia con el flag `--bind-address`.
- peticiones controladas por los módulos de autenticación y autorización.
- peticiones controladas por los módulos de control de admisión.
## {{% heading "whatsnext" %}}
En los siguientes enlaces, encontrará mucha más documentación sobre autenticación, autorización y el control de acceso a la API:
- [Authenticating](/docs/reference/access-authn-authz/authentication/)
- [Authenticating with Bootstrap Tokens](/docs/reference/access-authn-authz/bootstrap-tokens/)
- [Admission Controllers](/docs/reference/access-authn-authz/admission-controllers/)
- [Dynamic Admission Control](/docs/reference/access-authn-authz/extensible-admission-controllers/)
- [Authorization](/docs/reference/access-authn-authz/authorization/)
- [Role Based Access Control](/docs/reference/access-authn-authz/rbac/)
- [Attribute Based Access Control](/docs/reference/access-authn-authz/abac/)
- [Node Authorization](/docs/reference/access-authn-authz/node/)
- [Webhook Authorization](/docs/reference/access-authn-authz/webhook/)
- [Certificate Signing Requests](/docs/reference/access-authn-authz/certificate-signing-requests/)
- including [CSR approval](/docs/reference/access-authn-authz/certificate-signing-requests/#approval-rejection)
and [certificate signing](/docs/reference/access-authn-authz/certificate-signing-requests/#signing)
- Service accounts
- [Developer guide](/docs/tasks/configure-pod-container/configure-service-account/)
- [Administration](/docs/reference/access-authn-authz/service-accounts-admin/)
- Como los pods pueden usar
[Secrets](/docs/concepts/configuration/secret/#service-accounts-automatically-create-and-attach-secrets-with-api-credentials)
para obtener credenciales para la API.
@@ -195,10 +195,6 @@ Multus mendukung semua [plugin referensi](https://github.com/containernetworking
Platform Nuage menggunakan _overlay_ untuk menyediakan jaringan berbasis kebijakan yang mulus antara Kubernetes Pod-Pod dan lingkungan non-Kubernetes (VM dan server _bare metal_). Model abstraksi kebijakan Nuage dirancang dengan mempertimbangkan aplikasi dan membuatnya mudah untuk mendeklarasikan kebijakan berbutir halus untuk aplikasi. Mesin analisis _real-time_ platform memungkinkan pemantauan visibilitas dan keamanan untuk aplikasi Kubernetes. Platform Nuage menggunakan _overlay_ untuk menyediakan jaringan berbasis kebijakan yang mulus antara Kubernetes Pod-Pod dan lingkungan non-Kubernetes (VM dan server _bare metal_). Model abstraksi kebijakan Nuage dirancang dengan mempertimbangkan aplikasi dan membuatnya mudah untuk mendeklarasikan kebijakan berbutir halus untuk aplikasi. Mesin analisis _real-time_ platform memungkinkan pemantauan visibilitas dan keamanan untuk aplikasi Kubernetes.
### OpenVSwitch
[OpenVSwitch](https://www.openvswitch.org/) adalah cara yang agak lebih dewasa tetapi juga rumit untuk membangun jaringan _overlay_. Ini didukung oleh beberapa "Toko Besar" untuk jaringan.
### OVN (Open Virtual Networking) ### OVN (Open Virtual Networking)
OVN adalah solusi virtualisasi jaringan opensource yang dikembangkan oleh komunitas Open vSwitch. Ini memungkinkan seseorang membuat switch logis, router logis, ACL stateful, load-balancers dll untuk membangun berbagai topologi jaringan virtual. Proyek ini memiliki plugin dan dokumentasi Kubernetes spesifik di [ovn-kubernetes](https://github.com/openvswitch/ovn-kubernetes). OVN adalah solusi virtualisasi jaringan opensource yang dikembangkan oleh komunitas Open vSwitch. Ini memungkinkan seseorang membuat switch logis, router logis, ACL stateful, load-balancers dll untuk membangun berbagai topologi jaringan virtual. Proyek ini memiliki plugin dan dokumentasi Kubernetes spesifik di [ovn-kubernetes](https://github.com/openvswitch/ovn-kubernetes).
@@ -387,7 +387,7 @@ _Value_ dan perilaku dari tipe `Service` dijelaskan sebagai berikut:
* `ClusterIP`: Mengekspos `Service` ke _range_ alamat IP di dalam klaster. Apabila kamu memilih _value_ ini * `ClusterIP`: Mengekspos `Service` ke _range_ alamat IP di dalam klaster. Apabila kamu memilih _value_ ini
`Service` yang kamu miliki hanya dapat diakses secara internal. tipe ini adalah `Service` yang kamu miliki hanya dapat diakses secara internal. tipe ini adalah
_default_ _value_ dari _ServiceType_. _default_ _value_ dari _ServiceType_.
* [`NodePort`](#nodeport): Mengekspos `Service` pada setiap IP *node* pada _port_ statis * [`NodePort`](#type-nodeport): Mengekspos `Service` pada setiap IP *node* pada _port_ statis
atau _port_ yang sama. Sebuah `Service` `ClusterIP`, yang mana `Service` `NodePort` akan di-_route_ atau _port_ yang sama. Sebuah `Service` `ClusterIP`, yang mana `Service` `NodePort` akan di-_route_
, dibuat secara otomatis. Kamu dapat mengakses `Service` dengan tipe ini, , dibuat secara otomatis. Kamu dapat mengakses `Service` dengan tipe ini,
dari luar klaster melalui `<NodeIP>:<NodePort>`. dari luar klaster melalui `<NodeIP>:<NodePort>`.
@@ -399,7 +399,7 @@ _Value_ dan perilaku dari tipe `Service` dijelaskan sebagai berikut:
catatan `CNAME` beserta _value_-nya. Tidak ada metode _proxy_ apa pun yang diaktifkan. Mekanisme ini catatan `CNAME` beserta _value_-nya. Tidak ada metode _proxy_ apa pun yang diaktifkan. Mekanisme ini
setidaknya membutuhkan `kube-dns` versi 1.7. setidaknya membutuhkan `kube-dns` versi 1.7.
### Type NodePort {#nodeport} ### Type NodePort {#type-nodeport}
Jika kamu menerapkan _value_ `NodePort` pada _field_ _type_, master Kubernetes akan mengalokasikan Jika kamu menerapkan _value_ `NodePort` pada _field_ _type_, master Kubernetes akan mengalokasikan
_port_ dari _range_ yang dispesifikasikan oleh penanda `--service-node-port-range` (secara _default_, 30000-32767) _port_ dari _range_ yang dispesifikasikan oleh penanda `--service-node-port-range` (secara _default_, 30000-32767)
@@ -243,7 +243,7 @@ Lars Kellogg-Stedman.
### Multus (a Multi Network plugin) ### Multus (a Multi Network plugin)
[Multus](https://github.com/Intel-Corp/multus-cni) is a Multi CNI plugin to support the Multi Networking feature in Kubernetes using CRD based network objects in Kubernetes. Multus is a Multi CNI plugin to support the Multi Networking feature in Kubernetes using CRD based network objects in Kubernetes.
Multus supports all [reference plugins](https://github.com/containernetworking/plugins) (eg. [Flannel](https://github.com/containernetworking/plugins/tree/master/plugins/meta/flannel), [DHCP](https://github.com/containernetworking/plugins/tree/master/plugins/ipam/dhcp), [Macvlan](https://github.com/containernetworking/plugins/tree/master/plugins/main/macvlan)) that implement the CNI specification and 3rd party plugins (eg. [Calico](https://github.com/projectcalico/cni-plugin), [Weave](https://github.com/weaveworks/weave), [Cilium](https://github.com/cilium/cilium), [Contiv](https://github.com/contiv/netplugin)). In addition to it, Multus supports [SRIOV](https://github.com/hustcat/sriov-cni), [DPDK](https://github.com/Intel-Corp/sriov-cni), [OVS-DPDK & VPP](https://github.com/intel/vhost-user-net-plugin) workloads in Kubernetes with both cloud native and NFV based applications in Kubernetes. Multus supports all [reference plugins](https://github.com/containernetworking/plugins) (eg. [Flannel](https://github.com/containernetworking/plugins/tree/master/plugins/meta/flannel), [DHCP](https://github.com/containernetworking/plugins/tree/master/plugins/ipam/dhcp), [Macvlan](https://github.com/containernetworking/plugins/tree/master/plugins/main/macvlan)) that implement the CNI specification and 3rd party plugins (eg. [Calico](https://github.com/projectcalico/cni-plugin), [Weave](https://github.com/weaveworks/weave), [Cilium](https://github.com/cilium/cilium), [Contiv](https://github.com/contiv/netplugin)). In addition to it, Multus supports [SRIOV](https://github.com/hustcat/sriov-cni), [DPDK](https://github.com/Intel-Corp/sriov-cni), [OVS-DPDK & VPP](https://github.com/intel/vhost-user-net-plugin) workloads in Kubernetes with both cloud native and NFV based applications in Kubernetes.
@@ -30,7 +30,7 @@ Kubernetesは柔軟な設定が可能で、高い拡張性を持っています
ホスティングされたKubernetesサービスやマネージドなKubernetesでは、フラグと設定ファイルが常に変更できるとは限りません。変更可能な場合でも、通常はクラスターの管理者のみが変更できます。また、それらは将来のKubernetesバージョンで変更される可能性があり、設定変更にはプロセスの再起動が必要になるかもしれません。これらの理由により、この方法は他の選択肢が無いときにのみ利用するべきです。 ホスティングされたKubernetesサービスやマネージドなKubernetesでは、フラグと設定ファイルが常に変更できるとは限りません。変更可能な場合でも、通常はクラスターの管理者のみが変更できます。また、それらは将来のKubernetesバージョンで変更される可能性があり、設定変更にはプロセスの再起動が必要になるかもしれません。これらの理由により、この方法は他の選択肢が無いときにのみ利用するべきです。
[ResourceQuota](/docs/concepts/policy/resource-quotas/)、[PodSecurityPolicy](/docs/concepts/policy/pod-security-policy/)、[NetworkPolicy](/docs/concepts/services-networking/network-policies/)、そしてロールベースアクセス制御([RBAC](/docs/reference/access-authn-authz/rbac/))といった *ビルトインポリシーAPI* は、ビルトインのKubernetes APIです。APIは通常、ホスティングされたKubernetesサービスやマネージドなKubernetesで利用されます。これらは宣言的で、Podのような他のKubernetesリソースと同じ慣例に従っています。そのため、新しいクラスターの設定は繰り返し再利用することができ、アプリケーションと同じように管理することが可能です。さらに、安定版(stable)を利用している場合、他のKubernetes APIのような[定義済みのサポートポリシー](/docs/reference/deprecation-policy/)を利用することができます。これらの理由により、この方法は、適切な用途の場合、 *設定ファイル**フラグ* よりも好まれます。 [ResourceQuota](/ja/docs/concepts/policy/resource-quotas/)、[PodSecurityPolicy](/docs/concepts/policy/pod-security-policy/)、[NetworkPolicy](/ja/docs/concepts/services-networking/network-policies/)、そしてロールベースアクセス制御([RBAC](/ja/docs/reference/access-authn-authz/rbac/))といった *ビルトインポリシーAPI* は、ビルトインのKubernetes APIです。APIは通常、ホスティングされたKubernetesサービスやマネージドなKubernetesで利用されます。これらは宣言的で、Podのような他のKubernetesリソースと同じ慣例に従っています。そのため、新しいクラスターの設定は繰り返し再利用することができ、アプリケーションと同じように管理することが可能です。さらに、安定版(stable)を利用している場合、他のKubernetes APIのような[定義済みのサポートポリシー](/docs/reference/deprecation-policy/)を利用することができます。これらの理由により、この方法は、適切な用途の場合、 *設定ファイル**フラグ* よりも好まれます。
## 拡張 ## 拡張
@@ -115,7 +115,7 @@ Kubdernetesはいくつかのビルトイン認証方式をサポートしてい
[認証](/ja/docs/reference/access-authn-authz/authentication/)は、全てのリクエストのヘッダーまたは証明書情報を、リクエストを投げたクライアントのユーザー名にマッピングします。 [認証](/ja/docs/reference/access-authn-authz/authentication/)は、全てのリクエストのヘッダーまたは証明書情報を、リクエストを投げたクライアントのユーザー名にマッピングします。
Kubernetesはいくつかのビルトイン認証方式と、それらが要件に合わない場合、[認証Webhook](/docs/reference/access-authn-authz/authentication/#webhook-token-authentication)を提供します。 Kubernetesはいくつかのビルトイン認証方式と、それらが要件に合わない場合、[認証Webhook](/ja/docs/reference/access-authn-authz/authentication/#webhook-token-authentication)を提供します。
### 認可 ### 認可
@@ -118,7 +118,7 @@ CRDオブジェクトの名前は[DNSサブドメイン名](/ja/docs/concepts/ov
通常、Kubernetes APIの各リソースは、RESTリクエストとオブジェクトの永続的なストレージを管理するためのコードが必要です。メインのKubernetes APIサーバーは *Pod**Service* のようなビルトインのリソースを処理し、またカスタムリソースも[CRD](#customresourcedefinition)を通じて同じように管理することができます。 通常、Kubernetes APIの各リソースは、RESTリクエストとオブジェクトの永続的なストレージを管理するためのコードが必要です。メインのKubernetes APIサーバーは *Pod**Service* のようなビルトインのリソースを処理し、またカスタムリソースも[CRD](#customresourcedefinition)を通じて同じように管理することができます。
[アグリゲーションレイヤー](/ja/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/)は、独自のスタンドアローンAPIサーバーを書き、デプロイすることで、カスタムリソースに特化した実装の提供を可能にします。メインのAPIサーバーが、処理したいカスタムリソースへのリクエストを委譲することで、他のクライアントからも利用できるようにします。 [アグリゲーションレイヤー](/ja/docs/concepts/extend-kubernetes/api-extension/apiserver-aggregation/)は、独自のAPIサーバーを書き、デプロイすることで、カスタムリソースに特化した実装の提供を可能にします。メインのAPIサーバーが、処理したいカスタムリソースへのリクエストを独自のAPIサーバーに委譲することで、他のクライアントからも利用できるようにします。
## カスタムリソースの追加方法を選択する ## カスタムリソースの追加方法を選択する
@@ -26,7 +26,8 @@ Kubernetes上でワークロードを稼働させている人は、しばしば
Kubernetesは自動化のために設計されています。追加の作業、設定無しに、Kubernetesのコア機能によって多数のビルトインされた自動化機能が提供されます。 Kubernetesは自動化のために設計されています。追加の作業、設定無しに、Kubernetesのコア機能によって多数のビルトインされた自動化機能が提供されます。
ワークロードのデプロイおよび稼働を自動化するためにKubernetesを使うことができます。 *さらに* Kubernetesがそれをどのように行うかの自動化も可能です。 ワークロードのデプロイおよび稼働を自動化するためにKubernetesを使うことができます。 *さらに* Kubernetesがそれをどのように行うかの自動化も可能です。
Kubernetesの{{< glossary_tooltip text="コントローラー" term_id="controller" >}}コンセプトは、Kubernetesのソースコードを修正すること無く、クラスターの振る舞いを拡張することを可能にします。
Kubernetesの{{< glossary_tooltip text="オペレーターパターン" term_id="operator-pattern" >}}コンセプトは、Kubernetesのソースコードを修正すること無く、一つ以上のカスタムリソースに{{< glossary_tooltip text="カスタムコントローラー" term_id="controller" >}}をリンクすることで、クラスターの振る舞いを拡張することを可能にします。
オペレーターはKubernetes APIのクライアントで、[Custom Resource](/ja/docs/concepts/extend-kubernetes/api-extension/custom-resources/)にとっての、コントローラーのように振る舞います。 オペレーターはKubernetes APIのクライアントで、[Custom Resource](/ja/docs/concepts/extend-kubernetes/api-extension/custom-resources/)にとっての、コントローラーのように振る舞います。
## オペレーターの例 {#example} ## オペレーターの例 {#example}
@@ -1,123 +1,98 @@
--- ---
title: 大規模クラスタの構築 title: 大規模クラスタの構築
weight: 20 weight: 20
--- ---
## サポート
At {{< param "version" >}}, Kubernetes supports clusters with up to 5000 nodes. More specifically, we support configurations that meet *all* of the following criteria: クラスターはKubernetesのエージェントが動作する(物理もしくは仮想の){{< glossary_tooltip text="ノード" term_id="node" >}}の集合で、{{< glossary_tooltip text="コントロールプレーン" term_id="control-plane" >}}によって管理されます。
Kubernetes {{< param "version" >}} では、最大5000ノードから構成されるクラスターをサポートします。
具体的には、Kubernetesは次の基準を *全て* 満たす構成に対して適用できるように設計されています。
* No more than 110 pods per node * 1ノードにつきPodが110個以上存在しない
* No more than 5000 nodes * 5000ノード以上存在しない
* No more than 150000 total pods * Podの総数が150000個以上存在しない
* No more than 300000 total containers * コンテナの総数が300000個以上存在しない
ノードを追加したり削除したりすることによって、クラスターをスケールできます。
これを行う方法は、クラスターがどのようにデプロイされたかに依存します。
## 構築 ## クラウドプロバイダーのリソースクォータ {#クォータの問題}
A cluster is a set of nodes (physical or virtual machines) running Kubernetes agents, managed by a "master" (the cluster-level control plane). クラウドプロバイダーのクォータの問題に遭遇することを避けるため、多数のノードを使ったクラスターを作成するときには次のようなことを考慮してください。
Normally the number of nodes in a cluster is controlled by the value `NUM_NODES` in the platform-specific `config-default.sh` file (for example, see [GCE's `config-default.sh`](https://releases.k8s.io/{{< param "githubbranch" >}}/cluster/gce/config-default.sh)). * 次のようなクラウドリソースの増加をリクエストする
* コンピューターインスタンス
* CPU
* ストレージボリューム
* 使用中のIPアドレス
* パケットフィルタリングのルールセット
* ロードバランサーの数
* ネットワークサブネット
* ログストリーム
* クラウドプロバイダーによる新しいインスタンスの作成に対するレート制限のため、バッチで新しいノードを立ち上げるようなクラスターのスケーリング操作を通すためには、バッチ間ですこし休止を入れます。
Simply changing that value to something very large, however, may cause the setup script to fail for many cloud providers. A GCE deployment, for example, will run in to quota issues and fail to bring the cluster up.
When setting up a large Kubernetes cluster, the following issues must be considered. ## コントロールプレーンのコンポーネント
### クォータの問題 大きなクラスターでは、十分な計算とその他のリソースを持ったコントロールプレーンが必要になります。
To avoid running into cloud provider quota issues, when creating a cluster with many nodes, consider: 特に故障ゾーンあたり1つまたは2つのコントロールプレーンインスタンスを動かす場合、最初に垂直方向にインスタンスをスケールし、垂直方向のスケーリングの効果が低下するポイントに達したら水平方向にスケールします。
* Increase the quota for things like CPU, IPs, etc. フォールトトレランスを備えるために、1つの故障ゾーンに対して最低1インスタンスを動かすべきです。
* In [GCE, for example,](https://cloud.google.com/compute/docs/resource-quotas) you'll want to increase the quota for: Kubernetesノードは、同一故障ゾーン内のコントロールプレーンエンドポイントに対して自動的にトラフィックが向かないようにします。
* CPUs しかし、クラウドプロバイダーはこれを実現するための独自の機構を持っているかもしれません。
* VM instances
* Total persistent disk reserved
* In-use IP addresses
* Firewall Rules
* Forwarding rules
* Routes
* Target pools
* Gating the setup script so that it brings up new node VMs in smaller batches with waits in between, because some cloud providers rate limit the creation of VMs.
### Etcdのストレージ 例えばマネージドなロードバランサーを使うと、故障ゾーン _A_ にあるkubeletやPodから発生したトラフィックを、同じく故障ゾーン _A_ にあるコントロールプレーンホストに対してのみ送るように設定します。もし1つのコントロールプレーンホストまたは故障ゾーン _A_ のエンドポイントがオフラインになった場合、ゾーン _A_ にあるノードについてすべてのコントロールプレーンのトラフィックはゾーンを跨いで送信されます。それぞれのゾーンで複数のコントロールプレーンホストを動作させることは、結果としてほとんどありません。
To improve performance of large clusters, we store events in a separate dedicated etcd instance.
When creating a cluster, existing salt scripts: ## etcdストレージ
* start and configure additional etcd instance 大きなクラスターの性能を向上させるために、他の専用のetcdインスタンスにイベントオブジェクトを保存できます。
* configure api-server to use it for storing events
### マスターのサイズと構成要素 クラスターを作るときに、(カスタムツールを使って)以下のようなことができます。
On GCE/Google Kubernetes Engine, and AWS, `kube-up` automatically configures the proper VM size for your master depending on the number of nodes * 追加のetcdインスタンスを起動または設定する
in your cluster. On other providers, you will need to configure it manually. For reference, the sizes we use on GCE are * イベントを保存するために{{< glossary_tooltip term_id="kube-apiserver" text="APIサーバ" >}}を設定する
* 1-5 nodes: n1-standard-1 大きなクラスターのためにetcdを設定・管理する詳細については、[Operating etcd clusters for Kubernetes](/docs/tasks/administer-cluster/configure-upgrade-etcd/)または[kubeadmを使用した高可用性etcdクラスターの作成](/ja/docs/setup/production-environment/tools/kubeadm/setup-ha-etcd-with-kubeadm/)を見てください。
* 6-10 nodes: n1-standard-2
* 11-100 nodes: n1-standard-4
* 101-250 nodes: n1-standard-8
* 251-500 nodes: n1-standard-16
* more than 500 nodes: n1-standard-32
And the sizes we use on AWS are
* 1-5 nodes: m3.medium ## アドオンのリソース
* 6-10 nodes: m3.large
* 11-100 nodes: m3.xlarge
* 101-250 nodes: m3.2xlarge
* 251-500 nodes: c4.4xlarge
* more than 500 nodes: c4.8xlarge
{{< note >}} Kubernetesの[リソース制限](/ja/docs/concepts/configuration/manage-resources-containers/)は、メモリリークの影響やPodやコンテナが他のコンポーネントに与える他の影響を最小化することに役立ちます。
On Google Kubernetes Engine, the size of the master node adjusts automatically based on the size of your cluster. For more information, see [this blog post](https://cloudplatform.googleblog.com/2017/11/Cutting-Cluster-Management-Fees-on-Google-Kubernetes-Engine.html). これらのリソース制限は、アプリケーションのワークロードに適用するのと同様に、{{< glossary_tooltip text="アドオン" term_id="addons" >}}のリソースにも適用されます。
On AWS, master node sizes are currently set at cluster startup time and do not change, even if you later scale your cluster up or down by manually removing or adding nodes or using a cluster autoscaler. 例えば、ロギングコンポーネントに対してCPUやメモリ制限を設定できます。
{{< /note >}}
### アドオンのリソース
To prevent memory leaks or other resource issues in [cluster addons](https://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons) from consuming all the resources available on a node, Kubernetes sets resource limits on addon containers to limit the CPU and Memory resources they can consume (See PR [#10653](https://pr.k8s.io/10653/files) and [#10778](https://pr.k8s.io/10778/files)).
For example:
```yaml ```yaml
...
containers: containers:
- name: fluentd-cloud-logging - name: fluentd-cloud-logging
image: k8s.gcr.io/fluentd-gcp:1.16 image: fluent/fluentd-kubernetes-daemonset:v1
resources: resources:
limits: limits:
cpu: 100m cpu: 100m
memory: 200Mi memory: 200Mi
``` ```
Except for Heapster, these limits are static and are based on data we collected from addons running on 4-node clusters (see [#10335](https://issue.k8s.io/10335#issuecomment-117861225)). The addons consume a lot more resources when running on large deployment clusters (see [#5880](http://issue.k8s.io/5880#issuecomment-113984085)). So, if a large cluster is deployed without adjusting these values, the addons may continuously get killed because they keep hitting the limits. アドオンのデフォルト制限は、アドオンを小~中規模のKubernetesクラスターで動作させたときの経験から得られたデータに基づきます。
大規模のクラスターで動作させる場合は、アドオンはデフォルト制限よりも多くのリソースを消費することが多いです。
これらの値を調整せずに大規模のクラスターをデプロイした場合、メモリー制限に達し続けるため、アドオンが継続的に停止されるかもしれません。
あるいは、CPUのタイムスライス制限により性能がでない状態で動作するかもしれません。
To avoid running into cluster addon resource issues, when creating a cluster with many nodes, consider the following: クラスターのアドオンのリソース制限に遭遇しないために、多くのノードで構成されるクラスターを構築する場合は次のことを考慮します。
* Scale memory and CPU limits for each of the following addons, if used, as you scale up the size of cluster (there is one replica of each handling the entire cluster so memory and CPU usage tends to grow proportionally with size/load on cluster): * いくつかのアドオンは垂直方向にスケールします - クラスターに1つのレプリカ、もしくは故障ゾーン全体にサービングされるものがあります。このようなアドオンでは、クラスターをスケールアウトしたときにリクエストと制限を増やす必要があります。
* [InfluxDB and Grafana](https://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/cluster-monitoring/influxdb/influxdb-grafana-controller.yaml) * 数多くのアドオンは、水平方向にスケールします - より多くのPod数を動作させることで性能を向上できます - ただし、とても大きなクラスターではCPUやメモリの制限も少し引き上げる必要があるかもしれません。VerticalPodAutoscalerは、提案されたリクエストや制限の数値を提供する `_recommender_` モードで動作可能です。
* [kubedns, dnsmasq, and sidecar](https://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/dns/kube-dns/kube-dns.yaml.in) * いくつかのアドオンは{{< glossary_tooltip text="DaemonSet" term_id="daemonset" >}}によって制御され、1ノードに1つ複製される形で動作します: 例えばノードレベルのログアグリゲーターです。水平方向にスケールするアドオンの場合と同様に、CPUやメモリ制限を少し引き上げる必要があるかもしれません。
* [Kibana](https://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/fluentd-elasticsearch/kibana-deployment.yaml)
* Scale number of replicas for the following addons, if used, along with the size of cluster (there are multiple replicas of each so increasing replicas should help handle increased load, but, since load per replica also increases slightly, also consider increasing CPU/memory limits):
* [elasticsearch](https://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/fluentd-elasticsearch/es-statefulset.yaml)
* Increase memory and CPU limits slightly for each of the following addons, if used, along with the size of cluster (there is one replica per node but CPU/memory usage increases slightly along with cluster load/size as well):
* [FluentD with ElasticSearch Plugin](https://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/fluentd-elasticsearch/fluentd-es-ds.yaml)
* [FluentD with GCP Plugin](https://releases.k8s.io/{{< param "githubbranch" >}}/cluster/addons/fluentd-gcp/fluentd-gcp-ds.yaml)
Heapster's resource limits are set dynamically based on the initial size of your cluster (see [#16185](http://issue.k8s.io/16185)
and [#22940](http://issue.k8s.io/22940)). If you find that Heapster is running
out of resources, you should adjust the formulas that compute heapster memory request (see those PRs for details).
For directions on how to detect if addon containers are hitting resource limits, see the ## {{% heading "whatsnext" %}}
[Troubleshooting section of Compute Resources](/docs/concepts/configuration/manage-resources-containers/#troubleshooting).
### 少数のノードの起動の失敗を許容する `VerticalPodAutoscaler` は、リソースのリクエストやPodの制限についての管理を手助けするためにクラスターへデプロイ可能なカスタムリソースです。
`VerticalPodAutoscaler` やクラスターで致命的なアドオンを含むクラスターコンポーネントをスケールする方法についてさらに知りたい場合は[Vertical Pod Autoscaler](https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler#readme)をご覧ください。
For various reasons (see [#18969](https://github.com/kubernetes/kubernetes/issues/18969) for more details) running [cluster autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler#readme)は、クラスターで要求されるリソース水準を満たす正確なノード数で動作できるよう、いくつかのクラウドプロバイダーと統合されています。
`kube-up.sh` with a very large `NUM_NODES` may fail due to a very small number of nodes not coming up properly.
Currently you have two choices: restart the cluster (`kube-down.sh` and then `kube-up.sh` again), or before [addon resizer](https://github.com/kubernetes/autoscaler/tree/master/addon-resizer#readme)は、クラスターのスケールが変化したときにアドオンの自動的なリサイズをお手伝いします。
running `kube-up.sh` set the environment variable `ALLOWED_NOTREADY_NODES` to whatever value you feel comfortable
with. This will allow `kube-up.sh` to succeed with fewer than `NUM_NODES` coming up. Depending on the
reason for the failure, those additional nodes may join later or the cluster may remain at a size of
`NUM_NODES - ALLOWED_NOTREADY_NODES`.
@@ -23,7 +23,7 @@ Isso permite que você reverta rapidamente uma alteração de configuração, ca
- Escreva seus arquivos de configuração usando YAML ao invés de JSON. Embora esses formatos possam ser usados alternadamente em quase todos os cenários, YAML tende a ser mais amigável. - Escreva seus arquivos de configuração usando YAML ao invés de JSON. Embora esses formatos possam ser usados alternadamente em quase todos os cenários, YAML tende a ser mais amigável.
- Agrupe objetos relacionados em um único arquivo sempre que fizer sentido. Geralmente, um arquivo é mais fácil de - Agrupe objetos relacionados em um único arquivo sempre que fizer sentido. Geralmente, um arquivo é mais fácil de
gerenciar do que vários. Veja o [guestbook-all-in-one.yaml](https://github.com/kubernetes/examples/tree/{{< param "githubbranch" >}}/guestbook/all-in-one/guestbook-all-in-one.yaml) como exemplo dessa sintaxe. gerenciar do que vários. Veja o [guestbook-all-in-one.yaml](https://github.com/kubernetes/examples/tree/master/guestbook/all-in-one/guestbook-all-in-one.yaml) como exemplo dessa sintaxe.
- Observe também que vários comandos `kubectl` podem ser chamados em um diretório. Por exemplo, você pode chamar - Observe também que vários comandos `kubectl` podem ser chamados em um diretório. Por exemplo, você pode chamar
`kubectl apply` em um diretório de arquivos de configuração. `kubectl apply` em um diretório de arquivos de configuração.
@@ -77,7 +77,7 @@ GET /swagger-2.0.0.pb-v1.gz | GET /openapi/v2 **Accept**: application/com.github
- Названия версий включают надпись `beta` (например, `v2beta3`). - Названия версий включают надпись `beta` (например, `v2beta3`).
- Код хорошо протестирован. Активация этой функциональности — безопасно. Поэтому она включена по умолчанию. - Код хорошо протестирован. Активация этой функциональности — безопасно. Поэтому она включена по умолчанию.
- Поддержка функциональности в целом не будет прекращена, хотя кое-что может измениться. - Поддержка функциональности в целом не будет прекращена, хотя кое-что может измениться.
- Схема и/или семантика объектов может стать несовместимой с более поздними бета-версиями или стабильными выпусками. Когда это случится, мы даим инструкции по миграции на следующую версию. Это обновление может включать удаление, редактирование и повторного создание API-объектов. Этот процесс может потребовать тщательного анализа. Кроме этого, это может привести к простою приложений, которые используют данную функциональность. - Схема и/или семантика объектов может стать несовместимой с более поздними бета-версиями или стабильными выпусками. Когда это случится, мы даем инструкции по миграции на следующую версию. Это обновление может включать удаление, редактирование и повторного создание API-объектов. Этот процесс может потребовать тщательного анализа. Кроме этого, это может привести к простою приложений, которые используют данную функциональность.
- Рекомендуется только для неосновного производственного использования из-за риска возникновения возможных несовместимых изменений с будущими версиями. Если у вас есть несколько кластеров, которые возможно обновить независимо, вы можете снять это ограничение. - Рекомендуется только для неосновного производственного использования из-за риска возникновения возможных несовместимых изменений с будущими версиями. Если у вас есть несколько кластеров, которые возможно обновить независимо, вы можете снять это ограничение.
- **Пожалуйста, попробуйте в действии бета-версии функциональности и поделитесь своими впечатлениями! После того, как функциональность выйдет из бета-версии, нам может быть нецелесообразно что-то дальше изменять.** - **Пожалуйста, попробуйте в действии бета-версии функциональности и поделитесь своими впечатлениями! После того, как функциональность выйдет из бета-версии, нам может быть нецелесообразно что-то дальше изменять.**
- Стабильные версии: - Стабильные версии:
+1 -1
View File
@@ -3,6 +3,6 @@
* Названия версий включают надпись "beta" (например, v2beta3). * Названия версий включают надпись "beta" (например, v2beta3).
* Код хорошо протестирован. Активация этой функциональности — безопасно. Поэтому она включена по умолчанию. * Код хорошо протестирован. Активация этой функциональности — безопасно. Поэтому она включена по умолчанию.
* Поддержка функциональности в целом не будет прекращена, хотя детали могут измениться. * Поддержка функциональности в целом не будет прекращена, хотя детали могут измениться.
* Схема и/или семантика объектов может стать несовместимой с более поздними бета-версиями или стабильными выпусками. Когда это случится, мы даим инструкции по миграции на следующую версию. Это обновление может включать удаление, редактирование и повторного создание API-объектов. Этот процесс может потребовать тщательного анализа. Кроме этого, он может привести к простою приложений, которые используют данную функциональность. * Схема и/или семантика объектов может стать несовместимой с более поздними бета-версиями или стабильными выпусками. Когда это случится, мы даем инструкции по миграции на следующую версию. Это обновление может включать удаление, редактирование и повторного создание API-объектов. Этот процесс может потребовать тщательного анализа. Кроме этого, он может привести к простою приложений, которые используют данную функциональность.
* Рекомендуется только для неосновного производственного использования из-за риска возникновения возможных несовместимых изменений с будущими версиями. Если у вас есть несколько кластеров, которые возможно обновить независимо, вы можете снять это ограничение. * Рекомендуется только для неосновного производственного использования из-за риска возникновения возможных несовместимых изменений с будущими версиями. Если у вас есть несколько кластеров, которые возможно обновить независимо, вы можете снять это ограничение.
* **Пожалуйста, попробуйте в действии бета-версии функциональности и поделитесь своими впечатлениями! После того, как функциональность выйдет из бета-версии, нам может быть нецелесообразно что-то дальше изменять.** * **Пожалуйста, попробуйте в действии бета-версии функциональности и поделитесь своими впечатлениями! После того, как функциональность выйдет из бета-версии, нам может быть нецелесообразно что-то дальше изменять.**
@@ -253,11 +253,12 @@ Pod 控制器的 `.spec.replicas` 计算“预期的” Pod 数量。
根据 Pod 对象的 `.metadata.ownerReferences` 字段来发现控制器。 根据 Pod 对象的 `.metadata.ownerReferences` 字段来发现控制器。
<!-- <!--
PDBs cannot prevent [involuntary disruptions](#voluntary-and-involuntary-disruptions) from [Involuntary disruptions](#voluntary-and-involuntary-disruptions) cannot be prevented by PDBs; however they
occurring, but they do count against the budget. do count against the budget.
--> -->
PDB 不能阻止[非自愿干扰](#voluntary-and-involuntary-disruptions)的发生,但是确实会计入
预算。 PDB 无法防止[非自愿干扰](#voluntary-and-involuntary-disruptions)
但它们确实计入预算。
<!-- <!--
Pods which are deleted or unavailable due to a rolling upgrade to an application do count Pods which are deleted or unavailable due to a rolling upgrade to an application do count
@@ -12,7 +12,7 @@ weight: 80
<!-- overview --> <!-- overview -->
{{< feature-state state="alpha" for_k8s_version="v1.22" >}} {{< feature-state state="beta" for_k8s_version="v1.23" >}}
<!-- <!--
This page provides an overview of ephemeral containers: a special type of container This page provides an overview of ephemeral containers: a special type of container
@@ -25,18 +25,6 @@ containers to inspect services rather than to build applications.
中临时运行,以便完成用户发起的操作,例如故障排查。 中临时运行,以便完成用户发起的操作,例如故障排查。
你会使用临时容器来检查服务,而不是用它来构建应用程序。 你会使用临时容器来检查服务,而不是用它来构建应用程序。
{{< warning >}}
<!--
Ephemeral containers are in alpha state and are not suitable for production
clusters. In accordance with the [Kubernetes Deprecation Policy](
/docs/reference/using-api/deprecation-policy/), this alpha feature could change
significantly in the future or be removed entirely.
-->
临时容器处于 Alpha 阶段,不适用于生产环境集群。
根据 [Kubernetes 弃用政策](/zh/docs/reference/using-api/deprecation-policy/)
此 Alpha 功能将来可能发生重大变化或被完全删除。
{{< /warning >}}
<!-- body --> <!-- body -->
<!-- <!--
@@ -465,7 +465,7 @@ Kubernetes 会在校验时强制执行此检查。
<!-- <!--
Use `activeDeadlineSeconds` on the Pod to prevent init containers from failing forever. Use `activeDeadlineSeconds` on the Pod to prevent init containers from failing forever.
The active deadline includes init containers. The active deadline includes init containers.
However it is recommended to use `activeDeadlineSeconds` if user deploy their application However it is recommended to use `activeDeadlineSeconds` only if teams deploy their application
as a Job, because `activeDeadlineSeconds` has an effect even after initContainer finished. as a Job, because `activeDeadlineSeconds` has an effect even after initContainer finished.
The Pod which is already running correctly would be killed by `activeDeadlineSeconds` if you set. The Pod which is already running correctly would be killed by `activeDeadlineSeconds` if you set.
@@ -475,7 +475,7 @@ validation error is thrown for any container sharing a name with another.
在 Pod 上使用 `activeDeadlineSeconds` 和在容器上使用 `livenessProbe` 可以避免 在 Pod 上使用 `activeDeadlineSeconds` 和在容器上使用 `livenessProbe` 可以避免
Init 容器一直重复失败。 Init 容器一直重复失败。
`activeDeadlineSeconds` 时间包含了 Init 容器启动的时间。 `activeDeadlineSeconds` 时间包含了 Init 容器启动的时间。
然而,如果用户将他们的应用程序 Job 方式部署,建议使用 `activeDeadlineSeconds` 但建议仅在团队将其应用程序部署为 Job 时才使用 `activeDeadlineSeconds`
因为 `activeDeadlineSeconds` 在 Init 容器结束后仍有效果。 因为 `activeDeadlineSeconds` 在 Init 容器结束后仍有效果。
如果你设置了 `activeDeadlineSeconds`,已经在正常运行的 Pod 会被杀死。 如果你设置了 `activeDeadlineSeconds`,已经在正常运行的 Pod 会被杀死。
@@ -22,7 +22,7 @@ For additional information on creating new content for the Kubernetes
documentation, read the [Documentation Content Guide](/docs/contribute/style/content-guide/). documentation, read the [Documentation Content Guide](/docs/contribute/style/content-guide/).
Changes to the style guide are made by SIG Docs as a group. To propose a change Changes to the style guide are made by SIG Docs as a group. To propose a change
or addition, [add it to the agenda](https://docs.google.com/document/d/1ddHwLK3kUMX1wVFIwlksjTk0MsqitBnWPe1LRa1Rx5A/edit) for an upcoming SIG Docs meeting, and attend the meeting to participate in the or addition, [add it to the agenda](https://bit.ly/sig-docs-agenda) for an upcoming SIG Docs meeting, and attend the meeting to participate in the
discussion. discussion.
--> -->
本页讨论 Kubernetes 文档的样式指南。 本页讨论 Kubernetes 文档的样式指南。
@@ -34,7 +34,7 @@ discussion.
样式指南的变更是 SIG Docs 团队集体决定。 样式指南的变更是 SIG Docs 团队集体决定。
如要提议更改或新增条目,请先将其添加到下一次 SIG Docs 例会的 如要提议更改或新增条目,请先将其添加到下一次 SIG Docs 例会的
[议程表](https://docs.google.com/document/d/1ddHwLK3kUMX1wVFIwlksjTk0MsqitBnWPe1LRa1Rx5A/edit) [议程表](https://bit.ly/sig-docs-agenda)
上,并按时参加会议讨论。 上,并按时参加会议讨论。
<!-- body --> <!-- body -->
@@ -123,7 +123,7 @@ For managing confidential data, consider using the Secret API. | For managing co
{{< table caption = "使用 Pascal 风格大小写来给出 API 对象的约定" >}} {{< table caption = "使用 Pascal 风格大小写来给出 API 对象的约定" >}}
可以 | 不可以 可以 | 不可以
:--| :----- :--| :-----
该 HorizontalPodAutoscaler 负责... | 该 HorizontalPodAutoscaler 负责... 该 HorizontalPodAutoscaler 负责... | 该 Horizontal pod autoscaler 负责...
每个 PodList 是一个 Pod 组成的列表。 | 每个 Pod List 是一个由 pods 组成的列表。 每个 PodList 是一个 Pod 组成的列表。 | 每个 Pod List 是一个由 pods 组成的列表。
该 Volume 对象包含一个 `hostPath` 字段。 | 此卷对象包含一个 hostPath 字段。 该 Volume 对象包含一个 `hostPath` 字段。 | 此卷对象包含一个 hostPath 字段。
每个 ConfigMap 对象都是某个名字空间的一部分。| 每个 configMap 对象是某个名字空间的一部分。 每个 ConfigMap 对象都是某个名字空间的一部分。| 每个 configMap 对象是某个名字空间的一部分。
@@ -1,145 +1,171 @@
--- ---
title: kube-apiserver Audit Configuration (v1) title: kube-apiserver Audit 配置 (v1)
content_type: tool-reference content_type: tool-reference
package: audit.k8s.io/v1 package: audit.k8s.io/v1
auto_generated: true auto_generated: true
--- ---
<!---
title: kube-apiserver Audit Configuration (v1)
content_type: tool-reference
package: audit.k8s.io/v1
auto_generated: true
-->
<!--
## Resource Types ## Resource Types
-->
## 资源类型 {#resource-types}
- [Event](#audit-k8s-io-v1-Event) - [Event](#audit-k8s-io-v1-Event)
- [EventList](#audit-k8s-io-v1-EventList) - [EventList](#audit-k8s-io-v1-EventList)
- [Policy](#audit-k8s-io-v1-Policy) - [Policy](#audit-k8s-io-v1-Policy)
- [PolicyList](#audit-k8s-io-v1-PolicyList) - [PolicyList](#audit-k8s-io-v1-PolicyList)
## `Event` {#audit-k8s-io-v1-Event} ## `Event` {#audit-k8s-io-v1-Event}
<!--
**Appears in:** **Appears in:**
-->
**出现在:**
- [EventList](#audit-k8s-io-v1-EventList) - [EventList](#audit-k8s-io-v1-EventList)
<!--
Event captures all the information that can be included in an API audit log. Event captures all the information that can be included in an API audit log.
-->
Event 结构包含可出现在 API 审计日志中的所有信息。
<table class="table"> <table class="table">
<thead><tr><th width="30%">Field</th><th>Description</th></tr></thead> <thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
<tbody> <tbody>
<tr><td><code>apiVersion</code><br/>string</td><td><code>audit.k8s.io/v1</code></td></tr> <tr><td><code>apiVersion</code><br/>string</td><td><code>audit.k8s.io/v1</code></td></tr>
<tr><td><code>kind</code><br/>string</td><td><code>Event</code></td></tr> <tr><td><code>kind</code><br/>string</td><td><code>Event</code></td></tr>
<tr><td><code>level</code> <B><!--[Required]-->[必需]</B><br/>
<tr><td><code>level</code> <B>[Required]</B><br/>
<a href="#audit-k8s-io-v1-Level"><code>Level</code></a> <a href="#audit-k8s-io-v1-Level"><code>Level</code></a>
</td> </td>
<td> <td>
AuditLevel at which event was generated</td> <!--AuditLevel at which event was generated-->
生成事件所对应的审计级别。
</td>
</tr> </tr>
<tr><td><code>auditID</code> <B><!--[Required]-->[必需]</B><br/>
<tr><td><code>auditID</code> <B>[Required]</B><br/>
<a href="https://godoc.org/k8s.io/apimachinery/pkg/types#UID"><code>k8s.io/apimachinery/pkg/types.UID</code></a> <a href="https://godoc.org/k8s.io/apimachinery/pkg/types#UID"><code>k8s.io/apimachinery/pkg/types.UID</code></a>
</td> </td>
<td> <td>
Unique audit ID, generated for each request.</td> <!--Unique audit ID, generated for each request.-->
为每个请求所生成的唯一审计 ID。
</td>
</tr> </tr>
<tr><td><code>stage</code> <B><!--[Required]-->[必需]</B><br/>
<tr><td><code>stage</code> <B>[Required]</B><br/>
<a href="#audit-k8s-io-v1-Stage"><code>Stage</code></a> <a href="#audit-k8s-io-v1-Stage"><code>Stage</code></a>
</td> </td>
<td> <td>
Stage of the request handling when this event instance was generated.</td> <!--Stage of the request handling when this event instance was generated.-->
生成此事件时请求的处理阶段。
</td>
</tr> </tr>
<tr><td><code>requestURI</code> <B><!--[Required]-->[必需]</B><br/>
<tr><td><code>requestURI</code> <B>[Required]</B><br/>
<code>string</code> <code>string</code>
</td> </td>
<td> <td>
RequestURI is the request URI as sent by the client to a server.</td> <!--RequestURI is the request URI as sent by the client to a server.-->
requestURI 是客户端发送到服务器端的请求 URI。
</td>
</tr> </tr>
<tr><td><code>verb</code> <B>[Required]</B><br/> <tr><td><code>verb</code> <B><!--[Required]-->[必需]</B><br/>
<code>string</code> <code>string</code>
</td> </td>
<td> <td>
Verb is the kubernetes verb associated with the request. <!--Verb is the kubernetes verb associated with the request.
For non-resource requests, this is the lower-cased HTTP method.</td> For non-resource requests, this is the lower-cased HTTP method.-->
verb 是与请求对应的 Kubernetes 动词。对于非资源请求,此字段为 HTTP 方法的小写形式。
</td>
</tr> </tr>
<tr><td><code>user</code> <B><!--[Required]-->[必需]</B><br/>
<tr><td><code>user</code> <B>[Required]</B><br/> <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#userinfo-v1-authentication"><code>authentication/v1.UserInfo</code></a>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#userinfo-v1-authentication"><code>authentication/v1.UserInfo</code></a>
</td> </td>
<td> <td>
Authenticated user information.</td> <!--Authenticated user information.-->
关于认证用户的信息。
</td>
</tr> </tr>
<tr><td><code>impersonatedUser</code><br/> <tr><td><code>impersonatedUser</code><br/>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#userinfo-v1-authentication"><code>authentication/v1.UserInfo</code></a> <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#userinfo-v1-authentication"><code>authentication/v1.UserInfo</code></a>
</td> </td>
<td> <td>
Impersonated user information.</td> <!--Impersonated user information.-->
关于所伪装(impersonated)的用户的信息。
</td>
</tr> </tr>
<tr><td><code>sourceIPs</code><br/> <tr><td><code>sourceIPs</code><br/>
<code>[]string</code> <code>[]string</code>
</td> </td>
<td> <td>
Source IPs, from where the request originated and intermediate proxies.</td> <!--Source IPs, from where the request originated and intermediate proxies.-->
发起请求和中间代理的源 IP 地址。
</td>
</tr> </tr>
<tr><td><code>userAgent</code><br/> <tr><td><code>userAgent</code><br/>
<code>string</code> <code>string</code>
</td> </td>
<td> <td>
UserAgent records the user agent string reported by the client. <!--UserAgent records the user agent string reported by the client.
Note that the UserAgent is provided by the client, and must not be trusted.</td> Note that the UserAgent is provided by the client, and must not be trusted.-->
userAgent 中记录客户端所报告的用户代理(User Agent)字符串。
注意 userAgent 信息是由客户端提供的,一定不要信任。
</td>
</tr> </tr>
<tr><td><code>objectRef</code><br/> <tr><td><code>objectRef</code><br/>
<a href="#audit-k8s-io-v1-ObjectReference"><code>ObjectReference</code></a> <a href="#audit-k8s-io-v1-ObjectReference"><code>ObjectReference</code></a>
</td> </td>
<td> <td>
Object reference this request is targeted at. <!-- Object reference this request is targeted at.
Does not apply for List-type requests, or non-resource requests.</td> Does not apply for List-type requests, or non-resource requests.-->
此请求所指向的对象引用。对于 List 类型的请求或者非资源请求,此字段可忽略。
</td>
</tr> </tr>
<tr><td><code>responseStatus</code><br/> <tr><td><code>responseStatus</code><br/>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#status-v1-meta"><code>meta/v1.Status</code></a> <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#status-v1-meta"><code>meta/v1.Status</code></a>
</td> </td>
<td> <td>
The response status, populated even when the ResponseObject is not a Status type. <!--The response status, populated even when the ResponseObject is not a Status type.
For successful responses, this will only include the Code and StatusSuccess. For successful responses, this will only include the Code and StatusSuccess.
For non-status type error responses, this will be auto-populated with the error Message.</td> For non-status type error responses, this will be auto-populated with the error Message.-->
响应的状态,当 responseObject 不是 Status 类型时被赋值。
对于成功的请求,此字段仅包含 code 和 statusSuccess。
对于非 Status 类型的错误响应,此字段会被自动赋值为出错信息。
</td>
</tr> </tr>
<tr><td><code>requestObject</code><br/> <tr><td><code>requestObject</code><br/>
<a href="https://godoc.org/k8s.io/apimachinery/pkg/runtime#Unknown"><code>k8s.io/apimachinery/pkg/runtime.Unknown</code></a> <a href="https://godoc.org/k8s.io/apimachinery/pkg/runtime#Unknown"><code>k8s.io/apimachinery/pkg/runtime.Unknown</code></a>
</td> </td>
<td> <td>
API object from the request, in JSON format. The RequestObject is recorded as-is in the request <!--API object from the request, in JSON format. The RequestObject is recorded as-is in the request
(possibly re-encoded as JSON), prior to version conversion, defaulting, admission or (possibly re-encoded as JSON), prior to version conversion, defaulting, admission or
merging. It is an external versioned object type, and may not be a valid object on its own. merging. It is an external versioned object type, and may not be a valid object on its own.
Omitted for non-resource requests. Only logged at Request Level and higher.</td> Omitted for non-resource requests. Only logged at Request Level and higher.-->
来自请求的 API 对象,以 JSON 格式呈现。requestObject 在请求中按原样记录
(可能会采用 JSON 重新编码),之后会进入版本转换、默认值填充、准入控制以及
配置信息合并等阶段。此对象为外部版本化的对象类型,甚至其自身可能并不是一个
合法的对象。对于非资源请求,此字段被忽略。
只有当审计级别为 Request 或更高的时候才会记录。
</td>
</tr> </tr>
@@ -147,470 +173,502 @@ Omitted for non-resource requests. Only logged at Request Level and higher.</td
<a href="https://godoc.org/k8s.io/apimachinery/pkg/runtime#Unknown"><code>k8s.io/apimachinery/pkg/runtime.Unknown</code></a> <a href="https://godoc.org/k8s.io/apimachinery/pkg/runtime#Unknown"><code>k8s.io/apimachinery/pkg/runtime.Unknown</code></a>
</td> </td>
<td> <td>
API object returned in the response, in JSON. The ResponseObject is recorded after conversion <!--API object returned in the response, in JSON. The ResponseObject is recorded after conversion
to the external type, and serialized as JSON. Omitted for non-resource requests. Only logged to the external type, and serialized as JSON. Omitted for non-resource requests. Only logged
at Response Level.</td> at Response Level.-->
响应中包含的 API 对象,以 JSON 格式呈现。requestObject 是在被转换为外部类型
并序列化为 JSON 格式之后才被记录的。
对于非资源请求,此字段会被忽略。
只有审计级别为 Response 时才会记录。
</td>
</tr> </tr>
<tr><td><code>requestReceivedTimestamp</code><br/> <tr><td><code>requestReceivedTimestamp</code><br/>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#microtime-v1-meta"><code>meta/v1.MicroTime</code></a> <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#microtime-v1-meta"><code>meta/v1.MicroTime</code></a>
</td> </td>
<td> <td>
Time the request reached the apiserver.</td> <!--Time the request reached the apiserver.-->
请求到达 API 服务器时的时间。
</td>
</tr> </tr>
<tr><td><code>stageTimestamp</code><br/> <tr><td><code>stageTimestamp</code><br/>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#microtime-v1-meta"><code>meta/v1.MicroTime</code></a> <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#microtime-v1-meta"><code>meta/v1.MicroTime</code></a>
</td> </td>
<td> <td>
Time the request reached current audit stage.</td> <!--Time the request reached current audit stage.-->
请求到达当前审计阶段时的时间。
</td>
</tr> </tr>
<tr><td><code>annotations</code><br/> <tr><td><code>annotations</code><br/>
<code>map[string]string</code> <code>map[string]string</code>
</td> </td>
<td> <td>
Annotations is an unstructured key value map stored with an audit event that may be set by <!--Annotations is an unstructured key value map stored with an audit event that may be set by
plugins invoked in the request serving chain, including authentication, authorization and plugins invoked in the request serving chain, including authentication, authorization and
admission plugins. Note that these annotations are for the audit event, and do not correspond admission plugins. Note that these annotations are for the audit event, and do not correspond
to the metadata.annotations of the submitted object. Keys should uniquely identify the informing to the metadata.annotations of the submitted object. Keys should uniquely identify the informing
component to avoid name collisions (e.g. podsecuritypolicy.admission.k8s.io/policy). Values component to avoid name collisions (e.g. podsecuritypolicy.admission.k8s.io/policy). Values
should be short. Annotations are included in the Metadata level.</td> should be short. Annotations are included in the Metadata level.-->
annotations 是一个无结构的键-值映射,其中保存的是一个审计事件。
该事件可以由请求处理链路上的插件来设置,包括身份认证插件、鉴权插件以及
准入控制插件等。
注意这些注解是针对审计事件本身的,与所提交的对象中的 metadata.annotations
之间不存在对应关系。
映射中的键名应该唯一性地标识生成该事件的组件,从而避免名字上的冲突
(例如 podsecuritypolicy.admission.k8s.io/policy)。
映射中的键值应该比较简洁。
当审计级别为 Metadata 时会包含 annotations 字段。
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
## `EventList` {#audit-k8s-io-v1-EventList} ## `EventList` {#audit-k8s-io-v1-EventList}
<!--
EventList is a list of audit Events. EventList is a list of audit Events.
-->
EventList 是审计事件(Event)的列表。
<table class="table"> <table class="table">
<thead><tr><th width="30%">Field</th><th>Description</th></tr></thead> <thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
<tbody> <tbody>
<tr><td><code>apiVersion</code><br/>string</td><td><code>audit.k8s.io/v1</code></td></tr> <tr><td><code>apiVersion</code><br/>string</td><td><code>audit.k8s.io/v1</code></td></tr>
<tr><td><code>kind</code><br/>string</td><td><code>EventList</code></td></tr> <tr><td><code>kind</code><br/>string</td><td><code>EventList</code></td></tr>
<tr><td><code>metadata</code><br/> <tr><td><code>metadata</code><br/>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#listmeta-v1-meta"><code>meta/v1.ListMeta</code></a> <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#listmeta-v1-meta"><code>meta/v1.ListMeta</code></a>
</td> </td>
<td> <td>
<span class="text-muted">No description provided.</span> <span class="text-muted"><!--No description provided.-->列表结构元数据</span>
</td> </td>
</tr> </tr>
<tr><td><code>items</code> <B><!--[Required]-->[必需]</B><br/>
<tr><td><code>items</code> <B>[Required]</B><br/>
<a href="#audit-k8s-io-v1-Event"><code>[]Event</code></a> <a href="#audit-k8s-io-v1-Event"><code>[]Event</code></a>
</td> </td>
<td> <td>
<span class="text-muted">No description provided.</span> <span class="text-muted"><!--No description provided.-->事件对象列表</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
## `Policy` {#audit-k8s-io-v1-Policy} ## `Policy` {#audit-k8s-io-v1-Policy}
<!--
**Appears in:** **Appears in:**
-->
**出现在:**
- [PolicyList](#audit-k8s-io-v1-PolicyList) - [PolicyList](#audit-k8s-io-v1-PolicyList)
<!--
Policy defines the configuration of audit logging, and the rules for how different request Policy defines the configuration of audit logging, and the rules for how different request
categories are logged. categories are logged.
-->
Policy 定义的是审计日志的配置以及不同类型请求的日志记录规则。
<table class="table"> <table class="table">
<thead><tr><th width="30%">Field</th><th>Description</th></tr></thead> <thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
<tbody> <tbody>
<tr><td><code>apiVersion</code><br/>string</td><td><code>audit.k8s.io/v1</code></td></tr> <tr><td><code>apiVersion</code><br/>string</td><td><code>audit.k8s.io/v1</code></td></tr>
<tr><td><code>kind</code><br/>string</td><td><code>Policy</code></td></tr> <tr><td><code>kind</code><br/>string</td><td><code>Policy</code></td></tr>
<tr><td><code>metadata</code><br/> <tr><td><code>metadata</code><br/>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#objectmeta-v1-meta"><code>meta/v1.ObjectMeta</code></a> <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#objectmeta-v1-meta"><code>meta/v1.ObjectMeta</code></a>
</td> </td>
<td> <td>
ObjectMeta is included for interoperability with API infrastructure.Refer to the Kubernetes API documentation for the fields of the <code>metadata</code> field.</td> <!--ObjectMeta is included for interoperability with API infrastructure.Refer to the Kubernetes API documentation for the fields of the <code>metadata</code> field.-->
包含 <code>metadata</code> 字段是为了便于与 API 基础设施之间实现互操作。
参考 Kubernetes API 文档了解 <code>metadata</code> 字段的详细信息。
</td>
</tr> </tr>
<tr><td><code>rules</code> <B><!--[Required]-->[必需]</B><br/>
<tr><td><code>rules</code> <B>[Required]</B><br/>
<a href="#audit-k8s-io-v1-PolicyRule"><code>[]PolicyRule</code></a> <a href="#audit-k8s-io-v1-PolicyRule"><code>[]PolicyRule</code></a>
</td> </td>
<td> <td>
Rules specify the audit Level a request should be recorded at. <!--Rules specify the audit Level a request should be recorded at.
A request may match multiple rules, in which case the FIRST matching rule is used. A request may match multiple rules, in which case the FIRST matching rule is used.
The default audit level is None, but can be overridden by a catch-all rule at the end of the list. The default audit level is None, but can be overridden by a catch-all rule at the end of the list.
PolicyRules are strictly ordered.</td> PolicyRules are strictly ordered.-->
字段 rules 设置请求要被记录的审计级别(level)。
每个请求可能会与多条规则相匹配;发生这种状况时遵从第一条匹配规则。
默认的审计级别是 None,不过可以在列表的末尾使用一条全抓(catch-all)规则
重载其设置。
列表中的规则(PolicyRule)是严格有序的。
</td>
</tr> </tr>
<tr><td><code>omitStages</code><br/> <tr><td><code>omitStages</code><br/>
<a href="#audit-k8s-io-v1-Stage"><code>[]Stage</code></a> <a href="#audit-k8s-io-v1-Stage"><code>[]Stage</code></a>
</td> </td>
<td> <td>
OmitStages is a list of stages for which no events are created. Note that this can also <!--OmitStages is a list of stages for which no events are created. Note that this can also
be specified per rule in which case the union of both are omitted.</td> be specified per rule in which case the union of both are omitted.-->
字段 omitStages 是一个阶段(Stage)列表,其中包含无须生成事件的阶段。
注意这一选项也可以通过每条规则来设置。
审计组件最终会忽略出现在 omitStages 中阶段,也会忽略规则中的阶段。
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
## `PolicyList` {#audit-k8s-io-v1-PolicyList} ## `PolicyList` {#audit-k8s-io-v1-PolicyList}
<!--
PolicyList is a list of audit Policies. PolicyList is a list of audit Policies.
-->
PolicyList 是由审计策略(Policy)组成的列表。
<table class="table"> <table class="table">
<thead><tr><th width="30%">Field</th><th>Description</th></tr></thead> <thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
<tbody> <tbody>
<tr><td><code>apiVersion</code><br/>string</td><td><code>audit.k8s.io/v1</code></td></tr> <tr><td><code>apiVersion</code><br/>string</td><td><code>audit.k8s.io/v1</code></td></tr>
<tr><td><code>kind</code><br/>string</td><td><code>PolicyList</code></td></tr> <tr><td><code>kind</code><br/>string</td><td><code>PolicyList</code></td></tr>
<tr><td><code>metadata</code><br/> <tr><td><code>metadata</code><br/>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#listmeta-v1-meta"><code>meta/v1.ListMeta</code></a> <a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#listmeta-v1-meta"><code>meta/v1.ListMeta</code></a>
</td> </td>
<td> <td>
<span class="text-muted">No description provided.</span> <span class="text-muted"><!--No description provided.-->列表结构元数据。</span>
</td> </td>
</tr> </tr>
<tr><td><code>items</code> <B><!--[Required]-->[必需]</B><br/>
<tr><td><code>items</code> <B>[Required]</B><br/>
<a href="#audit-k8s-io-v1-Policy"><code>[]Policy</code></a> <a href="#audit-k8s-io-v1-Policy"><code>[]Policy</code></a>
</td> </td>
<td> <td>
<span class="text-muted">No description provided.</span> <span class="text-muted"><!--No description provided.-->策略(Policy)对象列表。</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
## `GroupResources` {#audit-k8s-io-v1-GroupResources} ## `GroupResources` {#audit-k8s-io-v1-GroupResources}
<!--
**Appears in:** **Appears in:**
-->
**出现在:**
- [PolicyRule](#audit-k8s-io-v1-PolicyRule) - [PolicyRule](#audit-k8s-io-v1-PolicyRule)
<!--
GroupResources represents resource kinds in an API group. GroupResources represents resource kinds in an API group.
-->
GroupResources 代表的是某 API 组中的资源类别。
<table class="table"> <table class="table">
<thead><tr><th width="30%">Field</th><th>Description</th></tr></thead> <thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
<tbody> <tbody>
<tr><td><code>group</code><br/> <tr><td><code>group</code><br/>
<code>string</code> <code>string</code>
</td> </td>
<td> <td>
Group is the name of the API group that contains the resources. <!--Group is the name of the API group that contains the resources.
The empty string represents the core API group.</td> The empty string represents the core API group.-->
字段 group 给出包含资源的 API 组的名称。
空字符串代表 <code>core</code> API 组。
</td>
</tr> </tr>
<tr><td><code>resources</code><br/> <tr><td><code>resources</code><br/>
<code>[]string</code> <code>[]string</code>
</td> </td>
<td> <td>
Resources is a list of resources this rule applies to. <!--Resources is a list of resources this rule applies to.
For example: For example:
'pods' matches pods. 'pods' matches pods.
'pods/log' matches the log subresource of pods. 'pods/log' matches the log subresource of pods.
'&lowast;' matches all resources and their subresources. '&lowast;' matches all resources and their subresources.
'pods/&lowast;' matches all subresources of pods. 'pods/&lowast;' matches all subresources of pods.
'&lowast;/scale' matches all scale subresources. '&lowast;/scale' matches all scale subresources.-->
字段 resources 是此规则所适用的资源的列表。<br/>
例如:<br/>
'pods' 匹配 Pods<br/>
'pods/log' 匹配 Pods 的 log 子资源;<br/>
'&lowast;' 匹配所有资源及其子资源;<br/>
'pods/&lowast;' 匹配 Pods 的所有子资源;<br/>
'&lowast;/scale' 匹配所有的 scale 子资源。<br/><br/>
If wildcard is present, the validation rule will ensure resources do not <!--If wildcard is present, the validation rule will ensure resources do not
overlap with each other. overlap with each other.
An empty list implies all resources and subresources in this API groups apply.</td> An empty list implies all resources and subresources in this API groups apply.-->
如果存在通配符,则合法性检查逻辑会确保 resources 中的条目不会彼此重叠。<br/>
空的列表意味着规则适用于该 API 组中的所有资源及其子资源。
</td>
</tr> </tr>
<tr><td><code>resourceNames</code><br/> <tr><td><code>resourceNames</code><br/>
<code>[]string</code> <code>[]string</code>
</td> </td>
<td> <td>
ResourceNames is a list of resource instance names that the policy matches. <!--ResourceNames is a list of resource instance names that the policy matches.
Using this field requires Resources to be specified. Using this field requires Resources to be specified.
An empty list implies that every instance of the resource is matched.</td> An empty list implies that every instance of the resource is matched.-->
字段 resourceNames 是策略将匹配的资源实例名称列表。
使用此字段时,<code>resources</code> 必须指定。
空的 resourceNames 列表意味着资源的所有实例都会匹配到此策略。
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
## `Level` {#audit-k8s-io-v1-Level} ## `Level` {#audit-k8s-io-v1-Level}
<!--
(Alias of `string`) (Alias of `string`)
-->
<code>string</code> 数据类型的别名。
<!--
**Appears in:** **Appears in:**
-->
**出现在:**
- [Event](#audit-k8s-io-v1-Event) - [Event](#audit-k8s-io-v1-Event)
- [PolicyRule](#audit-k8s-io-v1-PolicyRule) - [PolicyRule](#audit-k8s-io-v1-PolicyRule)
<!--
Level defines the amount of information logged during auditing Level defines the amount of information logged during auditing
-->
Level 定义的是审计过程中在日志内记录的信息量。
## `ObjectReference` {#audit-k8s-io-v1-ObjectReference} ## `ObjectReference` {#audit-k8s-io-v1-ObjectReference}
<!--
**Appears in:** **Appears in:**
-->
**出现在:**
- [Event](#audit-k8s-io-v1-Event) - [Event](#audit-k8s-io-v1-Event)
<!--
ObjectReference contains enough information to let you inspect or modify the referred object. ObjectReference contains enough information to let you inspect or modify the referred object.
-->
ObjectReference 包含的是用来检查或修改所引用对象时将需要的全部信息。
<table class="table"> <table class="table">
<thead><tr><th width="30%">Field</th><th>Description</th></tr></thead> <thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
<tbody> <tbody>
<tr><td><code>resource</code><br/> <tr><td><code>resource</code><br/>
<code>string</code> <code>string</code>
</td> </td>
<td> <td>
<span class="text-muted">No description provided.</span> <span class="text-muted"><!--No description provided.-->资源类别。</span>
</td> </td>
</tr> </tr>
<tr><td><code>namespace</code><br/> <tr><td><code>namespace</code><br/>
<code>string</code> <code>string</code>
</td> </td>
<td> <td>
<span class="text-muted">No description provided.</span> <span class="text-muted"><!--No description provided.-->资源对象所在名字空间。</span>
</td> </td>
</tr> </tr>
<tr><td><code>name</code><br/> <tr><td><code>name</code><br/>
<code>string</code> <code>string</code>
</td> </td>
<td> <td>
<span class="text-muted">No description provided.</span> <span class="text-muted"><!--No description provided.-->资源对象名称。</span>
</td> </td>
</tr> </tr>
<tr><td><code>uid</code><br/> <tr><td><code>uid</code><br/>
<a href="https://godoc.org/k8s.io/apimachinery/pkg/types#UID"><code>k8s.io/apimachinery/pkg/types.UID</code></a> <a href="https://godoc.org/k8s.io/apimachinery/pkg/types#UID"><code>k8s.io/apimachinery/pkg/types.UID</code></a>
</td> </td>
<td> <td>
<span class="text-muted">No description provided.</span> <span class="text-muted"><!--No description provided.-->资源对象的唯一标识(UID)。</span>
</td> </td>
</tr> </tr>
<tr><td><code>apiGroup</code><br/> <tr><td><code>apiGroup</code><br/>
<code>string</code> <code>string</code>
</td> </td>
<td> <td>
APIGroup is the name of the API group that contains the referred object. <!--APIGroup is the name of the API group that contains the referred object.
The empty string represents the core API group.</td> The empty string represents the core API group.-->
字段 apiGroup 给出包含所引用对象的 API 组的名称。
空字符串代表 <code>core</code> API 组。
</td>
</tr> </tr>
<tr><td><code>apiVersion</code><br/> <tr><td><code>apiVersion</code><br/>
<code>string</code> <code>string</code>
</td> </td>
<td> <td>
APIVersion is the version of the API group that contains the referred object.</td> <!--APIVersion is the version of the API group that contains the referred object.-->
字段 apiVersion 是包含所引用对象的 API 组的版本。
</td>
</tr> </tr>
<tr><td><code>resourceVersion</code><br/> <tr><td><code>resourceVersion</code><br/>
<code>string</code> <code>string</code>
</td> </td>
<td> <td>
<span class="text-muted">No description provided.</span> <span class="text-muted"><!--No description provided.-->资源对象自身的版本值。</span>
</td> </td>
</tr> </tr>
<tr><td><code>subresource</code><br/> <tr><td><code>subresource</code><br/>
<code>string</code> <code>string</code>
</td> </td>
<td> <td>
<span class="text-muted">No description provided.</span> <span class="text-muted"><!--No description provided.-->子资源的类别。</span>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
## `PolicyRule` {#audit-k8s-io-v1-PolicyRule} ## `PolicyRule` {#audit-k8s-io-v1-PolicyRule}
<!--
**Appears in:** **Appears in:**
-->
**出现在:**
- [Policy](#audit-k8s-io-v1-Policy) - [Policy](#audit-k8s-io-v1-Policy)
<!--
PolicyRule maps requests based off metadata to an audit Level. PolicyRule maps requests based off metadata to an audit Level.
Requests must match the rules of every field (an intersection of rules). Requests must match the rules of every field (an intersection of rules).
-->
PolicyRule 包含一个映射,基于元数据将请求映射到某审计级别。
请求必须与每个字段所定义的规则都匹配(即 rules 的交集)才被视为匹配。
<table class="table"> <table class="table">
<thead><tr><th width="30%">Field</th><th>Description</th></tr></thead> <thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
<tbody> <tbody>
<tr><td><code>level</code> <B><!--[Required]-->[必需]</B><br/>
<tr><td><code>level</code> <B>[Required]</B><br/>
<a href="#audit-k8s-io-v1-Level"><code>Level</code></a> <a href="#audit-k8s-io-v1-Level"><code>Level</code></a>
</td> </td>
<td> <td>
The Level that requests matching this rule are recorded at.</td> <!--The Level that requests matching this rule are recorded at.-->
与此规则匹配的请求所对应的日志记录级别(Level)。
</td>
</tr> </tr>
<tr><td><code>users</code><br/> <tr><td><code>users</code><br/>
<code>[]string</code> <code>[]string</code>
</td> </td>
<td> <td>
The users (by authenticated user name) this rule applies to. <!--The users (by authenticated user name) this rule applies to.
An empty list implies every user.</td> An empty list implies every user.-->
根据身份认证所确定的用户名的列表,给出此规则所适用的用户。
空列表意味着适用于所有用户。
</td>
</tr> </tr>
<tr><td><code>userGroups</code><br/> <tr><td><code>userGroups</code><br/>
<code>[]string</code> <code>[]string</code>
</td> </td>
<td> <td>
The user groups this rule applies to. A user is considered matching <!--The user groups this rule applies to. A user is considered matching
if it is a member of any of the UserGroups. if it is a member of any of the UserGroups.
An empty list implies every user group.</td> An empty list implies every user group.-->
此规则所适用的用户组的列表。如果用户是所列用户组中任一用户组的成员,则视为匹配。
空列表意味着适用于所有用户组。
</td>
</tr> </tr>
<tr><td><code>verbs</code><br/> <tr><td><code>verbs</code><br/>
<code>[]string</code> <code>[]string</code>
</td> </td>
<td> <td>
The verbs that match this rule. <!--The verbs that match this rule.
An empty list implies every verb.</td> An empty list implies every verb.-->
此规则所适用的动词(verb)列表。
空列表意味着适用于所有动词。
</td>
</tr> </tr>
<tr><td><code>resources</code><br/> <tr><td><code>resources</code><br/>
<a href="#audit-k8s-io-v1-GroupResources"><code>[]GroupResources</code></a> <a href="#audit-k8s-io-v1-GroupResources"><code>[]GroupResources</code></a>
</td> </td>
<td> <td>
Resources that this rule matches. An empty list implies all kinds in all API groups.</td> <!--Resources that this rule matches. An empty list implies all kinds in all API groups.-->
此规则所适用的资源类别列表。
空列表意味着适用于 API 组中的所有资源类别。
</td>
</tr> </tr>
<tr><td><code>namespaces</code><br/> <tr><td><code>namespaces</code><br/>
<code>[]string</code> <code>[]string</code>
</td> </td>
<td> <td>
Namespaces that this rule matches. <!--Namespaces that this rule matches.
The empty string "" matches non-namespaced resources. The empty string "" matches non-namespaced resources.
An empty list implies every namespace.</td> An empty list implies every namespace.-->
</td>
此规则所适用的名字空间列表。
空字符串("")意味着适用于非名字空间作用域的资源。
空列表意味着适用于所有名字空间。
</tr> </tr>
<tr><td><code>nonResourceURLs</code><br/> <tr><td><code>nonResourceURLs</code><br/>
<code>[]string</code> <code>[]string</code>
</td> </td>
<td> <td>
NonResourceURLs is a set of URL paths that should be audited. <!--NonResourceURLs is a set of URL paths that should be audited.
&lowast;s are allowed, but only as the full, final step in the path. &lowast;s are allowed, but only as the full, final step in the path.
Examples: Examples:
"/metrics" - Log requests for apiserver metrics "/metrics" - Log requests for apiserver metrics
"/healthz&lowast;" - Log all health checks</td> "/healthz&lowast;" - Log all health checks-->
字段 nonResourceURLs 给出一组需要被审计的 URL 路径。
允许使用 &lowast;,但只能作为路径中最后一个完整分段。<br/>
例如:<br/>
"/metrics" - 记录对 API 服务器度量值(metrics)的所有请求;<br/>
"/healthz&lowast;" - 记录所有健康检查请求。
</td>
</tr> </tr>
<tr><td><code>omitStages</code><br/> <tr><td><code>omitStages</code><br/>
<a href="#audit-k8s-io-v1-Stage"><code>[]Stage</code></a> <a href="#audit-k8s-io-v1-Stage"><code>[]Stage</code></a>
</td> </td>
<td> <td>
OmitStages is a list of stages for which no events are created. Note that this can also <!--OmitStages is a list of stages for which no events are created. Note that this can also
be specified policy wide in which case the union of both are omitted. be specified policy wide in which case the union of both are omitted.
An empty list means no restrictions will apply.</td> An empty list means no restrictions will apply.-->
字段 omitStages 是一个阶段(Stage)列表,针对所列的阶段服务器不会生成审计事件。
注意这一选项也可以在策略(Policy)级别指定。服务器审计组件会忽略
omitStages 中给出的阶段,也会忽略策略中给出的阶段。
空列表意味着不对阶段作任何限制。
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
## `Stage` {#audit-k8s-io-v1-Stage} ## `Stage` {#audit-k8s-io-v1-Stage}
<!--
(Alias of `string`) (Alias of `string`)
-->
<code>string</code> 数据类型的别名。
<!--
**Appears in:** **Appears in:**
-->
**出现在:**
- [Event](#audit-k8s-io-v1-Event) - [Event](#audit-k8s-io-v1-Event)
- [Policy](#audit-k8s-io-v1-Policy) - [Policy](#audit-k8s-io-v1-Policy)
- [PolicyRule](#audit-k8s-io-v1-PolicyRule) - [PolicyRule](#audit-k8s-io-v1-PolicyRule)
<!--
Stage defines the stages in request handling that audit events may be generated. Stage defines the stages in request handling that audit events may be generated.
-->
Stage 定义在请求处理过程中可以生成审计事件的阶段。
@@ -1,46 +1,52 @@
--- ---
title: WebhookAdmission Configuration (v1) title: WebhookAdmission 配置 (v1)
content_type: tool-reference content_type: tool-reference
package: apiserver.config.k8s.io/v1 package: apiserver.config.k8s.io/v1
auto_generated: true auto_generated: true
--- ---
<!--
title: WebhookAdmission Configuration (v1)
content_type: tool-reference
package: apiserver.config.k8s.io/v1
auto_generated: true
-->
<!--
Package v1 is the v1 version of the API. Package v1 is the v1 version of the API.
## Resource Types ## Resource Types
-->
此 API 的版本是 v1。
## 资源类型 {#resource-types}
- [WebhookAdmission](#apiserver-config-k8s-io-v1-WebhookAdmission) - [WebhookAdmission](#apiserver-config-k8s-io-v1-WebhookAdmission)
## `WebhookAdmission` {#apiserver-config-k8s-io-v1-WebhookAdmission} ## `WebhookAdmission` {#apiserver-config-k8s-io-v1-WebhookAdmission}
<!--
WebhookAdmission provides configuration for the webhook admission controller. WebhookAdmission provides configuration for the webhook admission controller.
-->
WebhookAdmission 为 Webhook 准入控制器提供配置信息。
<table class="table"> <table class="table">
<thead><tr><th width="30%">Field</th><th>Description</th></tr></thead> <thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
<tbody> <tbody>
<tr><td><code>apiVersion</code><br/>string</td><td><code>apiserver.config.k8s.io/v1</code></td></tr> <tr><td><code>apiVersion</code><br/>string</td><td><code>apiserver.config.k8s.io/v1</code></td></tr>
<tr><td><code>kind</code><br/>string</td><td><code>WebhookAdmission</code></td></tr> <tr><td><code>kind</code><br/>string</td><td><code>WebhookAdmission</code></td></tr>
<tr><td><code>kubeConfigFile</code> <B><!--[Required]-->[必需]</B><br/>
<tr><td><code>kubeConfigFile</code> <B>[Required]</B><br/>
<code>string</code> <code>string</code>
</td> </td>
<td> <td>
KubeConfigFile is the path to the kubeconfig file.</td> <!--KubeConfigFile is the path to the kubeconfig file.-->
字段 kubeConfigFile 包含指向 kubeconfig 文件的路径。
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -0,0 +1,280 @@
---
title: 客户端身份认证(Client Authentication (v1)
content_type: tool-reference
package: client.authentication.k8s.io/v1
auto_generated: true
---
<!--
title: Client Authentication (v1)
content_type: tool-reference
package: client.authentication.k8s.io/v1
auto_generated: true
-->
<!--
## Resource Types
-->
## 资源类型 {#resource-types}
- [ExecCredential](#client-authentication-k8s-io-v1-ExecCredential)
## `ExecCredential` {#client-authentication-k8s-io-v1-ExecCredential}
<!--
ExecCredential is used by exec-based plugins to communicate credentials to
HTTP transports.
-->
ExecCredential 由基于 exec 的插件使用,与 HTTP 传输组件沟通凭据信息。
<table class="table">
<thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
<tbody>
<tr><td><code>apiVersion</code><br/>string</td><td><code>client.authentication.k8s.io/v1</code></td></tr>
<tr><td><code>kind</code><br/>string</td><td><code>ExecCredential</code></td></tr>
<tr><td><code>spec</code> <B><!--[Required]-->[必需]</B><br/>
<a href="#client-authentication-k8s-io-v1-ExecCredentialSpec"><code>ExecCredentialSpec</code></a>
</td>
<td>
<!--Spec holds information passed to the plugin by the transport.-->
字段 spec 包含由 HTTP 传输组件传递给插件的信息。
</td>
</tr>
<tr><td><code>status</code><br/>
<a href="#client-authentication-k8s-io-v1-ExecCredentialStatus"><code>ExecCredentialStatus</code></a>
</td>
<td>
<!--Status is filled in by the plugin and holds the credentials that the transport
should use to contact the API.-->
字段 status 由插件填充,包含传输组件与 API 服务器连接时需要提供的凭据。
</td>
</tr>
</tbody>
</table>
## `Cluster` {#client-authentication-k8s-io-v1-Cluster}
<!--
**Appears in:**
-->
**出现在:**
- [ExecCredentialSpec](#client-authentication-k8s-io-v1-ExecCredentialSpec)
<!--
Cluster contains information to allow an exec plugin to communicate
with the kubernetes cluster being authenticated to.
To ensure that this struct contains everything someone would need to communicate
with a kubernetes cluster (just like they would via a kubeconfig), the fields
should shadow "k8s.io/client-go/tools/clientcmd/api/v1".Cluster, with the exception
of CertificateAuthority, since CA data will always be passed to the plugin as bytes.
-->
Cluster 中包含允许 exec 插件与 Kubernetes 集群进行通信身份认证时所需
的信息。
<table class="table">
<thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
<tbody>
<tr><td><code>server</code> <B><!--[Required]-->[必需]</B><br/>
<code>string</code>
</td>
<td>
<!--Server is the address of the kubernetes cluster (https://hostname:port).-->
字段 server 是 Kubernetes 集群的地址(https://hostname:port)。
</td>
</tr>
<tr><td><code>tls-server-name</code><br/>
<code>string</code>
</td>
<td>
<!--TLSServerName is passed to the server for SNI and is used in the client to
check server certificates against. If ServerName is empty, the hostname
used to contact the server is used.-->
tls-server-name 是用来提供给服务器用作 SNI 解析的,客户端以此检查服务器的证书。
如此字段为空,则使用链接服务器时使用的主机名。
</td>
</tr>
<tr><td><code>insecure-skip-tls-verify</code><br/>
<code>bool</code>
</td>
<td>
<!--InsecureSkipTLSVerify skips the validity check for the server's certificate.
This will make your HTTPS connections insecure.-->
设置此字段之后,会令客户端跳过对服务器端证书的合法性检查。
这会使得你的 HTTPS 链接不再安全。
</td>
</tr>
<tr><td><code>certificate-authority-data</code><br/>
<code>[]byte</code>
</td>
<td>
<!--CAData contains PEM-encoded certificate authority certificates.
If empty, system roots should be used.-->
此字段包含 PEM 编码的证书机构(CA)证书。
如果为空,则使用系统的根证书。
</td>
</tr>
<tr><td><code>proxy-url</code><br/>
<code>string</code>
</td>
<td>
<!--ProxyURL is the URL to the proxy to be used for all requests to this
cluster.-->
此字段用来设置向集群发送所有请求时要使用的代理服务器。
</td>
</tr>
<tr><td><code>config</code><br/>
<a href="https://godoc.org/k8s.io/apimachinery/pkg/runtime/#RawExtension"><code>k8s.io/apimachinery/pkg/runtime.RawExtension</code></a>
</td>
<td>
<!--Config holds additional config data that is specific to the exec
plugin with regards to the cluster being authenticated to.
This data is sourced from the clientcmd Cluster object's
extensions[client.authentication.k8s.io/exec] field:
-->
<p>此字段包含一些额外的、特定于 exec 插件和所连接的集群的数据,</p>
<p>此字段来自于 clientcmd 集群对象的 <code>extensions[client.authentication.k8s.io/exec]</code>
字段:</p>
<pre>
clusters:
- name: my-cluster
cluster:
...
extensions:
- name: client.authentication.k8s.io/exec # 针对每个集群 exec 配置所预留的扩展名称
extension:
audience: 06e3fbd18de8 # 任意配置信息
</pre>
<!--In some environments, the user config may be exactly the same across many clusters
(i.e. call this exec plugin) minus some details that are specific to each cluster
such as the audience. This field allows the per cluster config to be directly
specified with the cluster info. Using this field to store secret data is not
recommended as one of the prime benefits of exec plugins is that no secrets need
to be stored directly in the kubeconfig.-->
<p>在某些环境中,用户配置可能对很多集群而言都完全一样(即调用同一个 exec 插件),
只是针对不同集群会有一些细节上的差异,例如 audience。
此字段使得特定于集群的配置可以直接使用集群信息来设置。
不建议使用此字段来保存 Secret 数据,因为 exec 插件的主要优势之一是不需要在
kubeconfig 中保存 Secret 数据。
</td>
</tr>
</tbody>
</table>
## `ExecCredentialSpec` {#client-authentication-k8s-io-v1-ExecCredentialSpec}
<!--
**Appears in:**
-->
**出现在:**
- [ExecCredential](#client-authentication-k8s-io-v1-ExecCredential)
<!--
ExecCredentialSpec holds request and runtime specific information provided by
the transport.
-->
ExecCredentialSpec 保存传输组件所提供的特定于请求和运行时的信息。
<table class="table">
<thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
<tbody>
<tr><td><code>cluster</code><br/>
<a href="#client-authentication-k8s-io-v1-Cluster"><code>Cluster</code></a>
</td>
<td>
<!--Cluster contains information to allow an exec plugin to communicate with the
kubernetes cluster being authenticated to. Note that Cluster is non-nil only
when provideClusterInfo is set to true in the exec provider config (i.e.,
ExecConfig.ProvideClusterInfo).-->
此字段中包含的信息使得 exec 插件能够与要访问的 Kubernetes 集群通信。
注意,cluster 字段只有在 exec 驱动的配置中 provideClusterInfo
(即:ExecConfig.ProvideClusterInfo)被设置为 true 时才不能为空。
</td>
</tr>
<tr><td><code>interactive</code> <B><!--[Required]-->[必需]</B><br/>
<code>bool</code>
</td>
<td>
<!--Interactive declares whether stdin has been passed to this exec plugin.-->
此字段用来标明标准输出信息是否已传递给 exec 插件。
</td>
</tr>
</tbody>
</table>
## `ExecCredentialStatus` {#client-authentication-k8s-io-v1-ExecCredentialStatus}
<!--
**Appears in:**
-->
- [ExecCredential](#client-authentication-k8s-io-v1-ExecCredential)
<!--
ExecCredentialStatus holds credentials for the transport to use.
Token and ClientKeyData are sensitive fields. This data should only be
transmitted in-memory between client and exec plugin process. Exec plugin
itself should at least be protected via file permissions.
-->
<p>ExecCredentialStatus 中包含传输组件要使用的凭据。</p>
<p>字段 token 和 clientKeyData 都是敏感字段。此数据只能在
客户端与 exec 插件进程之间使用内存来传递。exec 插件本身至少
应通过文件访问许可来实施保护。</p>》
<table class="table">
<thead><tr><th width="30%"><!--Field-->字段</th><th><!--Description-->描述</th></tr></thead>
<tbody>
<tr><td><code>expirationTimestamp</code><br/>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#time-v1-meta"><code>meta/v1.Time</code></a>
</td>
<td>
<!--ExpirationTimestamp indicates a time when the provided credentials expire.-->
给出所提供的凭据到期的时间。
</td>
</tr>
<tr><td><code>token</code> <B><!--[Required]-->[必需]</B><br/>
<code>string</code>
</td>
<td>
<!--Token is a bearer token used by the client for request authentication.-->
客户端用做请求身份认证的持有者令牌。
</td>
</tr>
<tr><td><code>clientCertificateData</code> <B><!--[Required]-->[必需]</B><br/>
<code>string</code>
</td>
<td>
<!--PEM-encoded client TLS certificates (including intermediates, if any).-->
PEM 编码的客户端 TLS 证书(如果有临时证书,也会包含)。
</td>
</tr>
<tr><td><code>clientKeyData</code> <B><!--[Required]-->[必需]</B><br/>
<code>string</code>
</td>
<td>
<!--PEM-encoded private key for the above certificate.-->
与上述证书对应的、PEM 编码的私钥。
</td>
</tr>
</tbody>
</table>
@@ -147,7 +147,7 @@ Kubernetes 仅支持使用同一 cgroup 版本来管理所有控制器。
# dnf install -y grubby && \ # dnf install -y grubby && \
sudo grubby \ sudo grubby \
--update-kernel=ALL \ --update-kernel=ALL \
--args=systemd.unified_cgroup_hierarchy=1" --args="systemd.unified_cgroup_hierarchy=1"
``` ```
<!-- <!--
@@ -355,214 +355,14 @@ In each case, the credentials of the pod are used to communicate securely with t
<!-- <!--
## Accessing services running on the cluster ## Accessing services running on the cluster
The previous section was about connecting the Kubernetes API server. This section is about The previous section describes how to connect to the Kubernetes API server. For information about connecting to other services running on a Kubernetes cluster, see [Access Cluster Services.](/docs/tasks/access-application-cluster/access-cluster/)
connecting to other services running on Kubernetes cluster. In Kubernetes, the
[nodes](/docs/admin/node), [pods](/docs/user-guide/pods) and [services](/docs/user-guide/services) all have
their own IPs. In many cases, the node IPs, pod IPs, and some service IPs on a cluster will not be
routable, so they will not be reachable from a machine outside the cluster,
such as your desktop machine.
--> -->
## 访问集群中正在运行的服务 {#accessing-services-running-on-the-cluster}
上一节介绍了如何连接 Kubernetes API 服务。本节介绍如何连接到 Kubernetes ## 访问集群上运行的服务 {#accessing-services-running-on-the-cluster}
集群上运行的其他服务。
在 Kubernetes 中,[节点](/zh/docs/concepts/architecture/nodes/)、
[pods](/zh/docs/concepts/workloads/pods/) 和
[服务](/zh/docs/concepts/services-networking/service/) 都有自己的 IP。
在许多情况下,集群上的节点 IP、Pod IP 和某些服务 IP 将无法路由,
因此无法从集群外部的计算机(例如桌面计算机)访问它们。
<!-- 上一节介绍了如何连接到 Kubernetes API 服务器。
### Ways to connect 有关连接到 Kubernetes 集群上运行的其他服务的信息,请参阅[访问集群服务](/zh/docs/tasks/administer-cluster/access-cluster-services/)。
You have several options for connecting to nodes, pods and services from outside the cluster:
- Access services through public IPs.
- Use a service with type `NodePort` or `LoadBalancer` to make the service reachable outside
the cluster. See the [services](/docs/user-guide/services) and
[kubectl expose](/docs/reference/generated/kubectl/kubectl-commands/#expose) documentation.
- Depending on your cluster environment, this may only expose the service to your corporate network,
or it may expose it to the internet. Think about whether the service being exposed is secure.
Does it do its own authentication?
- Place pods behind services. To access one specific pod from a set of replicas, such as for debugging,
place a unique label on the pod and create a new service which selects this label.
- In most cases, it should not be necessary for application developer to directly access
nodes via their nodeIPs.
-->
### 连接的方法 {#ways-to-connect}
有多种方式可以从集群外部连接节点、Pod 和服务:
- 通过公共 IP 访问服务。
- 类型为 `NodePort``LoadBalancer` 的服务,集群外部可以访问。
请参阅 [服务](/zh/docs/concepts/services-networking/service/) 和
[kubectl expose](/docs/reference/generated/kubectl/kubectl-commands/#expose) 文档。
- 取决于你的集群环境,该服务可能仅暴露给你的公司网络,或者也可能暴露给
整个互联网。
请考虑公开该服务是否安全。它是否进行自己的身份验证?
- 在服务后端放置 Pod。要从一组副本中访问一个特定的 Pod,例如进行调试,
请在 Pod 上设置一个唯一的标签,然后创建一个选择此标签的新服务。
- 在大多数情况下,应用程序开发人员不应该通过其 nodeIP 直接访问节点。
<!--
- Access services, nodes, or pods using the Proxy Verb.
- Does apiserver authentication and authorization prior to accessing the remote service.
Use this if the services are not secure enough to expose to the internet, or to gain
access to ports on the node IP, or for debugging.
- Proxies may cause problems for some web applications.
- Only works for HTTP/HTTPS.
- Described [here](#manually-constructing-apiserver-proxy-urls).
-->
- 使用 proxy 动词访问服务、节点或者 Pod。
- 在访问远程服务之前进行 apiserver 身份验证和授权。
如果服务不能够安全地暴露到互联网,或者服务不能获得节点 IP 端口的
访问权限,或者是为了调试,那么请使用此选项。
- 代理可能会给一些 web 应用带来问题。
- 只适用于 HTTP/HTTPS。
- 更多详细信息在[这里](#manually-constructing-apiserver-proxy-urls)。
<!--
- Access from a node or pod in the cluster.
- Run a pod, and then connect to a shell in it using [kubectl exec](/docs/reference/generated/kubectl/kubectl-commands/#exec).
Connect to other nodes, pods, and services from that shell.
- Some clusters may allow you to ssh to a node in the cluster. From there you may be able to
access cluster services. This is a non-standard method, and will work on some clusters but
not others. Browsers and other tools may or may not be installed. Cluster DNS may not work.
-->
- 从集群中的节点或者 Pod 中访问。
- 运行一个 Pod,然后使用 [kubectl exec](/docs/reference/generated/kubectl/kubectl-commands/#exec)
来连接 Pod 里的 Shell。
然后从 Shell 中连接其它的节点、Pod 和服务。
- 有些集群可能允许你通过 SSH 连接到节点,从那你可能可以访问集群的服务。
这是一个非正式的方式,可能可以运行在个别的集群上。
浏览器和其它一些工具可能没有被安装。集群的 DNS 可能无法使用。
<!--
### Discovering builtin services
Typically, there are several services which are started on a cluster by kube-system. Get a list of these
with the `kubectl cluster-info` command:
-->
### 发现内建服务
通常来说,集群中会有 kube-system 创建的一些运行的服务。
通过 `kubectl cluster-info` 命令获得这些服务列表:
```shell
kubectl cluster-info
```
```
Kubernetes master is running at https://104.197.5.247
elasticsearch-logging is running at https://104.197.5.247/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy
kibana-logging is running at https://104.197.5.247/api/v1/namespaces/kube-system/services/kibana-logging/proxy
kube-dns is running at https://104.197.5.247/api/v1/namespaces/kube-system/services/kube-dns/proxy
grafana is running at https://104.197.5.247/api/v1/namespaces/kube-system/services/monitoring-grafana/proxy
heapster is running at https://104.197.5.247/api/v1/namespaces/kube-system/services/monitoring-heapster/proxy
```
<!--
This shows the proxy-verb URL for accessing each service.
For example, this cluster has cluster-level logging enabled (using Elasticsearch), which can be reached
at `https://104.197.5.247/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy/` if suitable credentials are passed. Logging can also be reached through a kubectl proxy, for example at:
`http://localhost:8080/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy/`.
(See [Access Clusters Using the Kubernetes API](/docs/tasks/administer-cluster/access-cluster-api/) for how to pass credentials or use kubectl proxy.)
-->
这展示了访问每个服务的 proxy-verb URL。
例如,如果集群启动了集群级别的日志(使用 Elasticsearch),并且传递合适的凭证,
那么可以通过
`https://104.197.5.247/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy/`
进行访问。日志也能通过 kubectl 代理获取,例如:
`http://localhost:8080/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy/`
(参阅[使用 Kubernetes API 访问集群](/zh/docs/tasks/administer-cluster/access-cluster-api/)
了解如何传递凭据,或者使用 kubectl proxy
<!--
#### Manually constructing apiserver proxy URLs
As mentioned above, you use the `kubectl cluster-info` command to retrieve the service's proxy URL. To create proxy URLs that include service endpoints, suffixes, and parameters, you append to the service's proxy URL:
`http://`*`kubernetes_master_address`*`/api/v1/namespaces/`*`namespace_name`*`/services/`*`service_name[:port_name]`*`/proxy`
If you haven't specified a name for your port, you don't have to specify *port_name* in the URL. You can also use the port number in place of the *port_name* for both named and unnamed ports.
By default, the API server proxies to your service using http. To use https, prefix the service name with `https:`:
`http://`*`kubernetes_master_address`*`/api/v1/namespaces/`*`namespace_name`*`/services/`*`https:service_name:[port_name]`*`/proxy`
The supported formats for the name segment of the URL are:
* `<service_name>` - proxies to the default or unnamed port using http
* `<service_name>:<port_name>` - proxies to the specified port name or port number using http
* `https:<service_name>:` - proxies to the default or unnamed port using https (note the trailing colon)
* `https:<service_name>:<port_name>` - proxies to the specified port name or port number using https
-->
#### 手动构建 apiserver 代理 URL {#manually-constructing-apiserver-proxy-urls}
如上所述,你可以使用 `kubectl cluster-info` 命令来获得服务的代理 URL。
要创建包含服务端点、后缀和参数的代理 URL,需添加到服务的代理 URL:
`http://`*`kubernetes_master_address`*`/api/v1/namespaces/`*`namespace_name`*`/services/`*`service_name[:port_name]`*`/proxy`
如果尚未为端口指定名称,则不必在 URL 中指定 *port_name*
对于已命名和未命名的端口,也可以使用端口号代替 *port_name*
默认情况下,API server 使用 HTTP 代理你的服务。
要使用 HTTPS,请在服务名称前加上 `https:`
`http://`*`kubernetes_master_address`*`/api/v1/namespaces/`*`namespace_name`*`/services/`*`https:service_name:[port_name]`*`/proxy`
URL 名称段支持的格式为:
* `<service_name>` - 使用 http 代理到默认或未命名的端口
* `<service_name>:<port_name>` - 使用 http 代理到指定的端口名称或端口号
* `https:<service_name>:` - 使用 https 代理到默认或未命名的端口(注意后面的冒号)
* `https:<service_name>:<port_name>` - 使用 https 代理到指定的端口名称或端口号
<!--
##### Examples
* To access the Elasticsearch service endpoint `_search?q=user:kimchy`, you would use: `http://104.197.5.247/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy/_search?q=user:kimchy`
* To access the Elasticsearch cluster health information `_cluster/health?pretty=true`, you would use: `https://104.197.5.247/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy/_cluster/health?pretty=true`
-->
##### 示例
* 要访问 Elasticsearch 服务端点 `_search?q=user:kimchy`,你需要使用:
`http://104.197.5.247/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy/_search?q=user:kimchy`
* 要访问 Elasticsearch 集群健康信息 `_cluster/health?pretty=true`,你需要使用:
`https://104.197.5.247/api/v1/namespaces/kube-system/services/elasticsearch-logging/proxy/_cluster/health?pretty=true`
```json
{
"cluster_name" : "kubernetes_logging",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 5,
"active_shards" : 5,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 5
}
```
<!--
### Using web browsers to access services running on the cluster
You may be able to put an apiserver proxy url into the address bar of a browser. However:
- Web browsers cannot usually pass tokens, so you may need to use basic (password) auth. Apiserver can be configured to accept basic auth,
but your cluster may not be configured to accept basic auth.
- Some web apps may not work, particularly those with client side javascript that construct urls in a
way that is unaware of the proxy path prefix.
-->
### 使用 web 浏览器访问运行在集群上的服务
你可以在浏览器地址栏中输入 apiserver 代理 URL。但是:
- Web 浏览器通常不能传递令牌,因此你可能需要使用基本(密码)身份验证。
Apiserver 可以配置为接受基本身份验证,但你的集群可能未进行配置。
- 某些 Web 应用程序可能无法运行,尤其是那些使用客户端 javascript
以不知道代理路径前缀的方式构建 URL 的应用程序。
<!-- <!--
## Requesting redirects ## Requesting redirects
@@ -46,11 +46,11 @@ Kubernetes {{< glossary_tooltip term_id="service" >}} object.
This task uses This task uses
[Services with external load balancers](/docs/tasks/access-application-cluster/create-external-load-balancer/), which [Services with external load balancers](/docs/tasks/access-application-cluster/create-external-load-balancer/), which
require a supported environment. If your environment does not support this, you can use a Service of type require a supported environment. If your environment does not support this, you can use a Service of type
[NodePort](/docs/concepts/services-networking/service/#nodeport) instead. [NodePort](/docs/concepts/services-networking/service/#type-nodeport) instead.
--> -->
本任务使用[外部负载均衡服务](/zh/docs/tasks/access-application-cluster/create-external-load-balancer/) 本任务使用[外部负载均衡服务](/zh/docs/tasks/access-application-cluster/create-external-load-balancer/)
所以需要对应的可支持此功能的环境。如果你的环境不能支持,你可以使用 所以需要对应的可支持此功能的环境。如果你的环境不能支持,你可以使用
[NodePort](/zh/docs/concepts/services-networking/service/#nodeport) [NodePort](/zh/docs/concepts/services-networking/service/#type-nodeport)
类型的服务代替。 类型的服务代替。
<!-- lessoncontent --> <!-- lessoncontent -->
@@ -107,17 +107,17 @@ Pod is returned instead of a list of items.
{{< /note >}} {{< /note >}}
<!-- <!--
## List Containers by Pod ## List Container images by Pod
The formatting can be controlled further by using the `range` operation to The formatting can be controlled further by using the `range` operation to
iterate over elements individually. iterate over elements individually.
--> -->
## 列出 Pod 中的容器 ## Pod 列出容器镜像
可以使用 `range` 操作进一步控制格式化,以单独操作每个元素。 可以使用 `range` 操作进一步控制格式化,以单独操作每个元素。
```shell ```shell
kubectl get pods --all-namespaces -o=jsonpath='{range .items[*]}{"\n"}{.metadata.name}{":\t"}{range .spec.containers[*]}{.image}{", "}{end}{end}' |\ kubectl get pods --all-namespaces -o jsonpath='{range .items[*]}{"\n"}{.metadata.name}{":\t"}{range .spec.containers[*]}{.image}{", "}{end}{end}' |\
sort sort
``` ```
@@ -132,7 +132,7 @@ following matches only Pods with labels matching `app=nginx`.
要获取匹配特定标签的 Pod,请使用 -l 参数。以下匹配仅与标签 `app=nginx` 相符的 Pod。 要获取匹配特定标签的 Pod,请使用 -l 参数。以下匹配仅与标签 `app=nginx` 相符的 Pod。
```shell ```shell
kubectl get pods --all-namespaces -o=jsonpath="{.items[*].spec.containers[*].image}" -l app=nginx kubectl get pods --all-namespaces -o jsonpath="{.items[*].spec.containers[*].image}" -l app=nginx
``` ```
<!-- <!--
@@ -387,6 +387,25 @@ You can now close the shell to your Node.
--> -->
你现在可以关闭连接到节点的 Shell。 你现在可以关闭连接到节点的 Shell。
<!--
## Mounting the same persistentVolume in two places
-->
## 在两个地方挂载相同的 persistentVolume
{{< codenew file="pods/storage/pv-duplicate.yaml" >}}
<!--
You can perform 2 volume mounts on your nginx container:
`/usr/share/nginx/html` for the static website
`/etc/nginx/nginx.conf` for the default config
-->
你可以在 nginx 容器上执行两个卷挂载:
`/usr/share/nginx/html` 用于静态网站
`/etc/nginx/nginx.conf` 作为默认配置
<!-- discussion --> <!-- discussion -->
<!-- <!--
@@ -123,9 +123,9 @@ kubectl delete secret user pass
<!-- <!--
* Learn more about [`projected`](/docs/concepts/storage/volumes/#projected) volumes. * Learn more about [`projected`](/docs/concepts/storage/volumes/#projected) volumes.
* Read the [all-in-one volume](https://github.com/kubernetes/community/blob/{{< param "githubbranch" >}}/contributors/design-proposals/node/all-in-one-volume.md) design document. * Read the [all-in-one volume](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node/all-in-one-volume.md) design document.
--> -->
* 进一步了解[`projected`](/zh/docs/concepts/storage/volumes/#projected) 卷。 * 进一步了解[`projected`](/zh/docs/concepts/storage/volumes/#projected) 卷。
* 阅读[一体卷](https://github.com/kubernetes/community/blob/{{< param "githubbranch" >}}/contributors/design-proposals/node/all-in-one-volume.md)设计文档。 * 阅读[一体卷](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node/all-in-one-volume.md)设计文档。
@@ -423,7 +423,7 @@ command line arguments to `kube-apiserver`:
* `--service-account-issuer` * `--service-account-issuer`
* `--service-account-key-file` * `--service-account-key-file`
* `--service-account-signing-key-file` * `--service-account-signing-key-file`
* `--api-audiences` * `--api-audiences` (can be omitted)
--> -->
{{< note >}} {{< note >}}
@@ -432,7 +432,7 @@ command line arguments to `kube-apiserver`:
* `--service-account-issuer` * `--service-account-issuer`
* `--service-account-key-file` * `--service-account-key-file`
* `--service-account-signing-key-file` * `--service-account-signing-key-file`
* `--api-audiences` * `--api-audiences`(可以省略)
{{< /note >}} {{< /note >}}
@@ -13,20 +13,26 @@ weight: 100
<!-- overview --> <!-- overview -->
<!-- <!--
This page shows how to create a Pod that uses a Secret to pull an image from a This page shows how to create a Pod that uses a
private Docker registry or repository. {{< glossary_tooltip text="Secret" term_id="secret" >}} to pull an image from a
private container image registry or repository.
--> -->
本文介绍如何使用 Secret 从私有的 Docker 镜像仓库或代码仓库拉取镜像来创建 Pod。 本文介绍如何使用 {{< glossary_tooltip text="Secret" term_id="secret" >}}
从私有的镜像仓库或代码仓库拉取镜像来创建 Pod。
{{% thirdparty-content single="true" %}}
## {{% heading "prerequisites" %}} ## {{% heading "prerequisites" %}}
* {{< include "task-tutorial-prereqs.md" >}} {{< version-check >}} * {{< include "task-tutorial-prereqs.md" >}}
<!-- <!--
* To do this exercise, you need a * To do this exercise, you need the `docker` command line tool, and a
[Docker ID](https://docs.docker.com/docker-id/) and password. [Docker ID](https://docs.docker.com/docker-id/) for which you know the password.
--> -->
你需要 [Docker ID](https://docs.docker.com/docker-id/) 和密码来进行本练习。
要进行此练习,你需要 `docker` 命令行工具和一个知道密码的
[Docker ID](https://docs.docker.com/docker-id/)。
<!-- steps --> <!-- steps -->
@@ -44,15 +50,18 @@ docker login
``` ```
<!-- <!--
When prompted, enter your Docker username and password. When prompted, enter your Docker ID, and then the credential you want to use (access token,
or the password for your Docker ID).
The login process creates or updates a `config.json` file that holds an authorization token. The login process creates or updates a `config.json` file that holds an authorization token. Review [how Kubernetes interprets this file](/docs/concepts/containers/images#config-json).
View the `config.json` file: View the `config.json` file:
--> -->
当出现提示时,输入 Docker 用户名和密码。 当出现提示时,输入您的 Docker ID 和登录凭证(访问令牌、
或 Docker ID 的密码)。
登录过程会创建或更新保存有授权令牌的 `config.json` 文件。 登录过程会创建或更新保存有授权令牌的 `config.json` 文件。
查看 [Kubernetes 中如何解析这个文件](/zh/docs/concepts/containers/images#config-json)。
查看 `config.json` 文件: 查看 `config.json` 文件:
@@ -125,7 +134,7 @@ You have successfully set your Docker credentials in the cluster as a Secret cal
* `<your-pword>` 是你的 Docker 密码。 * `<your-pword>` 是你的 Docker 密码。
* `<your-email>` 是你的 Docker 邮箱。 * `<your-email>` 是你的 Docker 邮箱。
这样你就成功地将集群中的 Docker 凭设置为名为 `regcred` 的 Secret。 这样你就成功地将集群中的 Docker 凭设置为名为 `regcred` 的 Secret。
<!-- <!--
## Inspecting the Secret `regcred` ## Inspecting the Secret `regcred`
@@ -161,7 +170,7 @@ The value of the `.dockerconfigjson` field is a base64 representation of your Do
To understand what is in the `.dockerconfigjson` field, convert the secret data to a To understand what is in the `.dockerconfigjson` field, convert the secret data to a
readable format: readable format:
--> -->
`.dockerconfigjson` 字段的值是 Docker 凭的 base64 表示。 `.dockerconfigjson` 字段的值是 Docker 凭的 base64 表示。
要了解 `dockerconfigjson` 字段中的内容,请将 Secret 数据转换为可读格式: 要了解 `dockerconfigjson` 字段中的内容,请将 Secret 数据转换为可读格式:
@@ -201,24 +210,27 @@ You have successfully set your Docker credentials as a Secret called `regcred` i
--> -->
注意,Secret 数据包含与本地 `~/.docker/config.json` 文件类似的授权令牌。 注意,Secret 数据包含与本地 `~/.docker/config.json` 文件类似的授权令牌。
这样你就已经成功地将 Docker 凭设置为集群中的名为 `regcred` 的 Secret。 这样你就已经成功地将 Docker 凭设置为集群中的名为 `regcred` 的 Secret。
<!-- <!--
## Create a Pod that uses your Secret ## Create a Pod that uses your Secret
Here is a configuration file for a Pod that needs access to your Docker credentials in `regcred`: Here is a manifest for an example Pod that needs access to your Docker credentials in `regcred`:
--> -->
## 创建一个使用你的 Secret 的 Pod ## 创建一个使用你的 Secret 的 Pod
下面是一个 Pod 配置文件,它需要访问 `regcred` 中的 Docker 凭据 下面是一个 Pod 配置清单示例,该示例中 Pod 需要访问你的 Docker 凭证 `regcred`
{{< codenew file="pods/private-reg-pod.yaml" >}} {{< codenew file="pods/private-reg-pod.yaml" >}}
<!-- Download the above file: --> <!--
下载上述文件: Download the above file onto your computer:
-->
将上述文件下载到你的计算机中:
```shell ```shell
wget -O my-private-reg-pod.yaml https://k8s.io/examples/pods/private-reg-pod.yaml curl -L -O my-private-reg-pod.yaml https://k8s.io/examples/pods/private-reg-pod.yaml
``` ```
<!-- <!--
@@ -250,17 +262,17 @@ kubectl get pod private-reg
## {{% heading "whatsnext" %}} ## {{% heading "whatsnext" %}}
<!-- <!--
* Learn more about [Secrets](/docs/concepts/configuration/secret/). * Learn more about [Secrets](/docs/concepts/configuration/secret/)
* or read the API reference for {{< api-reference page="config-and-storage-resources/secret-v1" >}}
* Learn more about [using a private registry](/docs/concepts/containers/images/#using-a-private-registry). * Learn more about [using a private registry](/docs/concepts/containers/images/#using-a-private-registry).
* Learn more about [adding image pull secrets to a service account](/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account).
* See [kubectl create secret docker-registry](/docs/reference/generated/kubectl/kubectl-commands/#-em-secret-docker-registry-em-). * See [kubectl create secret docker-registry](/docs/reference/generated/kubectl/kubectl-commands/#-em-secret-docker-registry-em-).
* See [Secret](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#secret-v1-core). * See the `imagePullSecrets` field within the [container definitions](/docs/reference/kubernetes-api/workload-resources/pod-v1/#containers) of a Pod
* See the `imagePullSecrets` field of [PodSpec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podspec-v1-core).
--> -->
* 进一步了解 [Secret](/zh/docs/concepts/configuration/secret/) * 进一步了解 [Secrets](/zh/docs/concepts/configuration/secret/)
* 或阅读 {{< api-reference page="config-and-storage-resources/secret-v1" >}} 的 API 参考
* 进一步了解 [使用私有仓库](/zh/docs/concepts/containers/images/#using-a-private-registry) * 进一步了解 [使用私有仓库](/zh/docs/concepts/containers/images/#using-a-private-registry)
* 参考 [kubectl create secret docker-registry](/docs/reference/generated/kubectl/kubectl-commands/#-em-secret-docker-registry-em-) * 进一步了解 [为服务账户添加拉取镜像凭证](/zh/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account)
* 参考 [Secret](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#secret-v1-core) * 查看 [kubectl 创建 docker-registry 凭证](/docs/reference/generated/kubectl/kubectl-commands/#-em-secret-docker-registry-em-)
* 参考 [PodSpec](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#podspec-v1-core) 中的 `imagePullSecrets` 字段 * 查看 Pod [容器定义](/docs/reference/kubernetes-api/workload-resources/pod-v1/#containers)中的 `imagePullSecrets` 字段
@@ -240,7 +240,7 @@ exit
--> -->
## 为 Pod 配置卷访问权限和属主变更策略 ## 为 Pod 配置卷访问权限和属主变更策略
{{< feature-state for_k8s_version="v1.20" state="beta" >}} {{< feature-state for_k8s_version="v1.23" state="stable" >}}
<!-- <!--
By default, Kubernetes recursively changes ownership and permissions for the contents of each By default, Kubernetes recursively changes ownership and permissions for the contents of each
@@ -303,7 +303,7 @@ and [`emptydir`](/docs/concepts/storage/volumes/#emptydir).
## Delegating volume permission and ownership change to CSI driver ## Delegating volume permission and ownership change to CSI driver
--> -->
## 将卷权限和所有权更改委派给 CSI 驱动程序 ## 将卷权限和所有权更改委派给 CSI 驱动程序
{{< feature-state for_k8s_version="v1.22" state="alpha" >}} {{< feature-state for_k8s_version="v1.23" state="beta" >}}
<!-- <!--
If you deploy a [Container Storage Interface (CSI)](https://github.com/container-storage-interface/spec/blob/master/spec.md) If you deploy a [Container Storage Interface (CSI)](https://github.com/container-storage-interface/spec/blob/master/spec.md)
@@ -27,7 +27,7 @@ The kubelet automatically tries to create a {{< glossary_tooltip text="mirror Po
on the Kubernetes API server for each static Pod. on the Kubernetes API server for each static Pod.
This means that the Pods running on a node are visible on the API server, This means that the Pods running on a node are visible on the API server,
but cannot be controlled from there. but cannot be controlled from there.
The Pod names will suffixed with the node hostname with a leading hyphen The Pod names will be suffixed with the node hostname with a leading hyphen.
{{< note >}} {{< note >}}
If you are running clustered Kubernetes and are using static If you are running clustered Kubernetes and are using static
@@ -48,6 +48,20 @@ Pod 名称将把以连字符开头的节点主机名作为后缀。
就可能需要考虑使用 {{< glossary_tooltip text="DaemonSet" term_id="daemonset" >}} 替代这种方式。 就可能需要考虑使用 {{< glossary_tooltip text="DaemonSet" term_id="daemonset" >}} 替代这种方式。
{{< /note >}} {{< /note >}}
<!--
The `spec` of a static Pod cannot refer to other API objects
(e.g., {{< glossary_tooltip text="ServiceAccount" term_id="service-account" >}},
{{< glossary_tooltip text="ConfigMap" term_id="configmap" >}},
{{< glossary_tooltip text="Secret" term_id="secret" >}}, etc).
-->
{{< note >}}
静态 Pod 的 `spec` 不能引用其他 API 对象
(如:{{< glossary_tooltip text="ServiceAccount" term_id="service-account" >}}、
{{< glossary_tooltip text="ConfigMap" term_id="configmap" >}}、
{{< glossary_tooltip text="Secret" term_id="secret" >}} 等)。
{{< /note >}}
## {{% heading "prerequisites" %}} ## {{% heading "prerequisites" %}}
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}} {{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
@@ -165,49 +165,49 @@ The following methods exist for installing kubectl on Linux:
### 用原生包管理工具安装 {#install-using-native-package-management} ### 用原生包管理工具安装 {#install-using-native-package-management}
{{< tabs name="kubectl_install" >}} {{< tabs name="kubectl_install" >}}
{{< tab name="Ubuntu、Debian 或 HypriotOS" codelang="bash" >}} {{% tab name="Ubuntu、Debian 或 HypriotOS" %}}
<!-- <!--
1. Update the `apt` package index and install packages needed to use the Kubernetes `apt` repository: 1. Update the `apt` package index and install packages needed to use the Kubernetes `apt` repository:
--> -->
1. 更新 `apt` 包索引,并安装使用 Kubernetes `apt` 仓库需要的包: 1. 更新 `apt` 包索引,并安装使用 Kubernetes `apt` 仓库需要的包:
```shell ```shell
sudo apt-get update sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl sudo apt-get install -y apt-transport-https ca-certificates curl
``` ```
<!--
2. Download the Google Cloud public signing key:
-->
2. 下载 Google Cloud 公开签名秘钥:
<!-- ```shell
2. Download the Google Cloud public signing key: sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
--> ```
2. 下载 Google Cloud 公开签名秘钥:
```shell <!--
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg 3. Add the Kubernetes `apt` repository:
``` -->
3. 添加 Kubernetes `apt` 仓库:
<!-- ```shell
3. Add the Kubernetes `apt` repository: echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
--> ```
3. 添加 Kubernetes `apt` 仓库:
```shell <!--
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list 4. Update `apt` package index with the new repository and install kubectl:
``` -->
4. 更新 `apt` 包索引,使之包含新的仓库并安装 kubectl:
<!-- ```shell
4. Update `apt` package index with the new repository and install kubectl: sudo apt-get update
--> sudo apt-get install -y kubectl
4. 更新 `apt` 包索引,使之包含新的仓库并安装 kubectl: ```
{{% /tab %}}
```shell {{% tab name="基于 Red Hat 的发行版" %}}
sudo apt-get update
sudo apt-get install -y kubectl
```
{{< /tab >}} ```shell
{{< tab name="基于 Red Hat 的发行版" codelang="bash" >}}
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes] [kubernetes]
name=Kubernetes name=Kubernetes
@@ -218,7 +218,9 @@ repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF EOF
sudo yum install -y kubectl sudo yum install -y kubectl
{{< /tab >}} ```
{{% /tab %}}
{{< /tabs >}} {{< /tabs >}}
<!-- <!--
+21 -6
View File
@@ -39,7 +39,7 @@ Kubernetes 文档的这一部分包含教程。每个教程展示了如何完成
* [Hello Minikube](/docs/tutorials/hello-minikube/) * [Hello Minikube](/docs/tutorials/hello-minikube/)
--> -->
## 基础知识 ## 基础知识 {#basics}
* [Kubernetes 基础知识](/zh/docs/tutorials/Kubernetes-Basics/)是一个深入的 * [Kubernetes 基础知识](/zh/docs/tutorials/Kubernetes-Basics/)是一个深入的
交互式教程,帮助您理解 Kubernetes 系统,并尝试一些基本的 Kubernetes 特性。 交互式教程,帮助您理解 Kubernetes 系统,并尝试一些基本的 Kubernetes 特性。
@@ -55,7 +55,7 @@ Kubernetes 文档的这一部分包含教程。每个教程展示了如何完成
* [Configuring Redis Using a ConfigMap](/docs/tutorials/configuration/configure-redis-using-configmap/) * [Configuring Redis Using a ConfigMap](/docs/tutorials/configuration/configure-redis-using-configmap/)
--> -->
## 配置 ## 配置 {#configuration}
* [示例:配置 Java 微服务](/zh/docs/tutorials/configuration/configure-java-microservice/) * [示例:配置 Java 微服务](/zh/docs/tutorials/configuration/configure-java-microservice/)
@@ -68,7 +68,7 @@ Kubernetes 文档的这一部分包含教程。每个教程展示了如何完成
* [Example: Deploying PHP Guestbook application with MongoDB](/docs/tutorials/stateless-application/guestbook/) * [Example: Deploying PHP Guestbook application with MongoDB](/docs/tutorials/stateless-application/guestbook/)
--> -->
## 无状态应用程序 ## 无状态应用程序 {#stateless-applications}
* [公开外部 IP 地址访问集群中的应用程序](/zh/docs/tutorials/stateless-application/expose-external-ip-address/) * [公开外部 IP 地址访问集群中的应用程序](/zh/docs/tutorials/stateless-application/expose-external-ip-address/)
@@ -86,7 +86,7 @@ Kubernetes 文档的这一部分包含教程。每个教程展示了如何完成
* [Running ZooKeeper, A CP Distributed System](/docs/tutorials/stateful-application/zookeeper/) * [Running ZooKeeper, A CP Distributed System](/docs/tutorials/stateful-application/zookeeper/)
--> -->
## 有状态应用程序 ## 有状态应用程序 {#stateful-applications}
* [StatefulSet 基础](/zh/docs/tutorials/stateful-application/basic-stateful-set/) * [StatefulSet 基础](/zh/docs/tutorials/stateful-application/basic-stateful-set/)
@@ -99,9 +99,13 @@ Kubernetes 文档的这一部分包含教程。每个教程展示了如何完成
<!-- <!--
## Clusters ## Clusters
* [AppArmor](/docs/tutorials/clusters/apparmor/)
* [seccomp](/docs/tutorials/clusters/seccomp/) * [seccomp](/docs/tutorials/clusters/seccomp/)
--> -->
## 集群 ## 集群 {#clusters}
* [AppArmor](/zh/docs/tutorials/clusters/apparmor/)
* [seccomp](/zh/docs/tutorials/clusters/seccomp/) * [seccomp](/zh/docs/tutorials/clusters/seccomp/)
@@ -110,10 +114,21 @@ Kubernetes 文档的这一部分包含教程。每个教程展示了如何完成
* [Using Source IP](/docs/tutorials/services/source-ip/) * [Using Source IP](/docs/tutorials/services/source-ip/)
--> -->
## 服务 ## 服务 {#services}
* [使用源 IP](/zh/docs/tutorials/services/source-ip/) * [使用源 IP](/zh/docs/tutorials/services/source-ip/)
<!--
## Security
* [Apply Pod Security Standards at Cluster level](/docs/tutorials/security/cluster-level-pss/)
* [Apply Pod Security Standards at Namespace level](/docs/tutorials/security/ns-level-pss/)
-->
## 安全 {#security}
* [在集群级别应用 Pod 安全标准](/zh/docs/tutorials/security/cluster-level-pss/)
* [在名字空间级别应用 Pod 安全标准](/zh/docs/tutorials/security/ns-level-pss/)
## {{% heading "whatsnext" %}} ## {{% heading "whatsnext" %}}
<!-- <!--
@@ -0,0 +1,22 @@
apiVersion: v1
kind: Pod
metadata:
name: test
spec:
containers:
- name: test
image: nginx
volumeMounts:
# 网站数据挂载
- name: config
mountPath: /usr/share/nginx/html
subPath: html
# Nginx 配置挂载
- name: config
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
volumes:
- name: config
persistentVolumeClaim:
claimName: test-nfs-claim
Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB