[zh] Sync troubleshooting-kubeadm.md
This commit is contained in:
+90
-28
@@ -21,7 +21,8 @@ If your problem is not listed below, please follow the following steps:
|
|||||||
- Go to [github.com/kubernetes/kubeadm](https://github.com/kubernetes/kubeadm/issues) and search for existing issues.
|
- Go to [github.com/kubernetes/kubeadm](https://github.com/kubernetes/kubeadm/issues) and search for existing issues.
|
||||||
- If no issue exists, please [open one](https://github.com/kubernetes/kubeadm/issues/new) and follow the issue template.
|
- If no issue exists, please [open one](https://github.com/kubernetes/kubeadm/issues/new) and follow the issue template.
|
||||||
|
|
||||||
- If you are unsure about how kubeadm works, you can ask on [Slack](http://slack.k8s.io/) in #kubeadm, or open a question on [StackOverflow](https://stackoverflow.com/questions/tagged/kubernetes). Please include
|
- If you are unsure about how kubeadm works, you can ask on [Slack](https://slack.k8s.io/) in `#kubeadm`,
|
||||||
|
or open a question on [StackOverflow](https://stackoverflow.com/questions/tagged/kubernetes). Please include
|
||||||
relevant tags like `#kubernetes` and `#kubeadm` so folks can help you.
|
relevant tags like `#kubernetes` and `#kubeadm` so folks can help you.
|
||||||
-->
|
-->
|
||||||
与任何程序一样,你可能会在安装或者运行 kubeadm 时遇到错误。
|
与任何程序一样,你可能会在安装或者运行 kubeadm 时遇到错误。
|
||||||
@@ -33,12 +34,73 @@ If your problem is not listed below, please follow the following steps:
|
|||||||
- 转到 [github.com/kubernetes/kubeadm](https://github.com/kubernetes/kubeadm/issues) 并搜索存在的问题。
|
- 转到 [github.com/kubernetes/kubeadm](https://github.com/kubernetes/kubeadm/issues) 并搜索存在的问题。
|
||||||
- 如果没有问题,请 [打开](https://github.com/kubernetes/kubeadm/issues/new) 并遵循问题模板。
|
- 如果没有问题,请 [打开](https://github.com/kubernetes/kubeadm/issues/new) 并遵循问题模板。
|
||||||
|
|
||||||
- 如果你对 kubeadm 的工作方式有疑问,可以在 [Slack](https://slack.k8s.io/) 上的 #kubeadm 频道提问,
|
- 如果你对 kubeadm 的工作方式有疑问,可以在 [Slack](https://slack.k8s.io/) 上的 `#kubeadm` 频道提问,
|
||||||
或者在 [StackOverflow](https://stackoverflow.com/questions/tagged/kubernetes) 上提问。
|
或者在 [StackOverflow](https://stackoverflow.com/questions/tagged/kubernetes) 上提问。
|
||||||
请加入相关标签,例如 `#kubernetes` 和 `#kubeadm`,这样其他人可以帮助你。
|
请加入相关标签,例如 `#kubernetes` 和 `#kubeadm`,这样其他人可以帮助你。
|
||||||
|
|
||||||
<!-- body -->
|
<!-- body -->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
## Not possible to join a v1.18 Node to a v1.17 cluster due to missing RBAC
|
||||||
|
-->
|
||||||
|
## 由于缺少 RBAC,无法将 v1.18 Node 加入 v1.17 集群
|
||||||
|
|
||||||
|
<!--
|
||||||
|
In v1.18 kubeadm added prevention for joining a Node in the cluster if a Node with the same name already exists.
|
||||||
|
This required adding RBAC for the bootstrap-token user to be able to GET a Node object.
|
||||||
|
|
||||||
|
However this causes an issue where `kubeadm join` from v1.18 cannot join a cluster created by kubeadm v1.17.
|
||||||
|
-->
|
||||||
|
自从 v1.18 后,如果集群中已存在同名 Node,kubeadm 将禁止 Node 加入集群。
|
||||||
|
这需要为 bootstrap-token 用户添加 RBAC 才能 GET Node 对象。
|
||||||
|
|
||||||
|
但这会导致一个问题,v1.18 的 `kubeadm join` 无法加入由 kubeadm v1.17 创建的集群。
|
||||||
|
|
||||||
|
<!--
|
||||||
|
To workaround the issue you have two options:
|
||||||
|
|
||||||
|
Execute `kubeadm init phase bootstrap-token` on a control-plane node using kubeadm v1.18.
|
||||||
|
Note that this enables the rest of the bootstrap-token permissions as well.
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
Apply the following RBAC manually using `kubectl apply -f ...`:
|
||||||
|
-->
|
||||||
|
要解决此问题,你有两种选择:
|
||||||
|
|
||||||
|
使用 kubeadm v1.18 在控制平面节点上执行 `kubeadm init phase bootstrap-token`。
|
||||||
|
请注意,这也会启用 bootstrap-token 的其余权限。
|
||||||
|
|
||||||
|
或者,也可以使用 `kubectl apply -f ...` 手动应用以下 RBAC:
|
||||||
|
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRole
|
||||||
|
metadata:
|
||||||
|
name: kubeadm:get-nodes
|
||||||
|
rules:
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
resources:
|
||||||
|
- nodes
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
---
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: kubeadm:get-nodes
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: kubeadm:get-nodes
|
||||||
|
subjects:
|
||||||
|
- apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: Group
|
||||||
|
name: system:bootstrappers:kubeadm:default-node-token
|
||||||
|
```
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
## `ebtables` or some similar executable not found during installation
|
## `ebtables` or some similar executable not found during installation
|
||||||
|
|
||||||
@@ -100,7 +162,7 @@ and investigating each container by running `docker logs`. For other container r
|
|||||||
|
|
||||||
- 网络连接问题。在继续之前,请检查你的计算机是否具有全部联通的网络连接。
|
- 网络连接问题。在继续之前,请检查你的计算机是否具有全部联通的网络连接。
|
||||||
- 容器运行时的 cgroup 驱动不同于 kubelet 使用的 cgroup 驱动。要了解如何正确配置 cgroup 驱动,
|
- 容器运行时的 cgroup 驱动不同于 kubelet 使用的 cgroup 驱动。要了解如何正确配置 cgroup 驱动,
|
||||||
请参阅[配置 cgroup 驱动](/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/)。
|
请参阅[配置 cgroup 驱动](/zh/docs/tasks/administer-cluster/kubeadm/configure-cgroup-driver/)。
|
||||||
- 控制平面上的 Docker 容器持续进入崩溃状态或(因其他原因)挂起。你可以运行 `docker ps` 命令来检查以及 `docker logs` 命令来检视每个容器的运行日志。
|
- 控制平面上的 Docker 容器持续进入崩溃状态或(因其他原因)挂起。你可以运行 `docker ps` 命令来检查以及 `docker logs` 命令来检视每个容器的运行日志。
|
||||||
对于其他容器运行时,请参阅[使用 crictl 对 Kubernetes 节点进行调试](/zh/docs/tasks/debug/debug-cluster/crictl/)。
|
对于其他容器运行时,请参阅[使用 crictl 对 Kubernetes 节点进行调试](/zh/docs/tasks/debug/debug-cluster/crictl/)。
|
||||||
|
|
||||||
@@ -124,7 +186,7 @@ sudo kubeadm reset
|
|||||||
|
|
||||||
A possible solution is to restart the container runtime and then re-run `kubeadm reset`.
|
A possible solution is to restart the container runtime and then re-run `kubeadm reset`.
|
||||||
You can also use `crictl` to debug the state of the container runtime. See
|
You can also use `crictl` to debug the state of the container runtime. See
|
||||||
[Debugging Kubernetes nodes with crictl](/zh/docs/tasks/debug-application-cluster/crictl/).
|
[Debugging Kubernetes nodes with crictl](/docs/tasks/debug/debug-cluster/crictl/).
|
||||||
-->
|
-->
|
||||||
## 当删除托管容器时 kubeadm 阻塞
|
## 当删除托管容器时 kubeadm 阻塞
|
||||||
|
|
||||||
@@ -259,7 +321,7 @@ Unable to connect to the server: x509: certificate signed by unknown authority (
|
|||||||
|
|
||||||
- Verify that the `$HOME/.kube/config` file contains a valid certificate, and
|
- Verify that the `$HOME/.kube/config` file contains a valid certificate, and
|
||||||
regenerate a certificate if necessary. The certificates in a kubeconfig file
|
regenerate a certificate if necessary. The certificates in a kubeconfig file
|
||||||
are base64 encoded. The `base64 -d` command can be used to decode the certificate
|
are base64 encoded. The `base64 --decode` command can be used to decode the certificate
|
||||||
and `openssl x509 -text -noout` can be used for viewing the certificate information.
|
and `openssl x509 -text -noout` can be used for viewing the certificate information.
|
||||||
- Unset the `KUBECONFIG` environment variable using:
|
- Unset the `KUBECONFIG` environment variable using:
|
||||||
|
|
||||||
@@ -293,7 +355,7 @@ Unable to connect to the server: x509: certificate signed by unknown authority (
|
|||||||
|
|
||||||
- 验证 `$HOME/.kube/config` 文件是否包含有效证书,并
|
- 验证 `$HOME/.kube/config` 文件是否包含有效证书,并
|
||||||
在必要时重新生成证书。在 kubeconfig 文件中的证书是 base64 编码的。
|
在必要时重新生成证书。在 kubeconfig 文件中的证书是 base64 编码的。
|
||||||
该 `base64 -d` 命令可以用来解码证书,`openssl x509 -text -noout` 命令
|
该 `base64 --decode` 命令可以用来解码证书,`openssl x509 -text -noout` 命令
|
||||||
可以用于查看证书信息。
|
可以用于查看证书信息。
|
||||||
- 使用如下方法取消设置 `KUBECONFIG` 环境变量的值:
|
- 使用如下方法取消设置 `KUBECONFIG` 环境变量的值:
|
||||||
|
|
||||||
@@ -316,22 +378,6 @@ Unable to connect to the server: x509: certificate signed by unknown authority (
|
|||||||
sudo chown $(id -u):$(id -g) $HOME/.kube/config
|
sudo chown $(id -u):$(id -g) $HOME/.kube/config
|
||||||
```
|
```
|
||||||
|
|
||||||
<!--
|
|
||||||
## Default NIC When using flannel as the pod network in Vagrant
|
|
||||||
|
|
||||||
The following error might indicate that something was wrong in the pod network:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
Error from server (NotFound): the server could not find the requested resource
|
|
||||||
```
|
|
||||||
|
|
||||||
- If you're using flannel as the pod network inside Vagrant, then you will have to specify the default interface name for flannel.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
## Kubelet client certificate rotation fails {#kubelet-client-cert}
|
## Kubelet client certificate rotation fails {#kubelet-client-cert}
|
||||||
|
|
||||||
@@ -385,6 +431,22 @@ the `ca.key` you must sign the embedded certificates in the `kubelet.conf` exter
|
|||||||
6. 重新启动 kubelet。
|
6. 重新启动 kubelet。
|
||||||
7. 确保节点状况变为 `Ready`。
|
7. 确保节点状况变为 `Ready`。
|
||||||
|
|
||||||
|
<!--
|
||||||
|
## Default NIC When using flannel as the pod network in Vagrant
|
||||||
|
|
||||||
|
The following error might indicate that something was wrong in the pod network:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
Error from server (NotFound): the server could not find the requested resource
|
||||||
|
```
|
||||||
|
|
||||||
|
- If you're using flannel as the pod network inside Vagrant, then you will have to specify the default interface name for flannel.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
|
||||||
## 在 Vagrant 中使用 flannel 作为 pod 网络时的默认 NIC
|
## 在 Vagrant 中使用 flannel 作为 pod 网络时的默认 NIC
|
||||||
|
|
||||||
以下错误可能表明 Pod 网络中出现问题:
|
以下错误可能表明 Pod 网络中出现问题:
|
||||||
@@ -535,7 +597,7 @@ yum downgrade docker-1.13.1-75.git8633870.el7.centos.x86_64 docker-client-1.13.1
|
|||||||
|
|
||||||
- Install one of the more recent recommended versions, such as 18.06:
|
- Install one of the more recent recommended versions, such as 18.06:
|
||||||
```bash
|
```bash
|
||||||
sudo yum-config-manager -add-repo https://download.docker.com/linux/centos/docker-ce.repo
|
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
|
||||||
yum install docker-ce-18.06.1.ce-3.el7.x86_64
|
yum install docker-ce-18.06.1.ce-3.el7.x86_64
|
||||||
```
|
```
|
||||||
-->
|
-->
|
||||||
@@ -573,13 +635,13 @@ component like the kube-apiserver. However, this mechanism is limited due to the
|
|||||||
the values (`mapStringString`).
|
the values (`mapStringString`).
|
||||||
|
|
||||||
If you decide to pass an argument that supports multiple, comma-separated values such as
|
If you decide to pass an argument that supports multiple, comma-separated values such as
|
||||||
`-apiserver-extra-args "enable-admission-plugins=LimitRanger,NamespaceExists"` this flag will fail with
|
`--apiserver-extra-args "enable-admission-plugins=LimitRanger,NamespaceExists"` this flag will fail with
|
||||||
`flag: malformed pair, expect string=string`. This happens because the list of arguments for
|
`flag: malformed pair, expect string=string`. This happens because the list of arguments for
|
||||||
`-apiserver-extra-args` expects `key=value` pairs and in this case `NamespacesExists` is considered
|
`--apiserver-extra-args` expects `key=value` pairs and in this case `NamespacesExists` is considered
|
||||||
as a key that is missing a value.
|
as a key that is missing a value.
|
||||||
|
|
||||||
Alternatively, you can try separating the `key=value` pairs like so:
|
Alternatively, you can try separating the `key=value` pairs like so:
|
||||||
`-apiserver-extra-args "enable-admission-plugins=LimitRanger,enable-admission-plugins=NamespaceExists"`
|
`--apiserver-extra-args "enable-admission-plugins=LimitRanger,enable-admission-plugins=NamespaceExists"`
|
||||||
but this will result in the key `enable-admission-plugins` only having the value of `NamespaceExists`.
|
but this will result in the key `enable-admission-plugins` only having the value of `NamespaceExists`.
|
||||||
|
|
||||||
A known workaround is to use the kubeadm [configuration file](/docs/reference/config-api/kubeadm-config.v1beta3/).
|
A known workaround is to use the kubeadm [configuration file](/docs/reference/config-api/kubeadm-config.v1beta3/).
|
||||||
@@ -673,9 +735,9 @@ To workaround this issue you can configure the flex-volume directory using the k
|
|||||||
On the primary control-plane Node (created using `kubeadm init`) pass the following
|
On the primary control-plane Node (created using `kubeadm init`) pass the following
|
||||||
file using `--config`:
|
file using `--config`:
|
||||||
-->
|
-->
|
||||||
为了解决这个问题,你可以使用 kubeadm 的[配置文件](/docs/reference/config-api/kubeadm-config.v1beta3/) 来配置 FlexVolume 的目录。
|
为了解决这个问题,你可以使用 kubeadm 的[配置文件](/zh/docs/reference/config-api/kubeadm-config.v1beta3/) 来配置 FlexVolume 的目录。
|
||||||
|
|
||||||
在(使用 `kubeadm init` 创建的)主控制节点上,使用 `-config`
|
在(使用 `kubeadm init` 创建的)主控制节点上,使用 `--config`
|
||||||
参数传入如下文件:
|
参数传入如下文件:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
Reference in New Issue
Block a user