RKE 版本:
多个版本都尝试过 v1.23.16-rancher2-3,v1.24.16-rancher1-1,v1.25.12-rancher1-1,v1.26.7-rancher1-1
Docker 版本: (docker version
,docker info
)
20.10.15
操作系统和内核: (cat /etc/os-release
, uname -r
)
CentOS Linux 7 (Core) 3.10.0-957.el7.x86_64
主机类型和供应商: (VirtualBox/Bare-metal/AWS/GCE/DO)
kvm 虚拟机
cluster.yml 文件:
name: wakecloud-cluster
rancher_kubernetes_engine_config:
ignore_docker_version: true
ingress:
default_backend: true
http_port: 0
https_port: 0
provider: nginx
kubernetes_version: v1.23.16-rancher2-3
network:
plugin: canal
private_registries:
- is_default: true
url: registry.cn-hangzhou.aliyuncs.com
services:
etcd:
backup_config:
enabled: true
interval_hours: 12
retention: 30
kube-api:
service_cluster_ip_range: 10.43.0.0/16
service_node_port_range: 30000-32767
重现步骤:
通过命令行创建rke集群,然后helm install 安装rancher 总共测试过rancher版本有2.6.4 、2.6.6、2.6.13、2.7.3、2.7.5
rancher cli 客户端测试过 v2.7.6, v2.7.6-rc1, [v2.7.0] [v2.6.9]
安装命令大致如下:
/usr/local/sbin/rke up --config /opt/rancher-cluster.yml
cd /opt
cp kube_config_rancher-cluster.yml ~/.kube/config
kubectl create namespace cattle-system
kubectl -n cattle-system create secret tls tls-rancher-ingress --cert=/opt/tls.crt --key=/opt/tls.key
kubectl -n cattle-system create secret generic tls-ca --from-file=/opt/cacerts.pem
kubectl rollout status -n ingress-nginx daemonset/nginx-ingress-controller
/usr/local/sbin/helm install rancher rancher-stable/rancher --namespace cattle-system --set hostname=xxxxxx(实际有配置正确域名) --set ingress.tls.source=secret --set privateCA=true --set bootstrapPassword=xxxxxxx --set rancherImage=registry.cn-hangzhou.aliyuncs.com/rancher/rancher --set ‘extraEnv[0].name=CATTLE_FEATURES’ --set ‘extraEnv[0].value=unsupported-storage-drivers=true,continuous-delivery=false,harvester=false,rke2=false’ --set systemDefaultRegistry=registry.cn-hangzhou.aliyuncs.com --version 2.6.4
kubectl -n cattle-system rollout status deploy/rancher
使用rancher cli 命令行创建下游集群
curl -s https://xxxxxxx/v3-public/localProviders/local?action=login -H ‘content-type: application/json’ --data-binary ‘{“username”:“admin”,“password”:“xxxxxxxx”}’ --insecure |jq .token
/usr/local/sbin/rancher login https://xxxxxxx --token token-2sfgw:xxxxxxxx --skip-verify
/usr/local/sbin/rancher clusters create --rke-config /opt/worker-cluster.yml wakecloud-cluster
/usr/local/sbin/rancher cluster add-node --etcd --controlplane wakecloud-cluster
结果:
当rancher安装完成以后,在不进入web界面,直接使用rancher cli命令创建下游集群,正常应该返回下游集群安装命令
sudo docker run -d --privileged --restart=unless-stopped --net=host -v /etc/kubernetes:/etc/kubernetes -v /var/run:/var/run registry.cn-hangzhou.aliyuncs.com/rancher/rancher-agent:v2.7.5 --server https://xxxxxx --token wgsrw5cftrvw6fxznpwb67q52lsg77cj9xl7hkttfbgwm4mz2jwq9n --ca-checksum 5a4073c7894710fe2ad871f62ddd6a56dae3d925b0b5ee8435de0b5833937fc4 --etcd --controlplane
现在问题就是只返回
[rancher@rancher-server-01 opt]$ /usr/local/sbin/rancher cluster add-node --etcd --controlplane wakecloud-cluster
Run this command on an existing machine already running a supported version of Docker:
–etcd --controlplane
如果进入过web界面,以后再用命令行去创建就可以正常返回docker run xxxx 的命令了。