Skip to content

Commit 034bfd1

Browse files
committed
[zh-cn] sync troubleshooting-kubeadm
Signed-off-by: xin.li <[email protected]>
1 parent 891a689 commit 034bfd1

File tree

1 file changed

+82
-37
lines changed

1 file changed

+82
-37
lines changed

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

Lines changed: 82 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ If you see the following warnings while running `kubeadm init`
114114
```
115115

116116
<!--
117-
Then you may be missing `ebtables`, `ethtool` or a similar executable on your node. You can install them with the following commands:
117+
Then you may be missing `ebtables`, `ethtool` or a similar executable on your node.
118+
You can install them with the following commands:
118119

119120
- For Ubuntu/Debian users, run `apt install ebtables ethtool`.
120121
- For CentOS/Fedora users, run `yum install ebtables ethtool`.
@@ -143,9 +144,9 @@ This may be caused by a number of problems. The most common are:
143144

144145
- network connection problems. Check that your machine has full network connectivity before continuing.
145146
- the cgroup driver of the container runtime differs from that of the kubelet. To understand how to
146-
configure it properly see [Configuring a cgroup driver](/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/).
147+
configure it properly, see [Configuring a cgroup driver](/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/).
147148
- control plane containers are crashlooping or hanging. You can check this by running `docker ps`
148-
and investigating each container by running `docker logs`. For other container runtime see
149+
and investigating each container by running `docker logs`. For other container runtime, see
149150
[Debugging Kubernetes nodes with crictl](/docs/tasks/debug/debug-cluster/crictl/).
150151
-->
151152
这可能是由许多问题引起的。最常见的是:
@@ -240,10 +241,12 @@ provider. Please contact the author of the Pod Network add-on to find out whethe
240241

241242
Calico, Canal, and Flannel CNI providers are verified to support HostPort.
242243

243-
For more information, see the [CNI portmap documentation](https://github.com/containernetworking/plugins/blob/master/plugins/meta/portmap/README.md).
244+
For more information, see the
245+
[CNI portmap documentation](https://github.com/containernetworking/plugins/blob/master/plugins/meta/portmap/README.md).
244246

245-
If your network provider does not support the portmap CNI plugin, you may need to use the [NodePort feature of
246-
services](/docs/concepts/services-networking/service/#type-nodeport) or use `HostNetwork=true`.
247+
If your network provider does not support the portmap CNI plugin, you may need to use the
248+
[NodePort feature of services](/docs/concepts/services-networking/service/#type-nodeport)
249+
or use `HostNetwork=true`.
247250
-->
248251
## `HostPort` 服务无法工作
249252

@@ -267,9 +270,10 @@ services](/docs/concepts/services-networking/service/#type-nodeport) or use `Hos
267270
add-on provider to get the latest status of their support for hairpin mode.
268271

269272
- If you are using VirtualBox (directly or via Vagrant), you will need to
270-
ensure that `hostname -i` returns a routable IP address. By default the first
273+
ensure that `hostname -i` returns a routable IP address. By default, the first
271274
interface is connected to a non-routable host-only network. A work around
272-
is to modify `/etc/hosts`, see this [Vagrantfile](https://github.com/errordeveloper/k8s-playground/blob/22dd39dfc06111235620e6c4404a96ae146f26fd/Vagrantfile#L11)
275+
is to modify `/etc/hosts`, see this
276+
[Vagrantfile](https://github.com/errordeveloper/k8s-playground/blob/22dd39dfc06111235620e6c4404a96ae146f26fd/Vagrantfile#L11)
273277
for an example.
274278
-->
275279
## 无法通过其服务 IP 访问 Pod
@@ -301,12 +305,14 @@ Unable to connect to the server: x509: certificate signed by unknown authority (
301305
regenerate a certificate if necessary. The certificates in a kubeconfig file
302306
are base64 encoded. The `base64 --decode` command can be used to decode the certificate
303307
and `openssl x509 -text -noout` can be used for viewing the certificate information.
308+
304309
- Unset the `KUBECONFIG` environment variable using:
305310
-->
306311
- 验证 `$HOME/.kube/config` 文件是否包含有效证书,
307312
并在必要时重新生成证书。在 kubeconfig 文件中的证书是 base64 编码的。
308313
该 `base64 --decode` 命令可以用来解码证书,`openssl x509 -text -noout`
309314
命令可以用于查看证书信息。
315+
310316
- 使用如下方法取消设置 `KUBECONFIG` 环境变量的值:
311317

312318
```shell
@@ -328,7 +334,7 @@ Unable to connect to the server: x509: certificate signed by unknown authority (
328334
- 另一个方法是覆盖 `kubeconfig` 的现有用户 "管理员":
329335

330336
```shell
331-
mv $HOME/.kube $HOME/.kube.bak
337+
mv $HOME/.kube $HOME/.kube.bak
332338
mkdir $HOME/.kube
333339
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
334340
sudo chown $(id -u):$(id -g) $HOME/.kube/config
@@ -337,7 +343,8 @@ Unable to connect to the server: x509: certificate signed by unknown authority (
337343
<!--
338344
## Kubelet client certificate rotation fails {#kubelet-client-cert}
339345

340-
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`.
346+
By default, kubeadm configures a kubelet with automatic rotation of client certificates by using the
347+
`/var/lib/kubelet/pki/kubelet-client-current.pem` symlink specified in `/etc/kubernetes/kubelet.conf`.
341348
If this rotation process fails you might see errors such as `x509: certificate has expired or is not yet valid`
342349
in kube-apiserver logs. To fix the issue you must follow these steps:
343350
-->
@@ -401,11 +408,15 @@ Error from server (NotFound): the server could not find the requested resource
401408
```
402409

403410
<!--
404-
- If you're using flannel as the pod network inside Vagrant, then you will have to specify the default interface name for flannel.
411+
- If you're using flannel as the pod network inside Vagrant, then you will have to
412+
specify the default interface name for flannel.
405413

406-
Vagrant typically assigns two interfaces to all VMs. The first, for which all hosts are assigned the IP address `10.0.2.15`, is for external traffic that gets NATed.
414+
Vagrant typically assigns two interfaces to all VMs. The first, for which all hosts
415+
are assigned the IP address `10.0.2.15`, is for external traffic that gets NATed.
407416

408-
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.
417+
This may lead to problems with flannel, which defaults to the first interface on a host.
418+
This leads to all hosts thinking they have the same public IP address. To prevent this,
419+
pass the `--iface eth1` flag to flannel so that the second interface is chosen.
409420
-->
410421
- 如果你正在 Vagrant 中使用 flannel 作为 Pod 网络,则必须指定 flannel 的默认接口名称。
411422

@@ -417,7 +428,8 @@ Error from server (NotFound): the server could not find the requested resource
417428
<!--
418429
## Non-public IP used for containers
419430

420-
In some situations `kubectl logs` and `kubectl run` commands may return with the following errors in an otherwise functional cluster:
431+
In some situations `kubectl logs` and `kubectl run` commands may return with the
432+
following errors in an otherwise functional cluster:
421433
-->
422434
## 容器使用的非公共 IP
423435

@@ -428,10 +440,15 @@ Error from server: Get https://10.19.0.41:10250/containerLogs/default/mysql-ddc6
428440
```
429441

430442
<!--
431-
- This may be due to Kubernetes using an IP that can not communicate with other IPs on the seemingly same subnet, possibly by policy of the machine provider.
432-
- DigitalOcean assigns a public IP to `eth0` as well as a private one to be used internally as anchor for their floating IP feature, yet `kubelet` will pick the latter as the node's `InternalIP` instead of the public one.
443+
- This may be due to Kubernetes using an IP that can not communicate with other IPs on
444+
the seemingly same subnet, possibly by policy of the machine provider.
445+
- DigitalOcean assigns a public IP to `eth0` as well as a private one to be used internally
446+
as anchor for their floating IP feature, yet `kubelet` will pick the latter as the node's
447+
`InternalIP` instead of the public one.
433448

434-
Use `ip addr show` to check for this scenario instead of `ifconfig` because `ifconfig` will not display the offending alias IP address. Alternatively an API endpoint specific to DigitalOcean allows to query for the anchor IP from the droplet:
449+
Use `ip addr show` to check for this scenario instead of `ifconfig` because `ifconfig` will
450+
not display the offending alias IP address. Alternatively an API endpoint specific to
451+
DigitalOcean allows to query for the anchor IP from the droplet:
435452
-->
436453
- 这或许是由于 Kubernetes 使用的 IP 无法与看似相同的子网上的其他 IP 进行通信的缘故,
437454
可能是由机器提供商的政策所导致的。
@@ -471,8 +488,8 @@ Error from server: Get https://10.19.0.41:10250/containerLogs/default/mysql-ddc6
471488
<!--
472489
## `coredns` pods have `CrashLoopBackOff` or `Error` state
473490

474-
If you have nodes that are running SELinux with an older version of Docker you might experience a scenario
475-
where the `coredns` pods are not starting. To solve that you can try one of the following options:
491+
If you have nodes that are running SELinux with an older version of Docker, you might experience a scenario
492+
where the `coredns` pods are not starting. To solve that, you can try one of the following options:
476493

477494
- Upgrade to a [newer version of Docker](/docs/setup/production-environment/container-runtimes/#docker).
478495

@@ -497,7 +514,8 @@ kubectl -n kube-system get deployment coredns -o yaml | \
497514
```
498515

499516
<!--
500-
Another cause for CoreDNS to have `CrashLoopBackOff` is when a CoreDNS Pod deployed in Kubernetes detects a loop. [A number of workarounds](https://github.com/coredns/coredns/tree/master/plugin/loop#troubleshooting-loops-in-kubernetes-clusters)
517+
Another cause for CoreDNS to have `CrashLoopBackOff` is when a CoreDNS Pod deployed in Kubernetes detects a loop.
518+
[A number of workarounds](https://github.com/coredns/coredns/tree/master/plugin/loop#troubleshooting-loops-in-kubernetes-clusters)
501519
are available to avoid Kubernetes trying to restart the CoreDNS Pod every time CoreDNS detects the loop and exits.
502520
-->
503521
CoreDNS 处于 `CrashLoopBackOff` 时的另一个原因是当 Kubernetes 中部署的 CoreDNS Pod 检测到环路时。
@@ -526,7 +544,7 @@ rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:24
526544
```
527545

528546
<!--
529-
this issue appears if you run CentOS 7 with Docker 1.13.1.84.
547+
This issue appears if you run CentOS 7 with Docker 1.13.1.84.
530548
This version of Docker can prevent the kubelet from executing into the etcd container.
531549

532550
To work around the issue, choose one of these options:
@@ -622,7 +640,24 @@ conditions abate:
622640
而不管它们的条件如何,将其与其他节点保持隔离,直到它们的初始保护条件消除:
623641

624642
```shell
625-
kubectl -n kube-system patch ds kube-proxy -p='{ "spec": { "template": { "spec": { "tolerations": [ { "key": "CriticalAddonsOnly", "operator": "Exists" }, { "effect": "NoSchedule", "key": "node-role.kubernetes.io/control-plane" } ] } } } }'
643+
kubectl -n kube-system patch ds kube-proxy -p='{
644+
"spec": {
645+
"template": {
646+
"spec": {
647+
"tolerations": [
648+
{
649+
"key": "CriticalAddonsOnly",
650+
"operator": "Exists"
651+
},
652+
{
653+
"effect": "NoSchedule",
654+
"key": "node-role.kubernetes.io/control-plane"
655+
}
656+
]
657+
}
658+
}
659+
}
660+
}'
626661
```
627662

628663
<!--
@@ -638,7 +673,6 @@ For [flex-volume support](https://github.com/kubernetes/community/blob/ab55d85/c
638673
Kubernetes components like the kubelet and kube-controller-manager use the default path of
639674
`/usr/libexec/kubernetes/kubelet-plugins/volume/exec/`, yet the flex-volume directory _must be writeable_
640675
for the feature to work.
641-
(**Note**: FlexVolume was deprecated in the Kubernetes v1.23 release)
642676
-->
643677
## 节点上的 `/usr` 被以只读方式挂载 {#usr-mounted-read-only}
644678

@@ -648,13 +682,19 @@ for the feature to work.
648682
类似 kubelet 和 kube-controller-manager 这类 Kubernetes 组件使用默认路径
649683
`/usr/libexec/kubernetes/kubelet-plugins/volume/exec/`
650684
而 FlexVolume 的目录 **必须是可写入的**,该功能特性才能正常工作。
651-
(**注意**:FlexVolume 在 Kubernetes v1.23 版本中已被弃用)
685+
686+
{{< note >}}
687+
<!--
688+
FlexVolume was deprecated in the Kubernetes v1.23 release.
689+
-->
690+
FlexVolume 在 Kubernetes v1.23 版本中已被弃用。
691+
{{< /note >}}
652692

653693
<!--
654-
To workaround this issue you can configure the flex-volume directory using the kubeadm
694+
To workaround this issue, you can configure the flex-volume directory using the kubeadm
655695
[configuration file](/docs/reference/config-api/kubeadm-config.v1beta3/).
656696

657-
On the primary control-plane Node (created using `kubeadm init`) pass the following
697+
On the primary control-plane Node (created using `kubeadm init`), pass the following
658698
file using `--config`:
659699
-->
660700
为了解决这个问题,你可以使用 kubeadm 的[配置文件](/zh-cn/docs/reference/config-api/kubeadm-config.v1beta3/)来配置
@@ -700,7 +740,10 @@ be advised that this is modifying a design principle of the Linux distribution.
700740
<!--
701741
## `kubeadm upgrade plan` prints out `context deadline exceeded` error message
702742

703-
This error message is shown when upgrading a Kubernetes cluster with `kubeadm` in the case of running an external etcd. This is not a critical bug and happens because older versions of kubeadm perform a version check on the external etcd cluster. You can proceed with `kubeadm upgrade apply ...`.
743+
This error message is shown when upgrading a Kubernetes cluster with `kubeadm` in
744+
the case of running an external etcd. This is not a critical bug and happens because
745+
older versions of kubeadm perform a version check on the external etcd cluster.
746+
You can proceed with `kubeadm upgrade apply ...`.
704747

705748
This issue is fixed as of version 1.19.
706749
-->
@@ -800,11 +843,14 @@ k8s.io/kubernetes/cmd/kubeadm/app/phases/upgrade.performEtcdStaticPodUpgrade
800843
```
801844
802845
<!--
803-
The reason for this failure is that the affected versions generate an etcd manifest file with unwanted defaults in the PodSpec.
804-
This will result in a diff from the manifest comparison, and kubeadm will expect a change in the Pod hash, but the kubelet will never update the hash.
846+
The reason for this failure is that the affected versions generate an etcd manifest file with
847+
unwanted defaults in the PodSpec. This will result in a diff from the manifest comparison,
848+
and kubeadm will expect a change in the Pod hash, but the kubelet will never update the hash.
805849
806850
There are two way to workaround this issue if you see it in your cluster:
807851
- The etcd upgrade can be skipped between the affected versions and v1.28.3 (or later) by using:
852+
853+
This is not recommended in case a new etcd version was introduced by a later v1.28 patch version.
808854
-->
809855
本次失败的原因是受影响的版本在 PodSpec 中生成的 etcd 清单文件带有不需要的默认值。
810856
这将导致与清单比较的差异,并且 kubeadm 预期 Pod 哈希值将发生变化,但 kubelet 永远不会更新哈希值。
@@ -813,17 +859,15 @@ There are two way to workaround this issue if you see it in your cluster:
813859
814860
- 可以运行以下命令跳过 etcd 的版本升级,即受影响版本和 v1.28.3(或更高版本)之间的版本升级:
815861
816-
```shell
817-
kubeadm upgrade {apply|node} [version] --etcd-upgrade=false
818-
```
862+
```shell
863+
kubeadm upgrade {apply|node} [version] --etcd-upgrade=false
864+
```
865+
866+
但不推荐这种方法,因为后续的 v1.28 补丁版本可能引入新的 etcd 版本。
819867

820868
<!--
821-
This is not recommended in case a new etcd version was introduced by a later v1.28 patch version.
822-
823869
- Before upgrade, patch the manifest for the etcd static pod, to remove the problematic defaulted attributes:
824870
-->
825-
但不推荐这种方法,因为后续的 v1.28 补丁版本可能引入新的 etcd 版本。
826-
827871
- 在升级之前,对 etcd 静态 Pod 的清单进行修补,以删除有问题的默认属性:
828872

829873
```patch
@@ -869,6 +913,7 @@ This is not recommended in case a new etcd version was introduced by a later v1.
869913
```
870914

871915
<!--
872-
More information can be found in the [tracking issue](https://github.com/kubernetes/kubeadm/issues/2927) for this bug.
916+
More information can be found in the
917+
[tracking issue](https://github.com/kubernetes/kubeadm/issues/2927) for this bug.
873918
-->
874919
有关此错误的更多信息,请查阅[此问题的跟踪页面](https://github.com/kubernetes/kubeadm/issues/2927)

0 commit comments

Comments
 (0)