Skip to content

Commit bf6ae60

Browse files
committed
[zh-cn] Resync kubeadm init page
1 parent a9b7331 commit bf6ae60

File tree

1 file changed

+87
-71
lines changed

1 file changed

+87
-71
lines changed

content/zh-cn/docs/reference/setup-tools/kubeadm/kubeadm-init.md

Lines changed: 87 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ title: kubeadm init
1212
content_type: concept
1313
weight: 20
1414
-->
15+
1516
<!-- overview -->
1617

1718
<!--
@@ -148,7 +149,7 @@ following steps:
148149
149150
Kubeadm allows you to create a control-plane node in phases using the `kubeadm init phase` command.
150151
-->
151-
### 在 kubeadm 中使用 init phases {#init-phases}
152+
### 在 kubeadm 中使用 init 阶段 {#init-phases}
152153

153154
Kubeadm 允许你使用 `kubeadm init phase` 命令分阶段创建控制平面节点。
154155

@@ -219,10 +220,10 @@ Alternatively, you can use the `skipPhases` field under `InitConfiguration`.
219220
-->
220221
### 结合一份配置文件来使用 kubeadm init {#config-file}
221222

223+
{{< caution >}}
222224
<!--
223225
The config file is still considered beta and may change in future versions.
224226
-->
225-
{{< caution >}}
226227
配置文件的功能仍然处于 alpha 状态并且在将来的版本中可能会改变。
227228
{{< /caution >}}
228229

@@ -294,19 +295,19 @@ List of feature gates:
294295
-->
295296
特性门控的列表:
296297

297-
{{< table caption="kubeadm feature gates" >}}
298+
{{< table caption="kubeadm 特性门控" >}}
298299
特性 | 默认值 | Alpha | Beta
299300
:-------|:--------|:------|:-----
300301
`PublicKeysECDSA` | `false` | 1.19 | -
301302
`RootlessControlPlane` | `false` | 1.22 | -
302303
`UnversionedKubeletConfigMap` | `true` | 1.22 | 1.23
303304
{{< /table >}}
304305

306+
{{< note >}}
305307
<!--
306308
Once a feature gate goes GA it is removed from this list as its value becomes locked to `true` by default.
307309
-->
308-
{{< note >}}
309-
一旦特性门控变成了 GA,那它将会从这个列表中移除,因为它的值会被默认锁定为 `true`
310+
一旦特性门控变成了 GA,那它将会从这个列表中移除,因为它的值会被默认锁定为 `true`
310311
{{< /note >}}
311312

312313
<!--
@@ -367,21 +368,18 @@ Setting `UnversionedKubeletConfigMap` to `false` is supported but **deprecated**
367368
设置 `UnversionedKubeletConfigMap``false` 是被支持的特性,但该特性**已被弃用**
368369
{{< /note >}}
369370

370-
371-
372-
373371
<!--
374372
### Adding kube-proxy parameters {#kube-proxy}
375-
-->
376-
### 添加 kube-proxy 参数 {#kube-proxy}
377373
378-
<!--
374+
379375
For information about kube-proxy parameters in the kubeadm configuration see:
380376
- [kube-proxy reference](/docs/reference/config-api/kube-proxy-config.v1alpha1/)
381377
382378
For information about enabling IPVS mode with kubeadm see:
383379
- [IPVS](https://github.com/kubernetes/kubernetes/blob/master/pkg/proxy/ipvs/README.md)
384380
-->
381+
### 添加 kube-proxy 参数 {#kube-proxy}
382+
385383
kubeadm 配置中有关 kube-proxy 的说明请查看:
386384

387385
- [kube-proxy 参考](/zh-cn/docs/reference/config-api/kube-proxy-config.v1alpha1/)
@@ -392,28 +390,27 @@ kubeadm 配置中有关 kube-proxy 的说明请查看:
392390

393391
<!--
394392
### Passing custom flags to control plane components {#control-plane-flags}
393+
394+
For information about passing flags to control plane components see:
395+
- [control-plane-flags](/docs/setup/production-environment/tools/kubeadm/control-plane-flags/)
395396
-->
396397
### 向控制平面组件传递自定义的命令行参数 {#control-plane-flags}
397398

398-
<!--
399-
For information about passing flags to control plane components see:
400-
- [control-plane-flags](/docs/setup/production-environment/tools/kubeadm/control-plane-flags/) -->
401399
有关向控制平面组件传递命令行参数的说明请查看:
402-
[控制平面命令行参数](/zh-cn/docs/setup/production-environment/tools/kubeadm/control-plane-flags/)
400+
401+
- [控制平面命令行参数](/zh-cn/docs/setup/production-environment/tools/kubeadm/control-plane-flags/)
403402

404403
<!--
405404
### Running kubeadm without an Internet connection {#without-internet-connection}
406-
-->
407-
### 在没有互联网连接的情况下运行 kubeadm {#without-internet-connection}
408405
409-
<!--
410406
For running kubeadm without an internet connection you have to pre-pull the required control-plane images.
411-
-->
412-
要在没有互联网连接的情况下运行 kubeadm,你必须提前拉取所需的控制平面镜像。
413407
414-
<!--
415408
You can list and pull the images using the `kubeadm config images` sub-command:
416409
-->
410+
### 在没有互联网连接的情况下运行 kubeadm {#without-internet-connection}
411+
412+
要在没有互联网连接的情况下运行 kubeadm,你必须提前拉取所需的控制平面镜像。
413+
417414
你可以使用 `kubeadm config images` 子命令列出并拉取镜像:
418415

419416
```shell
@@ -425,7 +422,8 @@ kubeadm config images pull
425422
You can pass `--config` to the above commands with a [kubeadm configuration file](#config-file)
426423
to control the `kubernetesVersion` and `imageRepository` fields.
427424
-->
428-
你可以通过 `--config`[kubeadm 配置文件](#config-file) 传递给上述命令来控制 `kubernetesVersion``imageRepository` 字段。
425+
你可以通过 `--config`[kubeadm 配置文件](#config-file) 传递给上述命令来控制
426+
`kubernetesVersion``imageRepository` 字段。
429427

430428
<!--
431429
All default `k8s.gcr.io` images that kubeadm requires support multiple architectures.
@@ -434,43 +432,41 @@ kubeadm 需要的所有默认 `k8s.gcr.io` 镜像都支持多种硬件体系结
434432

435433
<!--
436434
### Using custom images {#custom-images}
437-
-->
438-
### 使用自定义的镜像 {#custom-images}
439435
440-
<!--
441436
By default, kubeadm pulls images from `k8s.gcr.io`. If the
442437
requested Kubernetes version is a CI label (such as `ci/latest`)
443438
`gcr.io/k8s-staging-ci-images` is used.
444439
-->
445-
默认情况下, kubeadm 会从 `k8s.gcr.io` 仓库拉取镜像。如果请求的 Kubernetes 版本是 CI 标签
440+
### 使用自定义的镜像 {#custom-images}
441+
442+
默认情况下,kubeadm 会从 `k8s.gcr.io` 仓库拉取镜像。如果请求的 Kubernetes 版本是 CI 标签
446443
(例如 `ci/latest`),则使用 `gcr.io/k8s-staging-ci-images`
447444

448445
<!--
449446
You can override this behavior by using [kubeadm with a configuration file](#config-file).
450-
-->
451-
你可以通过使用[带有配置文件的 kubeadm](#config-file) 来重写此操作。
452-
453-
<!--
454447
Allowed customization are:
455448
456449
* To provide `kubernetesVersion` which affects the version of the images.
457450
* To provide an alternative `imageRepository` to be used instead of
458451
`k8s.gcr.io`.
459452
* To provide a specific `imageRepository` and `imageTag` for etcd or CoreDNS.
453+
460454
-->
455+
你可以通过使用[带有配置文件的 kubeadm](#config-file) 来重写此操作。
461456
允许的自定义功能有:
462457

463458
* 提供影响镜像版本的 `kubernetesVersion`
464459
* 使用其他的 `imageRepository` 来代替 `k8s.gcr.io`
465460
* 为 etcd 或 CoreDNS 提供特定的 `imageRepository``imageTag`
466461

467462
<!--
463+
Image paths between the default `k8s.gcr.io` and a custom repository specified using
468464
`imageRepository` may differ for backwards compatibility reasons. For example,
469465
one image might have a subpath at `k8s.gcr.io/subpath/image`, but be defaulted
470-
to `my.customrepository.io/image` when using a custom repository.
466+
to `my.customrepository.io/image` when using a custom repository.
471467
-->
472-
由于向后兼容的原因,`imageRepository` 可能会有所不同。
473-
例如,某镜像的子路径可能是 `k8s.gcr.io/subpath/image`
468+
由于向后兼容的原因,使用 `imageRepository` 所指定的定制镜像库可能与默认的
469+
`k8s.gcr.io` 镜像路径不同。例如,某镜像的子路径可能是 `k8s.gcr.io/subpath/image`
474470
但使用自定义仓库时默认为 `my.customrepository.io/image`
475471

476472
<!--
@@ -488,23 +484,39 @@ for etcd and CoreDNS.
488484
-->
489485
* 使用 `kubeadm config images {list|pull}``k8s.gcr.io` 的默认路径中拉取镜像。
490486
* 将镜像推送到 `kubeadm config images list --config=config.yaml` 的路径,
491-
其中 `config.yaml` 包含自定义的 `imageRepository` 和/或用于 etcd 和 CoreDNS 的 `imageTag`
487+
其中 `config.yaml` 包含自定义的 `imageRepository` 和/或用于 etcd 和 CoreDNS 的 `imageTag`
492488
* 将相同的 `config.yaml` 传递给 `kubeadm init`
493489

494-
495490
<!--
496-
### Uploading control-plane certificates to the cluster
491+
#### Custom sandbox (pause) images {#custom-pause-image}
492+
493+
To set a custom image for these you need to configure this in your
494+
{{< glossary_tooltip text="container runtime" term_id="container-runtime" >}}
495+
to use the image.
496+
Consult the documentation for your container runtime to find out how to change this setting;
497+
for selected container runtimes, you can also find advice within the
498+
[Container Runtimes]((/docs/setup/production-environment/container-runtimes/) topic.
497499
-->
498-
### 将控制平面证书上传到集群
500+
#### 定制沙箱(pause)镜像 {#custom-pause-image}
501+
502+
如果需要为这些组件设置定制的镜像,你需要在你的{{< glossary_tooltip text="容器运行时" term_id="container-runtime" >}}
503+
中完成一些配置。参阅你的容器运行时的文档以了解如何改变此设置。
504+
对于某些容器运行时而言,
505+
你可以在[容器运行时](/zh-cn/docs/setup/production-environment/container-runtimes/)
506+
主题下找到一些建议。
499507

500508
<!--
509+
### Uploading control-plane certificates to the cluster
510+
501511
By adding the flag `-upload-certs` to `kubeadm init` you can temporary upload
502512
the control-plane certificates to a Secret in the cluster. Please note that this Secret
503513
will expire automatically after 2 hours. The certificates are encrypted using
504514
a 32byte key that can be specified using `-certificate-key`. The same key can be used
505515
to download the certificates when additional control-plane nodes are joining, by passing
506516
`-control-plane` and `-certificate-key` to `kubeadm join`.
507517
-->
518+
### 将控制平面证书上传到集群 {#uploading-control-plane-certificates-to-the-cluster}
519+
508520
通过将参数 `--upload-certs` 添加到 `kubeadm init`,你可以将控制平面证书临时上传到集群中的 Secret。
509521
请注意,此 Secret 将在 2 小时后自动过期。证书使用 32 字节密钥加密,可以使用 `--certificate-key` 指定。
510522
通过将 `--control-plane``--certificate-key` 传递给 `kubeadm join`
@@ -522,100 +534,101 @@ kubeadm init phase upload-certs --upload-certs --certificate-key=SOME_VALUE --co
522534
<!--
523535
If the flag `-certificate-key` is not passed to `kubeadm init` and
524536
`kubeadm init phase upload-certs` a new key will be generated automatically.
537+
538+
The following command can be used to generate a new key on demand:
525539
-->
526540
如果未将参数 `--certificate-key` 传递给 `kubeadm init``kubeadm init phase upload-certs`
527541
则会自动生成一个新密钥。
528542

529-
<!--
530-
The following command can be used to generate a new key on demand:
531-
-->
532543
以下命令可用于按需生成新密钥:
533544

534545
```shell
535546
kubeadm certs certificate-key
536547
```
537548

538-
<!-- ### Certificate management with kubeadm -->
539-
### 使用 kubeadm 管理证书
549+
<!--
550+
### Certificate management with kubeadm
540551
541-
<!--
542552
For detailed information on certificate management with kubeadm see
543553
[Certificate Management with kubeadm](/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/).
544554
The document includes information about using external CA, custom certificates
545555
and certificate renewal.
546556
-->
547-
有关使用 kubeadm 进行证书管理的详细信息,请参阅
548-
[使用 kubeadm 进行证书管理](/zh-cn/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/)
557+
### 使用 kubeadm 管理证书 {#certificate-management-with-kubeadm}
558+
559+
有关使用 kubeadm 进行证书管理的详细信息,
560+
请参阅[使用 kubeadm 进行证书管理](/zh-cn/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/)
549561
该文档包括有关使用外部 CA,自定义证书和证书更新的信息。
550562

551563
<!--
552564
### Managing the kubeadm drop-in file for the kubelet {#kubelet-drop-in}
553-
-->
554-
### 管理 kubeadm 为 kubelet 提供的 systemd 配置文件 {#kubelet-drop-in}
555565
556-
<!--
557566
The `kubeadm` package ships with a configuration file for running the `kubelet` by `systemd`. Note that the kubeadm CLI never touches this drop-in file. This drop-in file is part of the kubeadm DEB/RPM package.
558567
-->
568+
### 管理 kubeadm 为 kubelet 提供的 systemd 配置文件 {#kubelet-drop-in}
569+
559570
`kubeadm` 包自带了关于 `systemd` 如何运行 `kubelet` 的配置文件。
560571
请注意 `kubeadm` 客户端命令行工具永远不会修改这份 `systemd` 配置文件。
561572
这份 `systemd` 配置文件属于 kubeadm DEB/RPM 包。
562573

563574
<!--
564575
For further information, see [Managing the kubeadm drop-in file for systemd](/docs/setup/production-environment/tools/kubeadm/kubelet-integration/#the-kubelet-drop-in-file-for-systemd).
565576
-->
566-
有关更多信息,请阅读
567-
[管理 systemd 的 kubeadm 内嵌文件](/zh-cn/docs/setup/production-environment/tools/kubeadm/kubelet-integration/#the-kubelet-drop-in-file-for-systemd)
577+
有关更多信息,请阅读[管理 systemd 的 kubeadm 内嵌文件](/zh-cn/docs/setup/production-environment/tools/kubeadm/kubelet-integration/#the-kubelet-drop-in-file-for-systemd)
568578

569579
<!--
570580
### Use kubeadm with CRI runtimes
571-
-->
572-
### 结合 CRI 运行时使用 kubeadm
573581
574-
<!--
575582
By default kubeadm attempts to detect your container runtime. For more details on this detection, see
576583
the [kubeadm CRI installation guide](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#installing-runtime).
577584
-->
585+
### 结合 CRI 运行时使用 kubeadm {#use-kubeadm-with-cri-runtimes}
586+
578587
默认情况下,kubeadm 尝试检测你的容器运行环境。有关此检测的更多详细信息,请参见
579588
[kubeadm CRI 安装指南](/zh-cn/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#installing-runtime)
580589

581590
<!--
582591
### Setting the node name
583-
-->
584-
### 设置节点的名称
585592
586-
<!--
587593
By default, `kubeadm` assigns a node name based on a machine's host address. You can override this setting with the `-node-name` flag.
588594
The flag passes the appropriate [`-hostname-override`](/docs/reference/command-line-tools-reference/kubelet/#options)
589595
value to the kubelet.
590596
-->
591-
默认情况下, `kubeadm` 基于机器的主机地址分配一个节点名称。你可以使用 `--node-name` 参数覆盖此设置。
592-
此标识将合适的
593-
[`--hostname-override`](/zh-cn/docs/reference/command-line-tools-reference/kubelet/#options)
597+
### 设置节点的名称 {#setting-the-node-name}
598+
599+
默认情况下,`kubeadm` 基于机器的主机地址分配一个节点名称。你可以使用 `--node-name` 参数覆盖此设置。
600+
此标识将合适的 [`--hostname-override`](/zh-cn/docs/reference/command-line-tools-reference/kubelet/#options)
594601
值传递给 kubelet。
595602

596603
<!--
597-
### Automating kubeadm
604+
Be aware that overriding the hostname can [interfere with cloud providers](https://github.com/kubernetes/website/pull/8873).
598605
-->
599-
### kubeadm 自动化
606+
要注意,重载主机名可能会[与云驱动发生冲突](https://github.com/kubernetes/website/pull/8873)
600607

601608
<!--
609+
### Automating kubeadm
610+
602611
Rather than copying the token you obtained from `kubeadm init` to each node, as
603612
in the [basic kubeadm tutorial](/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/), you can parallelize the
604613
token distribution for easier automation. To implement this automation, you must
605614
know the IP address that the control-plane node will have after it is started,
606615
or use a DNS name or an address of a load balancer.
607616
-->
617+
### kubeadm 自动化 {#automating-kubeadm}
618+
608619
除了像文档 [kubeadm 基础教程](/zh-cn/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/)
609620
中所描述的那样,将从 `kubeadm init` 取得的令牌复制到每个节点,
610621
你还可以并行地分发令牌以实现简单自动化。
611622
要实现自动化,你必须知道控制平面节点启动后将拥有的 IP 地址,或使用 DNS 名称或负载均衡器的地址。
612623

613624
<!--
614-
1. Generate a token. This token must have the form `<6 character string>.<16
615-
character string>`. More formally, it must match the regex: `[a-z0-9]{6}\.[a-z0-9]{16}`.
616-
kubeadm can generate a token for you:
625+
1. Generate a token. This token must have the form `<6 character string>.<16
626+
character string>`. More formally, it must match the regex:
627+
`[a-z0-9]{6}\.[a-z0-9]{16}`.
628+
629+
kubeadm can generate a token for you:
617630
-->
618-
1. 生成一个令牌。这个令牌必须具有以下格式:`< 6 个字符的字符串>.< 16 个字符的字符串>`
631+
1. 生成一个令牌。这个令牌必须具有以下格式:`<6 个字符的字符串>.<16 个字符的字符串>`
619632
更加正式的说法是,它必须符合以下正则表达式:`[a-z0-9]{6}\.[a-z0-9]{16}`
620633

621634
kubeadm 可以为你生成一个令牌:
@@ -625,14 +638,16 @@ kubeadm can generate a token for you:
625638
```
626639

627640
<!--
628-
2. Start both the control-plane node and the worker nodes concurrently with this token.
629-
As they come up they should find each other and form the cluster. The same `-token` argument can be used on both `kubeadm init` and `kubeadm join`.
641+
1. Start both the control-plane node and the worker nodes concurrently with this token.
642+
As they come up they should find each other and form the cluster. The same
643+
`-token` argument can be used on both `kubeadm init` and `kubeadm join`.
630644
-->
631645
2. 使用这个令牌同时启动控制平面节点和工作节点。它们一旦运行起来应该就会互相寻找对方并且建立集群。
632646
同样的 `--token` 参数可以同时用于 `kubeadm init``kubeadm join` 命令。
633647

634648
<!--
635-
3. Similar can be done for `-certificate-key` when joining additional control-plane nodes. The key can be generated using:
649+
1. Similar can be done for `-certificate-key` when joining additional control-plane
650+
nodes. The key can be generated using:
636651
-->
637652
3. 当加入其他控制平面节点时,可以对 `--certificate-key` 执行类似的操作。可以使用以下方式生成密钥:
638653

@@ -653,8 +668,9 @@ it does not allow the root CA hash to be validated with
653668
`-discovery-token-ca-cert-hash` (since it's not generated when the nodes are
654669
provisioned). For details, see the [kubeadm join](/docs/reference/setup-tools/kubeadm/kubeadm-join/).
655670
-->
656-
注意这种搭建集群的方式在安全保证上会有一些宽松,因为这种方式不允许使用 `--discovery-token-ca-cert-hash`
657-
来验证根 CA 的哈希值(因为当配置节点的时候,它还没有被生成)。
671+
注意这种搭建集群的方式在安全保证上会有一些宽松,因为这种方式不允许使用
672+
`--discovery-token-ca-cert-hash` 来验证根 CA 的哈希值
673+
(因为当配置节点的时候,它还没有被生成)。
658674
更多信息请参阅 [kubeadm join](/zh-cn/docs/reference/setup-tools/kubeadm/kubeadm-join/) 文档。
659675

660676
## {{% heading "whatsnext" %}}
@@ -666,7 +682,7 @@ provisioned). For details, see the [kubeadm join](/docs/reference/setup-tools/ku
666682
* [kubeadm upgrade](/docs/reference/setup-tools/kubeadm/kubeadm-upgrade/) to upgrade a Kubernetes cluster to a newer version
667683
* [kubeadm reset](/docs/reference/setup-tools/kubeadm/kubeadm-reset/) to revert any changes made to this host by `kubeadm init` or `kubeadm join`
668684
-->
669-
* 进一步阅读了解 [kubeadm init phase](/zh-cn/docs/reference/setup-tools/kubeadm/kubeadm-init-phase/)
685+
* 进一步阅读了解 [kubeadm init 阶段](/zh-cn/docs/reference/setup-tools/kubeadm/kubeadm-init-phase/)
670686
* [kubeadm join](/zh-cn/docs/reference/setup-tools/kubeadm/kubeadm-join/)
671687
启动一个 Kubernetes 工作节点并且将其加入到集群
672688
* [kubeadm upgrade](/zh-cn/docs/reference/setup-tools/kubeadm/kubeadm-upgrade/)

0 commit comments

Comments
 (0)