Kubernetes然后是牧场主超时

问题描述

我已经使用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"

==> error.log

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

当然,每个想法现在都是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

正在运行的豆荚列表

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  

解决方法

重新安装了证书管理器,并发布了自签名证书来解决此问题。

,

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

K3sLightweight Kubernetes,此处描述的情况与reset之后的Kubeadm行为非常相似。

kubeadm reset负责从使用kubeadm initkubeadm join命令创建的文件中清除节点本地文件系统。对于控制平面节点,重置还会从etcd群集中删除该节点的本地堆叠etcd成员,也将从kubeadm ClusterStatus对象中删除此节点的信息。 ClusterStatuskubeadm托管的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并重新创建certificate

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...