Rancher Server 设置
- Rancher 版本:2.7.5
- 安装选项 (Docker install/Helm Chart): helm
- 如果是 Helm Chart 安装,需要提供 Local 集群的类型(RKE1, RKE2, k3s, EKS, 等)和版本:RKE2
- 在线或离线部署: 在线
下游集群信息
- Kubernetes 版本: 1.26
- Cluster Type (Local/Downstream):
- 如果 Downstream,是什么类型的集群?(自定义/导入或为托管 等):
用户信息 root
- 登录用户的角色是什么? (管理员/集群所有者/集群成员/项目所有者/项目成员/自定义):
- 如果自定义,自定义权限集:
主机操作系统: centos
问题描述: 无法导入集群
重现步骤: 使用两种方式都不成功
#生成证书
./create_self-signed-cert.sh --ssl-domain=rancher.tc.org --ssl-trusted-ip=10.10.80.193 -ssl-trusted-domain=rancher.tc.org --ssl-size=2048 --ssl-date=36500
#创建一个rancher使用的namespce
kubectl create ns cattle-system
#创建ingress密钥
kubectl -n cattle-system create secret tls tls-rancher-ingress --cert=./tls.crt --key=./tls.key
#创建证书密钥
kubectl -n cattle-system create secret generic tls-ca --from-file=./cacerts.pem
#安装
helm install rancher rancher
–namespace cattle-system
–set systemDefaultRegistry=registry.cn-hangzhou.aliyuncs.com
–set hostname=rancher.tc.org
–set ingress.tls.source=secret
–set ingress.ingressClassName=nginx \
–set privateCA=true
2)./create_self-signed-cert.sh --ssl-domain=rancher.tc.org --ssl-size=2048 --ssl-date=36500
#创建一个rancher使用的namespce
kubectl create ns cattle-system
#创建ingress密钥
kubectl -n cattle-system create secret tls tls-rancher-ingress --cert=./tls.crt --key=./tls.key
#创建证书密钥
kubectl -n cattle-system create secret generic tls-ca --from-file=./cacerts.pem
#安装
helm install rancher rancher
–namespace cattle-system
–set systemDefaultRegistry=registry.cn-hangzhou.aliyuncs.com
–set hostname=rancher.tc.org
–set ingress.tls.source=secret
–set privateCA=true
结果:
预期结果:
curl --insecure -sfL https://10.10.80.193:30332/v3/import/p6qz9v9jnz9fqj6gtwbs8ncbbqxcr9qx4mvr752tl2hvn979p7w4j5_c-m-8vnfzqft.yaml | kubectl apply -f -
截图:
其他上下文信息:
日志
INFO: Value from https://10.10.80.193:30332/v3/settings/cacerts is an x509 certificate
time="2023-07-23T13:02:07Z" level=info msg="Listening on /tmp/log.sock"
time="2023-07-23T13:02:07Z" level=info msg="Rancher agent version v2.7.5 is starting"
time="2023-07-23T13:02:07Z" level=info msg="Certificate details from https://10.10.80.193:30332"
time="2023-07-23T13:02:07Z" level=info msg="Certificate #0 (https://10.10.80.193:30332)"
time="2023-07-23T13:02:07Z" level=info msg="Subject: CN=dynamic,O=dynamic"
time="2023-07-23T13:02:07Z" level=info msg="Issuer: CN=dynamiclistener-ca@1690116348,O=dynamiclistener-org"
time="2023-07-23T13:02:07Z" level=info msg="IsCA: false"
time="2023-07-23T13:02:07Z" level=info msg="DNS Names: [rancher.tc.org]"
time="2023-07-23T13:02:07Z" level=info msg="IPAddresses: [10.10.80.193 10.96.2.191 100.64.0.55 100.64.0.56 100.64.0.57]"
time="2023-07-23T13:02:07Z" level=info msg="NotBefore: 2023-07-23 12:45:48 +0000 UTC"
time="2023-07-23T13:02:07Z" level=info msg="NotAfter: 2024-07-22 13:00:41 +0000 UTC"
time="2023-07-23T13:02:07Z" level=info msg="SignatureAlgorithm: ECDSA-SHA256"
time="2023-07-23T13:02:07Z" level=info msg="PublicKeyAlgorithm: ECDSA"
time="2023-07-23T13:02:07Z" level=info msg="Certificate #1 (https://10.10.80.193:30332)"
time="2023-07-23T13:02:07Z" level=info msg="Subject: CN=dynamiclistener-ca@1690116348,O=dynamiclistener-org"
time="2023-07-23T13:02:07Z" level=info msg="Issuer: CN=dynamiclistener-ca@1690116348,O=dynamiclistener-org"
time="2023-07-23T13:02:07Z" level=info msg="IsCA: true"
time="2023-07-23T13:02:07Z" level=info msg="DNS Names: <none>"
time="2023-07-23T13:02:07Z" level=info msg="IPAddresses: <none>"
time="2023-07-23T13:02:07Z" level=info msg="NotBefore: 2023-07-23 12:45:48 +0000 UTC"
time="2023-07-23T13:02:07Z" level=info msg="NotAfter: 2033-07-20 12:45:48 +0000 UTC"
time="2023-07-23T13:02:07Z" level=info msg="SignatureAlgorithm: ECDSA-SHA256"
time="2023-07-23T13:02:07Z" level=info msg="PublicKeyAlgorithm: ECDSA"
time="2023-07-23T13:02:07Z" level=info msg="Certificate details for /etc/kubernetes/ssl/certs/serverca"
time="2023-07-23T13:02:07Z" level=info msg="Certificate #0 (/etc/kubernetes/ssl/certs/serverca)"
time="2023-07-23T13:02:07Z" level=info msg="Subject: CN=cattle-ca,C=CN"
time="2023-07-23T13:02:07Z" level=info msg="Issuer: CN=cattle-ca,C=CN"
time="2023-07-23T13:02:07Z" level=info msg="IsCA: true"
time="2023-07-23T13:02:07Z" level=info msg="DNS Names: <none>"
time="2023-07-23T13:02:07Z" level=info msg="IPAddresses: <none>"
time="2023-07-23T13:02:07Z" level=info msg="NotBefore: 2023-07-23 12:38:30 +0000 UTC"
time="2023-07-23T13:02:07Z" level=info msg="NotAfter: 2033-07-20 12:38:30 +0000 UTC"
time="2023-07-23T13:02:07Z" level=info msg="SignatureAlgorithm: SHA256-RSA"
time="2023-07-23T13:02:07Z" level=info msg="PublicKeyAlgorithm: RSA"
time="2023-07-23T13:02:07Z" level=error msg="Issuer of last certificate found in chain (CN=dynamiclistener-ca@1690116348,O=dynamiclistener-org) does not match with CA certificate Issuer (CN=cattle-ca,C=CN). Please check if the configured server certificate contains all needed intermediate certificates and make sure they are in the correct order (server certificate first, intermediates after)"
time="2023-07-23T13:02:07Z" 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://10.10.80.193:30332\": x509: certificate signed by unknown authority"