Skip to content

Commit f6fb295

Browse files
authored
Merge pull request #29531 from mengjiao-liu/sync-1.22-kubeadm-part1
[zh] Setup files to sync for 1.22(kubeadm part-1)
2 parents 03f1829 + 8ab1f6a commit f6fb295

File tree

2 files changed

+78
-87
lines changed

2 files changed

+78
-87
lines changed

content/zh/docs/setup/production-environment/tools/kubeadm/install-kubeadm.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ card:
2121

2222
<!--
2323
<img src="https://raw.githubusercontent.com/kubernetes/kubeadm/master/logos/stacked/color/kubeadm-stacked-color.png" align="right" width="150px">This page shows how to install the `kubeadm` toolbox.
24-
For information how to create a cluster with kubeadm once you have performed this installation process, see the [Using kubeadm to Create a Cluster](/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/) page.
24+
For information on how to create a cluster with kubeadm once you have performed this installation process, see the [Using kubeadm to Create a Cluster](/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/) page.
2525
-->
2626
<img src="https://raw.githubusercontent.com/kubernetes/kubeadm/master/logos/stacked/color/kubeadm-stacked-color.png" align="right" width="150px">本页面显示如何安装 `kubeadm` 工具箱。
2727
有关在执行此安装过程后如何使用 kubeadm 创建集群的信息,请参见
@@ -414,8 +414,9 @@ Install CNI plugins (required for most pod network):
414414

415415
```bash
416416
CNI_VERSION="v0.8.2"
417+
ARCH="amd64"
417418
sudo mkdir -p /opt/cni/bin
418-
curl -L "https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-amd64-${CNI_VERSION}.tgz" | sudo tar -C /opt/cni/bin -xz
419+
curl -L "https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-${ARCH}-${CNI_VERSION}.tgz" | sudo tar -C /opt/cni/bin -xz
419420
```
420421

421422
<!--
@@ -444,7 +445,8 @@ Install crictl (required for kubeadm / Kubelet Container Runtime Interface (CRI)
444445

445446
```bash
446447
CRICTL_VERSION="v1.17.0"
447-
curl -L "https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-linux-amd64.tar.gz" | sudo tar -C $DOWNLOAD_DIR -xz
448+
ARCH="amd64"
449+
curl -L "https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-linux-${ARCH}.tar.gz" | sudo tar -C $DOWNLOAD_DIR -xz
448450
```
449451

450452
<!--
@@ -454,8 +456,9 @@ Install `kubeadm`, `kubelet`, `kubectl` and add a `kubelet` systemd service:
454456

455457
```bash
456458
RELEASE="$(curl -sSL https://dl.k8s.io/release/stable.txt)"
459+
ARCH="amd64"
457460
cd $DOWNLOAD_DIR
458-
sudo curl -L --remote-name-all https://storage.googleapis.com/kubernetes-release/release/${RELEASE}/bin/linux/amd64/{kubeadm,kubelet,kubectl}
461+
sudo curl -L --remote-name-all https://storage.googleapis.com/kubernetes-release/release/${RELEASE}/bin/linux/${ARCH}/{kubeadm,kubelet,kubectl}
459462
sudo chmod +x {kubeadm,kubelet,kubectl}
460463

461464
RELEASE_VERSION="v0.4.0"

content/zh/docs/setup/production-environment/tools/kubeadm/troubleshooting-kubeadm.md

Lines changed: 71 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -91,44 +91,19 @@ If you notice that `kubeadm init` hangs after printing out the following line:
9191
This may be caused by a number of problems. The most common are:
9292
9393
- network connection problems. Check that your machine has full network connectivity before continuing.
94-
- the default cgroup driver configuration for the kubelet differs from that used by Docker.
95-
Check the system log file (e.g. `/var/log/message`) or examine the output from `journalctl -u kubelet`. If you see something like the following:
96-
97-
```shell
98-
error: failed to run Kubelet: failed to create kubelet:
99-
misconfiguration: kubelet cgroup driver: "systemd" is different from docker cgroup driver: "cgroupfs"
100-
```
101-
102-
There are two common ways to fix the cgroup driver problem:
103-
104-
1. Install Docker again following instructions
105-
[here](/docs/setup/production-environment/container-runtimes/#docker).
106-
107-
1. Change the kubelet config to match the Docker cgroup driver manually, you can refer to
108-
[Configure cgroup driver used by kubelet on control-plane node](/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#configure-cgroup-driver-used-by-kubelet-on-control-plane-node)
109-
110-
- control plane Docker containers are crashlooping or hanging. You can check this by running `docker ps` and investigating each container by running `docker logs`.
94+
- the cgroup driver of the container runtime differs from that of the kubelet. To understand how to
95+
configure it properly see [Configuring a cgroup driver](/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/).
96+
- control plane containers are crashlooping or hanging. You can check this by running `docker ps`
97+
and investigating each container by running `docker logs`. For other container runtime see
98+
[Debugging Kubernetes nodes with crictl](/docs/tasks/debug-application-cluster/crictl/).
11199
-->
112100
这可能是由许多问题引起的。最常见的是:
113101

114102
- 网络连接问题。在继续之前,请检查你的计算机是否具有全部联通的网络连接。
115-
- kubelet 的默认 cgroup 驱动程序配置不同于 Docker 使用的配置。
116-
检查系统日志文件 (例如 `/var/log/message`) 或检查 `journalctl -u kubelet` 的输出。 如果你看见以下内容:
117-
118-
```shell
119-
error: failed to run Kubelet: failed to create kubelet:
120-
misconfiguration: kubelet cgroup driver: "systemd" is different from docker cgroup driver: "cgroupfs"
121-
```
122-
123-
有两种常见方法可解决 cgroup 驱动程序问题:
124-
125-
1. 按照[此处](/zh/docs/setup/production-environment/container-runtimes/#docker) 的说明
126-
重新安装 Docker。
127-
128-
1. 更改 kubelet 配置以手动匹配 Docker cgroup 驱动程序,你可以参考
129-
[在主节点上配置 kubelet 要使用的 cgroup 驱动程序](/zh/docs/setup/production-environment/tools/kubeadm/install-kubeadm/#configure-cgroup-driver-used-by-kubelet-on-control-plane-node)
130-
103+
- 容器运行时的 cgroup 驱动不同于 kubelet 使用的 cgroup 驱动。要了解如何正确配置 cgroup 驱动,
104+
请参阅[配置 cgroup 驱动](/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/)
131105
- 控制平面上的 Docker 容器持续进入崩溃状态或(因其他原因)挂起。你可以运行 `docker ps` 命令来检查以及 `docker logs` 命令来检视每个容器的运行日志。
106+
对于其他容器运行时,请参阅[使用 crictl 对 Kubernetes 节点进行调试](/zh/docs/tasks/debug-application-cluster/crictl/)
132107

133108
<!--
134109
## kubeadm blocks when removing managed containers
@@ -273,7 +248,7 @@ services](/docs/concepts/services-networking/service/#nodeport) or use `HostNetw
273248
<!--
274249
## Pods are not accessible via their Service IP
275250
276-
- Many network add-ons do not yet enable [hairpin mode](/docs/tasks/debug-application-cluster/debug-service/#a-pod-cannot-reach-itself-via-service-ip)
251+
- Many network add-ons do not yet enable [hairpin mode](/docs/tasks/debug-application-cluster/debug-service/#a-pod-fails-to-reach-itself-via-the-service-ip)
277252
which allows pods to access themselves via their Service IP. This is an issue related to
278253
[CNI](https://github.com/containernetworking/cni/issues/476). Please contact the network
279254
add-on provider to get the latest status of their support for hairpin mode.
@@ -286,7 +261,7 @@ services](/docs/concepts/services-networking/service/#nodeport) or use `HostNetw
286261
-->
287262
## 无法通过其服务 IP 访问 Pod
288263

289-
- 许多网络附加组件尚未启用 [hairpin 模式](/zh/docs/tasks/debug-application-cluster/debug-service/#a-pod-cannot-reach-itself-via-service-ip)
264+
- 许多网络附加组件尚未启用 [hairpin 模式](/zh/docs/tasks/debug-application-cluster/debug-service/#a-pod-fails-to-reach-itself-via-the-service-ip)
290265
该模式允许 Pod 通过其服务 IP 进行访问。这是与 [CNI](https://github.com/containernetworking/cni/issues/476) 有关的问题。
291266
请与网络附加组件提供商联系,以获取他们所提供的 hairpin 模式的最新状态。
292267

@@ -378,6 +353,51 @@ Error from server (NotFound): the server could not find the requested resource
378353
379354
This may lead to problems with flannel, which defaults to the first interface on a host. This leads to all hosts thinking they have the same public IP address. To prevent this, pass the `-iface eth1` flag to flannel so that the second interface is chosen.
380355
-->
356+
357+
<!--
358+
## Kubelet client certificate rotation fails {#kubelet-client-cert}
359+
360+
By default, kubeadm configures a kubelet with automatic rotation of client certificates by using the `/var/lib/kubelet/pki/kubelet-client-current.pem` symlink specified in `/etc/kubernetes/kubelet.conf`.
361+
If this rotation process fails you might see errors such as `x509: certificate has expired or is not yet valid`
362+
in kube-apiserver logs. To fix the issue you must follow these steps:
363+
-->
364+
## Kubelet 客户端证书轮换失败 {#kubelet-client-cert}
365+
366+
默认情况下,kubeadm 使用 `/etc/kubernetes/kubelet.conf` 中指定的 `/var/lib/kubelet/pki/kubelet-client-current.pem` 符号链接
367+
来配置 kubelet 自动轮换客户端证书。如果此轮换过程失败,你可能会在 kube-apiserver 日志中看到
368+
诸如 `x509: certificate has expired or is not yet valid` 之类的错误。要解决此问题,你必须执行以下步骤:
369+
<!--
370+
1. Backup and delete `/etc/kubernetes/kubelet.conf` and `/var/lib/kubelet/pki/kubelet-client*` from the failed node.
371+
1. From a working control plane node in the cluster that has `/etc/kubernetes/pki/ca.key` execute
372+
`kubeadm kubeconfig user --org system:nodes --client-name system:node:$NODE > kubelet.conf`.
373+
`$NODE` must be set to the name of the existing failed node in the cluster.
374+
Modify the resulted `kubelet.conf` manually to adjust the cluster name and server endpoint,
375+
or pass `kubeconfig user --config` (it accepts `InitConfiguration`). If your cluster does not have
376+
the `ca.key` you must sign the embedded certificates in the `kubelet.conf` externally.
377+
-->
378+
1. 从故障节点备份和删除 `/etc/kubernetes/kubelet.conf``/var/lib/kubelet/pki/kubelet-client*`
379+
2. 在集群中具有 `/etc/kubernetes/pki/ca.key` 的、正常工作的控制平面节点上
380+
执行 `kubeadm kubeconfig user --org system:nodes --client-name system:node:$NODE > kubelet.conf`
381+
`$NODE` 必须设置为集群中现有故障节点的名称。
382+
手动修改生成的 `kubelet.conf` 以调整集群名称和服务器端点,
383+
或传递 `kubeconfig user --config`(此命令接受 `InitConfiguration`)。
384+
如果你的集群没有 `ca.key`,你必须在外部对 `kubelet.conf` 中的嵌入式证书进行签名。
385+
<!--
386+
1. Copy this resulted `kubelet.conf` to `/etc/kubernetes/kubelet.conf` on the failed node.
387+
1. Restart the kubelet (`systemctl restart kubelet`) on the failed node and wait for
388+
`/var/lib/kubelet/pki/kubelet-client-current.pem` to be recreated.
389+
-->
390+
3. 将得到的 `kubelet.conf` 文件复制到故障节点上,作为 `/etc/kubernetes/kubelet.conf`
391+
4. 在故障节点上重启 kubelet(`systemctl restart kubelet`),等待 `/var/lib/kubelet/pki/kubelet-client-current.pem` 重新创建。
392+
<!--
393+
1. Run `kubeadm init phase kubelet-finalize all` on the failed node. This will make the new
394+
`kubelet.conf` file use `/var/lib/kubelet/pki/kubelet-client-current.pem` and will restart the kubelet.
395+
1. Make sure the node becomes `Ready`.
396+
-->
397+
5. 在故障节点上运行 `kubeadm init phase kubelet-finalize all`
398+
这将使新的 `kubelet.conf` 文件使用 `/var/lib/kubelet/pki/kubelet-client-current.pem` 并将重新启动 kubelet。
399+
6. 确保节点状况变为 `Ready`
400+
381401
## 在 Vagrant 中使用 flannel 作为 pod 网络时的默认 NIC
382402

383403
以下错误可能表明 Pod 网络中出现问题:
@@ -411,8 +431,13 @@ Error from server: Get https://10.19.0.41:10250/containerLogs/default/mysql-ddc6
411431
curl http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address
412432
```
413433
414-
The workaround is to tell `kubelet` which IP to use using `-node-ip`. When using Digital Ocean, it can be the public one (assigned to `eth0`) or the private one (assigned to `eth1`) should you want to use the optional private network. The [`KubeletExtraArgs` section of the kubeadm `NodeRegistrationOptions` structure](https://github.com/kubernetes/kubernetes/blob/release-1.13/cmd/kubeadm/app/apis/kubeadm/v1beta1/types.go) can be used for this.
415-
434+
The workaround is to tell `kubelet` which IP to use using `--node-ip`.
435+
When using DigitalOcean, it can be the public one (assigned to `eth0`) or
436+
the private one (assigned to `eth1`) should you want to use the optional
437+
private network. The `kubeletExtraArgs` section of the kubeadm
438+
[`NodeRegistrationOptions` structure](/docs/reference/config-api/kubeadm-config.v1beta2/#kubeadm-k8s-io-v1beta2-NodeRegistrationOptions)
439+
can be used for this.
440+
416441
Then restart `kubelet`:
417442
418443
```sh
@@ -443,7 +468,8 @@ Error from server: Get https://10.19.0.41:10250/containerLogs/default/mysql-ddc6
443468

444469
解决方法是通知 `kubelet` 使用哪个 `--node-ip`。当使用 Digital Ocean 时,可以是公网IP(分配给 `eth0`的),
445470
或者是私网IP(分配给 `eth1` 的)。私网 IP 是可选的。
446-
[kubadm `NodeRegistrationOptions` 结构的 `KubeletExtraArgs` 部分](https://github.com/kubernetes/kubernetes/blob/release-1.13/cmd/kubeadm/app/apis/kubeadm/v1beta1/types.go) 被用来处理这种情况。
471+
[kubadm `NodeRegistrationOptions` 结构](/zh/docs/reference/config-api/kubeadm-config.v1beta2/#kubeadm-k8s-io-v1beta2-NodeRegistrationOptions)
472+
`KubeletExtraArgs` 部分被用来处理这种情况。
447473

448474
然后重启 `kubelet`
449475

@@ -569,7 +595,7 @@ Alternatively, you can try separating the `key=value` pairs like so:
569595
`-apiserver-extra-args "enable-admission-plugins=LimitRanger,enable-admission-plugins=NamespaceExists"`
570596
but this will result in the key `enable-admission-plugins` only having the value of `NamespaceExists`.
571597
572-
A known workaround is to use the kubeadm [configuration file](/docs/setup/production-environment/tools/kubeadm/control-plane-flags/#apiserver-flags).
598+
A known workaround is to use the kubeadm [configuration file](/docs/reference/config-api/kubeadm-config.v1beta2/).
573599
-->
574600
## 无法将以逗号分隔的值列表传递给 `--component-extra-args` 标志内的参数
575601

@@ -587,7 +613,7 @@ kube-apiserver 这样的控制平面组件。然而,由于解析 (`mapStringSt
587613
但这将导致键 `enable-admission-plugins` 仅有值 `NamespaceExists`
588614

589615
已知的解决方法是使用 kubeadm
590-
[配置文件](/zh/docs/setup/production-environment/tools/kubeadm/control-plane-flags/#apiserver-flags)
616+
[配置文件](/zh/docs/reference/config-api/kubeadm-config.v1beta2/)
591617

592618
<!--
593619
## kube-proxy scheduled before node is initialized by cloud-controller-manager
@@ -633,44 +659,6 @@ kubectl -n kube-system patch ds kube-proxy -p='{ "spec": { "template": { "spec":
633659

634660
此问题的跟踪[在这里](https://github.com/kubernetes/kubeadm/issues/1027)
635661

636-
<!--
637-
## The NodeRegistration.Taints field is omitted when marshalling kubeadm configuration
638-
639-
*Note: This [issue](https://github.com/kubernetes/kubeadm/issues/1358) only applies to tools that marshal kubeadm types (e.g. to a YAML configuration file). It will be fixed in kubeadm API v1beta2.*
640-
641-
By default, kubeadm applies the `node-role.kubernetes.io/master:NoSchedule` taint to control-plane nodes.
642-
If you prefer kubeadm to not taint the control-plane node, and set `InitConfiguration.NodeRegistration.Taints` to an empty slice,
643-
the field will be omitted when marshalling. When the field is omitted, kubeadm applies the default taint.
644-
645-
There are at least two workarounds:
646-
647-
1. Use the `node-role.kubernetes.io/master:PreferNoSchedule` taint instead of an empty slice. [Pods will get scheduled on masters](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/), unless other nodes have capacity.
648-
649-
2. Remove the taint after kubeadm init exits:
650-
```bash
651-
kubectl taint nodes NODE_NAME node-role.kubernetes.io/master:NoSchedule-
652-
```
653-
-->
654-
## NodeRegistration.Taints 字段在编组 kubeadm 配置时丢失
655-
656-
*注意:这个 [问题](https://github.com/kubernetes/kubeadm/issues/1358)
657-
仅适用于操控 kubeadm 数据类型的工具(例如,YAML 配置文件)。它将在 kubeadm API v1beta2 修复。*
658-
659-
默认情况下,kubeadm 将 `node-role.kubernetes.io/master:NoSchedule` 污点应用于控制平面节点。
660-
如果你希望 kubeadm 不污染控制平面节点,并将 `InitConfiguration.NodeRegistration.Taints` 设置成空切片,则应在编组时省略该字段。
661-
如果省略该字段,则 kubeadm 将应用默认污点。
662-
663-
至少有两种解决方法:
664-
665-
1. 使用 `node-role.kubernetes.io/master:PreferNoSchedule` 污点代替空切片。
666-
除非其他节点具有容量,[否则将在主节点上调度 Pods](/zh/docs/concepts/scheduling-eviction/taint-and-toleration/)
667-
668-
2. 在 kubeadm init 退出后删除污点:
669-
670-
```shell
671-
kubectl taint nodes NODE_NAME node-role.kubernetes.io/master:NoSchedule-
672-
```
673-
674662
<!--
675663
## `/usr` is mounted read-only on nodes {#usr-mounted-read-only}
676664
@@ -691,25 +679,25 @@ for the feature to work.
691679

692680
<!--
693681
To workaround this issue you can configure the flex-volume directory using the kubeadm
694-
[configuration file](https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2).
682+
[configuration file](https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3).
695683
696684
On the primary control-plane Node (created using `kubeadm init`) pass the following
697685
file using `--config`:
698686
-->
699-
为了解决这个问题,你可以使用 kubeadm 的[配置文件](https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2)
687+
为了解决这个问题,你可以使用 kubeadm 的[配置文件](https://godoc.org/k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3)
700688
来配置 FlexVolume 的目录。
701689

702690
在(使用 `kubeadm init` 创建的)主控制节点上,使用 `-config`
703691
参数传入如下文件:
704692

705693
```yaml
706-
apiVersion: kubeadm.k8s.io/v1beta2
694+
apiVersion: kubeadm.k8s.io/v1beta3
707695
kind: InitConfiguration
708696
nodeRegistration:
709697
kubeletExtraArgs:
710698
volume-plugin-dir: "/opt/libexec/kubernetes/kubelet-plugins/volume/exec/"
711699
---
712-
apiVersion: kubeadm.k8s.io/v1beta2
700+
apiVersion: kubeadm.k8s.io/v1beta3
713701
kind: ClusterConfiguration
714702
controllerManager:
715703
extraArgs:
@@ -722,7 +710,7 @@ On joining Nodes:
722710
在加入到集群中的节点上,使用下面的文件:
723711
724712
```yaml
725-
apiVersion: kubeadm.k8s.io/v1beta2
713+
apiVersion: kubeadm.k8s.io/v1beta3
726714
kind: JoinConfiguration
727715
nodeRegistration:
728716
kubeletExtraArgs:

0 commit comments

Comments
 (0)