0

我已经使用 k3s 1.18.4 和 MariaDB 作为后端建立了一个 Rancher 2.4 小基础设施。

一切正常运行了 25 天,但是现在,我无法再登录 Rancher,就像 API 在 443 上不再响应,并且容器现在崩溃,此后无法联系 kubernetes 集群。

我在另一台服务器上有一个 Nginx 负载均衡器,这几天也可以正常工作,但现在一切都超时了:

==> https_lb.log <==

yyyy.yyy.yyy.yyy [18/Aug/2020:07:09:42 +0200] TCP 502 0 0 31.510 "xx.xx.xx.xx:443" "0" "0" "31.508"

==> 错误日志 <==

2020/08/18 07:10:02 [error] 29966#29966: *81 connect() failed (110: Connection timed out) while connecting to upstream, client: yyyy.yyy.yyy.yyy, server: 0.0.0.0:443, upstream: "xx.xx.xx.xx:443", bytes from/to client:0/0, bytes from/to upstream:0/0

API 在 6443 端口上的回答很好,例如:

curl https://localhost:6443/ping --insecure
pong

该服务似乎也出现了:

kubectl get services
NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
kubernetes   ClusterIP   10.43.0.1    <none>        443/TCP   7h53m

kubectl get nodes
NAME    STATUS   ROLES    AGE   VERSION
k3sh1   Ready    master   32d   v1.18.4+k3s1
k3sw4   Ready    <none>   28d   v1.18.6+k3s1
k3sw3   Ready    <none>   28d   v1.18.6+k3s1
k3sw2   Ready    <none>   28d   v1.18.6+k3s1

当然,everythink 现在是 KO,因为到处都有超时,例如:

2020-08-17T22:40:04.421339807+02:00 stderr F ERROR: logging before flag.Parse: E0817 20:40:04.418868       1 reflector.go:251] github.com/kubernetes-incubator/external-storage/lib/controller/controller.go:603: Failed to watch *v1.PersistentVolumeClaim: Get https://10.43.0.1:443/api/v1/persistentvolumeclaims?resourceVersion=15748753&timeoutSeconds=499&watch=true: dial tcp 10.43.0.1:443: connect: connection refused
2020-08-17T22:40:04.421345285+02:00 stderr F ERROR: logging before flag.Parse: E0817 20:40:04.418809       1 reflector.go:251] github.com/kubernetes-incubator/external-storage/lib/controller/controller.go:609: Failed to watch *v1.StorageClass: Get https://10.43.0.1:443/apis/storage.k8s.io/v1/storageclasses?resourceVersion=15748753&timeoutSeconds=381&watch=true: dial tcp 10.43.0.1:443: connect: connection refused

等等...

有人可以帮我看看解决这个问题的好方向吗?

更新 1

正在运行的 pod 列表

kubectl get pods --all-namespaces -owide
NAMESPACE       NAME                                       READY   STATUS             RESTARTS   AGE    IP               NODE    NOMINATED NODE   READINESS GATES
recette         app-test-65c94f999c-g6t56                  1/1     Running            0          15d    10.42.1.6        k3sw3   <none>           <none>
recette         database-proftpd-7c598d6698-mtp5m          1/1     Running            0          3d9h   10.42.2.3        k3sw4   <none>           <none>
recette         redis-d84785cf5-9t7sj                      1/1     Running            0          3d9h   10.42.1.7        k3sw3   <none>           <none>
kube-system     metrics-server-7566d596c8-tbfpp            1/1     Running            0          32h    10.42.1.15       k3sw3   <none>           <none>
cert-manager    cert-manager-webhook-746cf468-2t7c7        1/1     Running            0          8h     10.42.0.52       k3sh1   <none>           <none>
cert-manager    cert-manager-cainjector-5579468649-dj5fj   1/1     Running            0          8h     10.42.0.53       k3sh1   <none>           <none>
cert-manager    cert-manager-66bbb47c56-t5h6x              1/1     Running            0          8h     10.42.0.54       k3sh1   <none>           <none>
kube-system     local-path-provisioner-6d59f47c7-4vf2b     1/1     Running            0          8h     10.42.0.55       k3sh1   <none>           <none>
kube-system     coredns-8655855d6-lf2lt                    1/1     Running            0          8h     10.42.0.56       k3sh1   <none>           <none>
cattle-system   rancher-c5766f5f9-vnrht                    1/1     Running            0          8h     10.42.2.7        k3sw4   <none>           <none>
cattle-system   rancher-c5766f5f9-hqxvc                    1/1     Running            0          8h     10.42.3.6        k3sw2   <none>           <none>
recette         database-7fc89fc4bc-5xr7m                  1/1     Running            0          3d9h   10.42.2.4        k3sw4   <none>           <none>
cattle-system   rancher-c5766f5f9-n8fnm                    1/1     Running            0          8h     10.42.0.57       k3sh1   <none>           <none>
kube-system     traefik-758cd5fc85-2vdqr                   1/1     Running            0          8h     10.42.1.18       k3sw3   <none>           <none>
cattle-system   cattle-node-agent-6lrfg                    0/1     CrashLoopBackOff   359        32h    some_public_ip     k3sw4   <none>           <none>
cattle-system   cattle-node-agent-gd2mh                    0/1     CrashLoopBackOff   181        15h    some_other_public_ip   k3sw3   <none>           <none>
cattle-system   cattle-node-agent-67bqb                    0/1     CrashLoopBackOff   364        32h    some_other_public_ip     k3sh1   <none>           <none>
cattle-system   cattle-node-agent-vvfwm                    0/1     Error              361        32h    some_other_public_ip   k3sw2   <none>           <none>
cattle-system   cattle-cluster-agent-74b5586858-jnbv2      1/1     Running            100        8h     10.42.1.19       k3sw3   <none>           <none>

在我的牧场主舱里,我可以看到他们不能互相交谈:

kubectl logs -f -n cattle-system rancher-c5766f5f9-vnrht
2020/08/19 05:18:36 [ERROR] Failed to connect to peer wss://10.42.3.6/v3/connect [local ID=10.42.2.7]: dial tcp 10.42.3.6:443: i/o timeout
2020/08/19 05:18:37 [ERROR] Failed to connect to peer wss://10.42.0.57/v3/connect [local ID=10.42.2.7]: dial tcp 10.42.0.57:443: i/o timeout
2020/08/19 05:18:51 [ERROR] Failed to connect to peer wss://10.42.3.6/v3/connect [local ID=10.42.2.7]: dial tcp 10.42.3.6:443: i/o timeout
2020/08/19 05:18:52 [ERROR] Failed to connect to peer wss://10.42.0.57/v3/connect [local ID=10.42.2.7]: dial tcp 10.42.0.57:443: i/o timeout
2020/08/19 05:19:06 [ERROR] Failed to connect to peer wss://10.42.3.6/v3/connect [local ID=10.42.2.7]: dial tcp 10.42.3.6:443: i/o timeout
2020/08/19 05:19:07 [ERROR] Failed to connect to peer wss://10.42.0.57/v3/connect [local ID=10.42.2.7]: dial tcp 10.42.0.57:443: i/o timeout

更新 2:

我设法通过重置所有 iptables 规则来修复拨号错误,然后重新启动 k3s。我现在有这个阻止牧场主启动的错误:

E0819 06:35:44.274663       7 reflector.go:178] github.com/rancher/steve/pkg/clustercache/controller.go:164: Failed to list *summary.SummarizedObject: conversion webhook for cert-manager.io/v1alpha2, Kind=CertificateRequest failed: Post https://cert-manager-webhook.cert-manager.svc:443/convert?timeout=30s: service "cert-manager-webhook" not found                                                                   │
│ E0819 06:35:45.324406       7 reflector.go:178] github.com/rancher/steve/pkg/clustercache/controller.go:164: Failed to list *summary.SummarizedObject: conversion webhook for acme.cert-manager.io/v1alpha2, Kind=Order failed: Post https://cert-manager-webhook.cert-manager.svc:443/convert?timeout=30s: service "cert-manager-webhook" not found                                                                           │
│ E0819 06:35:49.022959       7 reflector.go:178] github.com/rancher/steve/pkg/clustercache/controller.go:164: Failed to list *summary.SummarizedObject: conversion webhook for cert-manager.io/v1alpha2, Kind=Certificate failed: Post https://cert-manager-webhook.cert-manager.svc:443/convert?timeout=30s: service "cert-manager-webhook" not found  
4

2 回答 2

1

重新安装了 cert-manager,并发布了一个自签名证书来解决这个问题。

于 2020-08-20T20:25:09.517 回答
0

将其发布为社区 Wiki 以获得更好的可见性。

K3s和这里描述的情况与reset后的行为Lightweight Kubernetes非常相似。Kubeadm

kubeadm reset负责从使用kubeadm initorkubeadm join命令创建的文件中清理节点本地文件系统。对于控制平面节点,reset 还会从 etcd 集群中删除该节点的本地堆叠 etcd 成员,并从kubeadm ClusterStatus对象中删除该节点的信息。ClusterStatus是一个kubeadm托管的 Kubernetes API 对象,它包含一个kube-apiserver端点列表。

这意味着,当您使用reset它时,它会删除许多配置,而且certificates. 正如我在评论中提到的,该问题与缺少证书有关:

Failed to list *summary.SummarizedObject: conversion webhook for acme.cert-manager.io/v1alpha2, Kind=Order failed: Post https://cert-manager-webhook.cert-manager.svc:443/convert?timeout=30s: service "cert-manager-webhook" not found

作为reset命令删除它。

解决方案是重新安装Cert-Manager并重新创建证书

于 2020-08-24T11:08:17.233 回答