Skip to content

Commit c965d04

Browse files
authored
Merge pull request #33598 from TinySong/zh-update-windows-nodes
[zh] sync tasks/administer-cluster/kubeadm/*.md
2 parents b879231 + 37add1c commit c965d04

File tree

2 files changed

+179
-65
lines changed

2 files changed

+179
-65
lines changed

content/zh/docs/tasks/administer-cluster/kubeadm/adding-windows-nodes.md

Lines changed: 91 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ You can use Kubernetes to run a mixture of Linux and Windows nodes, so you can m
2525
混合使用运行于 Linux 上的 Pod 和运行于 Windows 上的 Pod。
2626
本页面展示如何将 Windows 节点注册到你的集群。
2727

28-
2928
## {{% heading "prerequisites" %}}
3029
{{< version-check >}}
3130

@@ -36,6 +35,7 @@ If you are using VXLAN/Overlay networking you must have also have [KB4489899](ht
3635
3736
* A Linux-based Kubernetes kubeadm cluster in which you have access to the control plane (see [Creating a single control-plane cluster with kubeadm](/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/)).
3837
-->
38+
3939
* 获取 [Windows Server 2019 或更高版本的授权](https://www.microsoft.com/en-us/cloud-platform/windows-server-pricing)
4040
以便配置托管 Windows 容器的 Windows 节点。
4141
如果你在使用 VXLAN/覆盖(Overlay)联网设施,则你还必须安装 [KB4489899](https://support.microsoft.com/help/4489899)
@@ -275,55 +275,12 @@ Windows 工作节点上具有提升的权限(Administrator)。
275275
{{< /note >}}
276276

277277
{{< tabs name="tab-windows-kubeadm-runtime-installation" >}}
278-
{{% tab name="Docker EE" %}}
279-
280-
<!--
281-
#### Install Docker EE
282-
283-
Install the `Containers` feature
284-
-->
285-
#### 安装 Docker EE
286-
287-
```powershell
288-
Install-WindowsFeature -Name containers
289-
```
290-
<!--
291-
Install Docker
292-
Instructions to do so are available at [Install Docker Engine - Enterprise on Windows Servers](https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=Windows-Server#install-docker).
293-
-->
294-
安装 Docker
295-
操作指南在 [Install Docker Engine - Enterprise on Windows Servers](https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=Windows-Server#install-docker)
296-
297-
<!--
298-
#### Install wins, kubelet, and kubeadm.
299-
-->
300-
#### 安装 wins、kubelet 和 kubeadm
301-
302-
```PowerShell
303-
curl.exe -LO https://raw.githubusercontent.com/kubernetes-sigs/sig-windows-tools/master/kubeadm/scripts/PrepareNode.ps1
304-
.\PrepareNode.ps1 -KubernetesVersion {{< param "fullversion" >}}
305-
```
306-
307-
<!--
308-
#### Run `kubeadm` to join the node
309278

310-
Use the command that was given to you when you ran `kubeadm init` on a control plane host.
311-
If you no longer have this command, or the token has expired, you can run `kubeadm token create -print-join-command`
312-
(on a control plane host) to generate a new token and join command.
313-
-->
314-
#### 运行 `kubeadm` 添加节点
315-
316-
当你在控制面主机上运行 `kubeadm init` 时,输出了一个命令。现在运行这个命令。
317-
如果你找不到这个命令,或者命令中对应的令牌已经过期,你可以(在一个控制面主机上)运行
318-
`kubeadm token create --print-join-command` 来生成新的令牌和 join 命令。
319-
320-
{{% /tab %}}
321279
{{% tab name="CRI-containerD" %}}
322280

323281
<!--
324282
#### Install containerD
325283
-->
326-
327284
#### 安装 containerD
328285

329286
```powershell
@@ -335,16 +292,12 @@ curl.exe -LO https://github.com/kubernetes-sigs/sig-windows-tools/releases/lates
335292
<!--
336293
To install a specific version of containerD specify the version with -ContainerDVersion.
337294
-->
338-
要安装特定版本的 containerD,使用参数 -ContainerDVersion指定版本
295+
要安装特定版本的 containerD,使用参数 -ContainerDVersion 指定版本
339296

340297
```powershell
341298
# Example
342299
.\Install-Containerd.ps1 -ContainerDVersion 1.4.1
343300
```
344-
345-
{{< /note >}}
346-
347-
{{< note >}}
348301
<!--
349302
If you're using a different interface rather than Ethernet (i.e. "Ethernet0 2") on the Windows nodes, specify the name with `-netAdapterName`.
350303
-->
@@ -360,12 +313,18 @@ If you're using a different interface rather than Ethernet (i.e. "Ethernet0 2")
360313
<!--
361314
#### Install wins, kubelet, and kubeadm
362315
-->
363-
#### 安装 winskubelet 和 kubeadm
316+
#### 安装 winskubelet 和 kubeadm
364317

365318
```PowerShell
366319
curl.exe -LO https://raw.githubusercontent.com/kubernetes-sigs/sig-windows-tools/master/kubeadm/scripts/PrepareNode.ps1
367320
.\PrepareNode.ps1 -KubernetesVersion {{< param "fullversion" >}} -ContainerRuntime containerD
368321
```
322+
<!--
323+
Install `crictl` from the [cri-tools project](https://github.com/kubernetes-sigs/cri-tools)
324+
which is required so that kubeadm can talk to the CRI endpoint.
325+
-->
326+
[cri-tools](https://github.com/kubernetes-sigs/cri-tools) 项目安装 `crtctl`
327+
`crictl` 是必需的,kubeadm 使用它与 CRI 端点通信。
369328

370329
<!--
371330
#### Run `kubeadm` to join the node
@@ -376,14 +335,92 @@ If you no longer have this command, or the token has expired, you can run `kubea
376335
-->
377336
#### 运行 `kubeadm` 添加节点
378337

379-
使用当你在控制面主机上运行 `kubeadm init` 时得到的命令。
380-
如果你找不到这个命令,或者命令中对应的令牌已经过期,你可以(在一个控制面主机上)运行
381-
`kubeadm token create --print-join-command` 来生成新的令牌和 join 命令。
338+
使用当你在控制面主机上运行 `kubeadm init` 时得到的命令。
339+
如果你找不到这个命令,或者命令中对应的令牌已经过期,你可以(在一个控制面主机上)运行
340+
`kubeadm token create --print-join-command` 来生成新的令牌和 join 命令。
341+
342+
343+
{{% /tab %}}
344+
345+
346+
{{% tab name="Docker Engine" %}}
382347

348+
<!--
349+
#### Install Docker Engine
350+
351+
Install the `Containers` feature
352+
-->
353+
354+
#### 安装 Docker Engine
355+
356+
安装 `Containers` 功能特性
357+
358+
```powershell
359+
Install-WindowsFeature -Name containers
360+
```
361+
362+
<!--
363+
Install Docker
364+
Instructions to do so are available at [Install Docker Engine - Enterprise on Windows Servers](https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=Windows-Server#install-docker).
365+
-->
366+
367+
安装 Docker
368+
369+
操作指南在
370+
[Install Docker Engine - Enterprise on Windows Servers](https://docs.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=Windows-Server#install-docker)
371+
372+
<!--
373+
[Install cri-dockerd](https://github.com/Mirantis/cri-dockerd) which is required so that the kubelet
374+
can communicate with Docker on a CRI compatible endpoint.
375+
-->
376+
377+
[安装 cri-dockerd](https://github.com/Mirantis/cri-dockerd)。kubelet 可以通过 cri-dockerd
378+
在 CRI 兼容的节点上与 Docker 通信。
379+
383380
{{< note >}}
384-
If using **CRI-containerD** add `--cri-socket "npipe:////./pipe/containerd-containerd"` to the kubeadm call
381+
<!--
382+
Docker Engine does not implement the [CRI](/docs/concepts/architecture/cri/)
383+
which is a requirement for a container runtime to work with Kubernetes.
384+
For that reason, an additional service [cri-dockerd](https://github.com/Mirantis/cri-dockerd)
385+
has to be installed. cri-dockerd is a project based on the legacy built-in
386+
Docker Engine support that was [removed](/dockershim) from the kubelet in version 1.24.
387+
-->
388+
Docker Engine 没有实现 [CRI](/zh/docs/concepts/architecture/cri/)
389+
而 CRI 是容器运行时能够与 Kubernetes 一起工作的要求。
390+
出于这个原因,必须安装一个额外的服务 [cri-dockerd](https://github.com/Mirantis/cri-dockerd)
391+
cri-dockerd 是一个基于原来的内置 Docker Engine 支持的项目,
392+
而这一支持在 1.24 版本的 kubelet 中[已被移除](/zh/dockershim)
385393
{{< /note >}}
386394

395+
<!--
396+
Install `crictl` from the [cri-tools project](https://github.com/kubernetes-sigs/cri-tools)
397+
which is required so that kubeadm can talk to the CRI endpoint.
398+
-->
399+
[cri-tools](https://github.com/kubernetes-sigs/cri-tools) 项目安装 `crictl`
400+
kubeadm 需要 `crictl` 才能与 CRI 端点通信。
401+
402+
<!--
403+
#### Install wins, kubelet, and kubeadm.
404+
-->
405+
#### 安装 wins、kubelet 和 kubeadm
406+
407+
```PowerShell
408+
curl.exe -LO https://raw.githubusercontent.com/kubernetes-sigs/sig-windows-tools/master/kubeadm/scripts/PrepareNode.ps1
409+
.\PrepareNode.ps1 -KubernetesVersion {{< param "fullversion" >}}
410+
```
411+
<!--
412+
# ### Run `kubeadm` to join the node
413+
414+
Use the command that was given to you when you ran `kubeadm init` on a control plane host.
415+
If you no longer have this command, or the token has expired, you can run `kubeadm token create -print-join-command`
416+
(on a control plane host) to generate a new token and join command.
417+
-->
418+
#### 运行 `kubeadm` 添加节点
419+
420+
当你在控制面主机上运行 `kubeadm init` 时,输出了一个命令。现在运行这个命令。
421+
如果你找不到这个命令,或者命令中对应的令牌已经过期,你可以(在一个控制面主机上)运行
422+
`kubeadm token create --print-join-command` 来生成新的令牌和 join 命令。
423+
387424
{{% /tab %}}
388425
{{< /tabs >}}
389426

content/zh/docs/tasks/administer-cluster/kubeadm/kubeadm-certs.md

Lines changed: 88 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ weight: 10
1616
{{< feature-state for_k8s_version="v1.15" state="stable" >}}
1717

1818
<!--
19-
Client certificates generated by [kubeadm](/docs/reference/setup-tools/kubeadm/) expire after 1 year. This page explains how to manage certificate renewals with kubeadm.
19+
Client certificates generated by [kubeadm](/docs/reference/setup-tools/kubeadm/) expire after 1 year.
20+
This page explains how to manage certificate renewals with kubeadm. It also covers other tasks related
21+
to kubeadm certificate management.
22+
2023
-->
2124
[kubeadm](/zh/docs/reference/setup-tools/kubeadm/) 生成的客户端证书在 1 年后到期。
22-
本页说明如何使用 kubeadm 管理证书续订。
25+
本页说明如何使用 kubeadm 管理证书续订,同时也涵盖其他与 kubeadm 证书管理相关的说明
2326

2427
## {{% heading "prerequisites" %}}
2528

@@ -253,7 +256,7 @@ the Pod and the certificate renewal for the component can complete.
253256
所以 kubectl 不能用来删除或重启他们。
254257
要重启静态 Pod 你可以临时将清单文件从 `/etc/kubernetes/manifests/` 移除并等待 20 秒
255258
(参考 [KubeletConfiguration 结构](/docs/reference/config-api/kubelet-config.v1beta1/) 中的`fileCheckFrequency` 值)。
256-
如果 Pod 不在清单目录里,kubelet将会终止它
259+
如果 Pod 不在清单目录里,kubelet 将会终止它
257260
在另一个 `fileCheckFrequency` 周期之后你可以将文件移回去,为了组件可以完成 kubelet 将重新创建 Pod 和证书更新。
258261

259262
<!--
@@ -312,27 +315,24 @@ These are advanced topics for users who need to integrate their organization's c
312315
### Set up a signer
313316

314317
The Kubernetes Certificate Authority does not work out of the box.
315-
You can configure an external signer such as [cert-manager](https://cert-manager.io/docs/configuration/ca/), or you can use the build-in signer.
318+
You can configure an external signer such as [cert-manager](https://cert-manager.io/docs/configuration/ca/), or you can use the built-in signer.
316319
The built-in signer is part of [`kube-controller-manager`](/docs/reference/command-line-tools-reference/kube-controller-manager/).
317320
To activate the build-in signer, you must pass the `--cluster-signing-cert-file` and `--cluster-signing-key-file` flags.
318321
-->
319322

320323
### 设置一个签名者(Signer)
321324

322-
Kubernetes 证书颁发机构不是开箱即用。
323-
你可以配置外部签名者,例如
324-
[cert-manager](https://cert-manager.io/docs/configuration/ca/),
325+
Kubernetes 证书颁发机构不是开箱即用。你可以配置外部签名者,例如 [cert-manager](https://cert-manager.io/docs/configuration/ca/),
325326
也可以使用内置签名者。
326327
内置签名者是
327-
[`kube-controller-manager`](/zh/docs/reference/command-line-tools-reference/kube-controller-manager/)
328-
的一部分。
328+
[`kube-controller-manager`](/zh/docs/reference/command-line-tools-reference/kube-controller-manager/) 的一部分。
329329
要激活内置签名者,请传递 `--cluster-signing-cert-file` 和 `--cluster-signing-key-file` 参数。
330330

331331
<!--
332-
If you're creating a new cluster, you can use a kubeadm [configuration file](https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3):
332+
If you're creating a new cluster, you can use a kubeadm [configuration file](https://pkg.go.dev/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3):
333333
-->
334334
如果你正在创建一个新的集群,你可以使用 kubeadm 的
335-
[配置文件](/docs/reference/config-api/kubeadm-config.v1beta3/)。
335+
[配置文件](/zh/docs/reference/config-api/kubeadm-config.v1beta3/)。
336336

337337
```yaml
338338
apiVersion: kubeadm.k8s.io/v1beta3
@@ -570,3 +570,80 @@ CSRs requesting serving certificates for any IP or domain name.
570570
只有完成彻底的检查,才有可能避免有恶意的、能够访问 kubelet 客户端证书的第三方
571571
为任何 IP 或域名请求服务证书。
572572

573+
<!--
574+
## Generating kubeconfig files for additional users {#kubeconfig-additional-users}
575+
-->
576+
## 为其他用户生成 kubeconfig 文件 {#kubeconfig-additional-users}
577+
578+
<!--
579+
During cluster creation, kubeadm signs the certificate in the `admin.conf` to have
580+
`Subject: O = system:masters, CN = kubernetes-admin`.
581+
[`system:masters`](/docs/reference/access-authn-authz/rbac/#user-facing-roles)
582+
is a break-glass, super user group that bypasses the authorization layer (e.g. RBAC).
583+
Sharing the `admin.conf` with additional users is **not recommended**!
584+
-->
585+
在集群创建过程中,kubeadm 对 `admin.conf` 中的证书进行签名时,将其配置为
586+
`Subject: O = system:masters, CN = kubernetes-admin`。
587+
[`system:masters`](/zh/docs/reference/access-authn-authz/rbac/#user-facing-roles)
588+
是一个例外的超级用户组,可以绕过鉴权层(例如 RBAC)。
589+
强烈建议不要将 `admin.conf` 文件与任何人共享。
590+
591+
<!--
592+
Instead, you can use the [`kubeadm kubeconfig user`](/docs/reference/setup-tools/kubeadm/kubeadm-kubeconfig)
593+
command to generate kubeconfig files for additional users.
594+
The command accepts a mixture of command line flags and
595+
[kubeadm configuration](/docs/reference/config-api/kubeadm-config.v1beta3/) options.
596+
The generated kubeconfig will be written to stdout and can be piped to a file
597+
using `kubeadm kubeconfig user ... > somefile.conf`.
598+
-->
599+
你要使用 [`kubeadm kubeconfig user`](/zh/docs/reference/setup-tools/kubeadm/kubeadm-kubeconfig)
600+
命令为其他用户生成 kubeconfig 文件,这个命令支持命令行参数和
601+
[kubeadm 配置结构](/zh/docs/reference/config-api/kubeadm-config.v1beta3/)。
602+
以上命令会将 kubeconfig 打印到终端上,也可以使用 `kubeadm kubeconfig user ... > somefile.conf`
603+
输出到一个文件中。
604+
605+
<!--
606+
Example configuration file that can be used with `--config`:
607+
-->
608+
如下 kubeadm 可以 在`--config` 后加的配置文件示例:
609+
610+
```yaml
611+
# example.yaml
612+
apiVersion: kubeadm.k8s.io/v1beta3
613+
kind: ClusterConfiguration
614+
# kubernetes 将作为 kubeconfig 中集群名称
615+
clusterName: "kubernetes"
616+
# some-dns-address:6443 将作为集群 kubeconfig 文件中服务地址(IP 或者 DNS 名称)
617+
controlPlaneEndpoint: "some-dns-address:6443"
618+
# 从本地挂载集群的 CA 秘钥和 CA 证书
619+
certificatesDir: "/etc/kubernetes/pki"
620+
```
621+
622+
<!--
623+
Make sure that these settings match the desired target cluster settings.
624+
To see the settings of an existing cluster use:
625+
-->
626+
确保这些设置与所需的目标集群设置相匹配。可以使用以下命令查看现有集群的设置:
627+
628+
```shell
629+
kubectl get cm kubeadm-config -n kube-system -o=jsonpath="{.data.ClusterConfiguration}"
630+
```
631+
632+
<!--
633+
The following example will generate a kubeconfig file with credentials valid for 24 hours
634+
for a new user `johndoe` that is part of the `appdevs` group:
635+
-->
636+
以下示例将为在 `appdevs` 组的 `johndoe` 用户创建一个有效期为 24 小时的 kubeconfig 文件:
637+
638+
```shell
639+
kubeadm kubeconfig user --config example.yaml --org appdevs --client-name johndoe --validity-period 24h
640+
```
641+
642+
<!--
643+
The following example will generate a kubeconfig file with administrator credentials valid for 1 week:
644+
-->
645+
以下示例将为管理员创建一个有效期有一周的 kubeconfig 文件:
646+
647+
```shell
648+
kubeadm kubeconfig user --config example.yaml --client-name admin --validity-period 168h
649+
```

0 commit comments

Comments
 (0)