簡體   English   中英

Rancher cattle-cluster-agent 無法連接到 xxx 端口 443:連接超時)

[英]Rancher cattle-cluster-agent Failed to connect to xxx port 443: Connection timed out)

這是我的環境:

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:    20.04
Codename:   focal
docker version
Client: Docker Engine - Community
 Version:           20.10.13
 API version:       1.41
 Go version:        go1.16.15
 Git commit:        a224086
 Built:             Thu Mar 10 14:07:51 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
kubectl version --short
Client Version: v1.23.5
Server Version: v1.23.5
sudo ufw status

Status: inactive
kubectl get nodes
NAME           STATUS   ROLES                         AGE   VERSION
k8s-master     Ready    control-plane,master,worker   34h   v1.23.5
k8s-node-216   Ready    worker                        33h   v1.23.5
kubectl cluster-info
Kubernetes control plane is running at https://k8s-api:6443
CoreDNS is running at https://k8s-api:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
sudo docker run -d \
    -p 8888:80 -p 443:443 \
    --name rancher \
    --privileged \
    --restart=unless-stopped \
    -e CATTLE_BOOTSTRAP_PASSWORD=cquissE! \
    -v /home/ngtl/soft/rancher:/var/lib/rancher \
    rancher/rancher:latest
kubectl get pods -A
NAMESPACE          NAME                                       READY   STATUS             RESTARTS         AGE
calico-apiserver   calico-apiserver-6f45746584-9bwjb          1/1     Running            0                33h
calico-apiserver   calico-apiserver-6f45746584-cf9v6          1/1     Running            0                33h
calico-system      calico-kube-controllers-67f85d7449-ddjmw   1/1     Running            0                33h
calico-system      calico-node-22f4d                          0/1     Running            0                33h
calico-system      calico-node-szb5b                          0/1     Running            0                33h
calico-system      calico-typha-856cc5f7bb-cqj8h              1/1     Running            0                33h
cattle-system      cattle-cluster-agent-7d8645db69-nkh4z      0/1     CrashLoopBackOff   22 (4m56s ago)   168m
kube-system        coredns-6d8c4cb4d-hlvmx                    1/1     Running            0                34h
kube-system        coredns-6d8c4cb4d-ttttq                    1/1     Running            0                34h
kube-system        etcd-k8s-master                            1/1     Running            2                34h
kube-system        kube-apiserver-k8s-master                  1/1     Running            2                34h
kube-system        kube-controller-manager-k8s-master         1/1     Running            2                34h
kube-system        kube-proxy-7fmwl                           1/1     Running            0                33h
kube-system        kube-proxy-bnd7k                           1/1     Running            0                34h
kube-system        kube-scheduler-k8s-master                  1/1     Running            2                34h
tigera-operator    tigera-operator-b876f5799-kc8cz            1/1     Running            0                33h

我有兩個節點:
k8s-master => 192.168.2.85
k8s-node-216 => 192.168.2.216

我的 rancher 運行在 k8s-master 上,rancher agent 運行在 k8s-node-216 上。
可以看到Cattle-Cluster-Agent state是CrashLoopBackOff。
它說:

kubectl -n cattle-system logs -f pod/cattle-cluster-agent-7d8645db69-nkh4z
INFO: Environment: CATTLE_ADDRESS=192.168.127.130 CATTLE_CA_CHECKSUM=ca19550fd4ff72e9daf89936fab0ecea12aa8d97af7b3b91108ebd862b784e57 CATTLE_CLUSTER=true CATTLE_CLUSTER_AGENT_PORT=tcp://10.104.73.193:80 CATTLE_CLUSTER_AGENT_PORT_443_TCP=tcp://10.104.73.193:443 CATTLE_CLUSTER_AGENT_PORT_443_TCP_ADDR=10.104.73.193 CATTLE_CLUSTER_AGENT_PORT_443_TCP_PORT=443 CATTLE_CLUSTER_AGENT_PORT_443_TCP_PROTO=tcp CATTLE_CLUSTER_AGENT_PORT_80_TCP=tcp://10.104.73.193:80 CATTLE_CLUSTER_AGENT_PORT_80_TCP_ADDR=10.104.73.193 CATTLE_CLUSTER_AGENT_PORT_80_TCP_PORT=80 CATTLE_CLUSTER_AGENT_PORT_80_TCP_PROTO=tcp CATTLE_CLUSTER_AGENT_SERVICE_HOST=10.104.73.193 CATTLE_CLUSTER_AGENT_SERVICE_PORT=80 CATTLE_CLUSTER_AGENT_SERVICE_PORT_HTTP=80 CATTLE_CLUSTER_AGENT_SERVICE_PORT_HTTPS_INTERNAL=443 CATTLE_CLUSTER_REGISTRY= CATTLE_INGRESS_IP_DOMAIN=sslip.io CATTLE_INSTALL_UUID=8ce09b15-0952-41c5-83d6-b74dee853902 CATTLE_INTERNAL_ADDRESS= CATTLE_IS_RKE=false CATTLE_K8S_MANAGED=true CATTLE_NODE_NAME=cattle-cluster-agent-7d8645db69-nkh4z CATTLE_SERVER=https://192.168.2.85 CATTLE_SERVER_VERSION=v2.6.3
INFO: Using resolv.conf: nameserver 10.96.0.10 search cattle-system.svc.cluster.local svc.cluster.local cluster.local options ndots:5
ERROR: https://192.168.2.85/ping is not accessible (Failed to connect to 192.168.2.85 port 443: Connection timed out)

但是 te.net 運行良好:

telnet 192.168.2.85 443

Trying 192.168.2.85...
Connected to 192.168.2.85.
Escape character is '^]'.

我的牧場主怎么了?

問題已經解決。
那是因為 calico calico-node 沒有得到正確的 IP 地址。
所以只需編輯custom-resources.yaml並指定一種自動檢測節點 IPv4 地址的方法。
看:
https://projectcalico.docs.tigera.io/reference/installation/api#operator.tigera.io/v1.CalicoNetworkSpec

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM