Rancher Server 设置
- Rancher 版本: rancher2.5.17版本
- 安装选项 (Docker install/Helm Chart):
- 如果是 Helm Chart 安装,需要提供 Local 集群的类型(RKE1, RKE2, k3s, EKS, 等)和版本:
- 在线或离线部署:
我这里使用docker run 方式安装的rancher
#!/bin/bash
运行rancher
docker run -itd --name rancher
-p 80:80 -p 443:443
–restart=unless-stopped
-v /data/rancher-server:/var/lib/rancher
-v /var/log/rancher/auditlog:/var/log/auditlog
-e AUDIT_LEVEL=3
–privileged
rancher/rancher:v2.5.17 --no-cacerts
[root@sealos-node02 rancher]# sh run-rancher.sh
下游集群信息
- Kubernetes 版本: v1.21.0
- Cluster Type (Local/Downstream):
- 如果 Downstream,是什么类型的集群?(自定义/导入或为托管 等):
通过自己单独部署的k8s集群,然后导入rancher
用户信息
- 登录用户的角色是什么? (管理员/集群所有者/集群成员/项目所有者/项目成员/自定义):
- 如果自定义,自定义权限集:admin
主机操作系统:
问题描述:
重现步骤:
执行导入集群:
2、创建clusterrolebinding
[root@localhost sealos]# grep -i user /etc/kubernetes/kubelet.conf
user: system:node:sealos.hub
users:
user:
[root@localhost sealos]# kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user system:node:sealos.hub
3、安装agent
[root@localhost sealos]# curl --insecure -sfL https://192.168.92.32/v3/import/8cqtdjzgddd2hr45546cbxs5cp5s9ks2kl4z5s5ghsp7kjbggcdsw5_c-lkhrd.yaml | kubectl apply -f -
clusterrole.rbac.authorization.k8s.io/proxy-clusterrole-kubeapiserver created
clusterrolebinding.rbac.authorization.k8s.io/proxy-role-binding-kubernetes-master created
namespace/cattle-system created
serviceaccount/cattle created
clusterrolebinding.rbac.authorization.k8s.io/cattle-admin-binding created
secret/cattle-credentials-4375f45 created
clusterrole.rbac.authorization.k8s.io/cattle-admin created
deployment.apps/cattle-cluster-agent created
结果:
[root@localhost sealos]# kubectl logs -f cattle-cluster-agent-689fd565cb-rhgxv -n cattle-system -f
INFO: Environment: CATTLE_ADDRESS=100.123.220.4 CATTLE_CA_CHECKSUM= CATTLE_CLUSTER=true CATTLE_CLUSTER_REGISTRY= CATTLE_FEATURES= CATTLE_INGRESS_IP_DOMAIN=sslip.io CATTLE_INSTALL_UUID=be11a475-b7da-4338-8edf-74da767066a5 CATTLE_INTERNAL_ADDRESS= CATTLE_IS_RKE=false CATTLE_K8S_MANAGED=true CATTLE_NODE_NAME=cattle-cluster-agent-689fd565cb-rhgxv CATTLE_SERVER=https://192.168.92.32 CATTLE_SERVER_VERSION=v2.5.17
INFO: Using resolv.conf: nameserver 10.96.0.10 search cattle-system.svc.cluster.local svc.cluster.local cluster.local hub options ndots:5
FO: https://192.168.92.32/ping is accessible
time=“2023-09-08T09:05:42Z” level=info msg=“Listening on /tmp/log.sock”
time=“2023-09-08T09:05:42Z” level=info msg=“Rancher agent version v2.5.17 is starting”
time=“2023-09-08T09:05:42Z” level=info msg=“Certificate details from https://192.168.92.32”
time=“2023-09-08T09:05:42Z” level=info msg=“Certificate #0 (https://192.168.92.32)”
time=“2023-09-08T09:05:42Z” level=info msg=“Subject: CN=dynamic,O=dynamic”
time=“2023-09-08T09:05:42Z” level=info msg=“Issuer: CN=dynamiclistener-ca,O=dynamiclistener-org”
time=“2023-09-08T09:05:42Z” level=info msg=“IsCA: false”
time=“2023-09-08T09:05:42Z” level=info msg=“DNS Names: [localhost rancher.cattle-system]”
time=“2023-09-08T09:05:42Z” level=info msg=“IPAddresses: [127.0.0.1 172.17.0.2 192.168.92.32]”
time=“2023-09-08T09:05:42Z” level=info msg=“NotBefore: 2023-09-01 08:40:58 +0000 UTC”
time=“2023-09-08T09:05:42Z” level=info msg=“NotAfter: 2024-08-31 08:45:53 +0000 UTC”
time=“2023-09-08T09:05:42Z” level=info msg=“SignatureAlgorithm: ECDSA-SHA256”
time=“2023-09-08T09:05:42Z” level=info msg=“PublicKeyAlgorithm: ECDSA”
time=“2023-09-08T09:05:42Z” level=fatal msg=“Certificate chain is not complete, please check if all needed intermediate certificates are included in the server certificate (in the correct order) and if the cacerts setting in Rancher either contains the correct CA certificate (in the case of using self signed certificates) or is empty (in the case of using a certificate signed by a recognized CA). Certificate information is displayed above. error: Get “https://192.168.92.32”: x509: certificate signed by unknown authority”
预期结果:
截图:
其他上下文信息:
日志
[root@localhost sealos]# kubectl logs -f cattle-cluster-agent-689fd565cb-rhgxv -n cattle-system -f
INFO: Environment: CATTLE_ADDRESS=100.123.220.4 CATTLE_CA_CHECKSUM= CATTLE_CLUSTER=true CATTLE_CLUSTER_REGISTRY= CATTLE_FEATURES= CATTLE_INGRESS_IP_DOMAIN=sslip.io CATTLE_INSTALL_UUID=be11a475-b7da-4338-8edf-74da767066a5 CATTLE_INTERNAL_ADDRESS= CATTLE_IS_RKE=false CATTLE_K8S_MANAGED=true CATTLE_NODE_NAME=cattle-cluster-agent-689fd565cb-rhgxv CATTLE_SERVER=https://192.168.92.32 CATTLE_SERVER_VERSION=v2.5.17
INFO: Using resolv.conf: nameserver 10.96.0.10 search cattle-system.svc.cluster.local svc.cluster.local cluster.local hub options ndots:5
FO: https://192.168.92.32/ping is accessible
time="2023-09-08T09:05:42Z" level=info msg="Listening on /tmp/log.sock"
time="2023-09-08T09:05:42Z" level=info msg="Rancher agent version v2.5.17 is starting"
time="2023-09-08T09:05:42Z" level=info msg="Certificate details from https://192.168.92.32"
time="2023-09-08T09:05:42Z" level=info msg="Certificate #0 (https://192.168.92.32)"
time="2023-09-08T09:05:42Z" level=info msg="Subject: CN=dynamic,O=dynamic"
time="2023-09-08T09:05:42Z" level=info msg="Issuer: CN=dynamiclistener-ca,O=dynamiclistener-org"
time="2023-09-08T09:05:42Z" level=info msg="IsCA: false"
time="2023-09-08T09:05:42Z" level=info msg="DNS Names: [localhost rancher.cattle-system]"
time="2023-09-08T09:05:42Z" level=info msg="IPAddresses: [127.0.0.1 172.17.0.2 192.168.92.32]"
time="2023-09-08T09:05:42Z" level=info msg="NotBefore: 2023-09-01 08:40:58 +0000 UTC"
time="2023-09-08T09:05:42Z" level=info msg="NotAfter: 2024-08-31 08:45:53 +0000 UTC"
time="2023-09-08T09:05:42Z" level=info msg="SignatureAlgorithm: ECDSA-SHA256"
time="2023-09-08T09:05:42Z" level=info msg="PublicKeyAlgorithm: ECDSA"
time="2023-09-08T09:05:42Z" level=fatal msg="Certificate chain is not complete, please check if all needed intermediate certificates are included in the server certificate (in the correct order) and if the cacerts setting in Rancher either contains the correct CA certificate (in the case of using self signed certificates) or is empty (in the case of using a certificate signed by a recognized CA). Certificate information is displayed above. error: Get \"https://192.168.92.32\": x509: certificate signed by unknown authority"