rancher2.11.3创建RKE2集群有错误

通过rancher2.11.3, 安装rke2 v1.32.5+rke2r1的时候,将注册命令在机器执行的时候报错,


Aborting system-agent installation due to requested strict CA verification with no CA checksum provided
注册命令配置如下:
curl -fL https://rancher.unisoc.com/system-agent-install.sh | sudo sh -s - --server https://rancher.unisoc.com --label ‘cattle.io/os=linux’ --token wfr8xx4rbcqsgqgb8zdw9j2z56qfzx2hcd2wwkn7bks5vt4pdfw6bf --etcd --controlplane --worker

我没有找到哪里去设置CA校验和取消CA校验的地方,请社区帮助下

环境信息:
RKE2 版本: rancher 2.11可选择最新版本

节点 CPU 架构,操作系统和版本:centos 7.4

集群配置:3个master

问题描述:

下游注册:1. 需要配置ca-sum校验和,安装rancher的时候在哪一步可以添加cacerts
2. 取消校验和后,在rancher机器界面,节点状态一直是Waiting for cluster agent to connect
需要查看哪些日志,确定什么错误?

重现步骤:

  • 安装 RKE2 的命令:

预期结果:
下游RKE2注册完成,形成新集群

实际结果:
下游RKE2无法注册上

日志

参考:TLS Settings | Rancher

在系统设置中将 agent-tls-mode 修改为 system-store 然后再创建试试

已经是这么做了,但是下游我跑了一晚上,今天早上起来,在节点注册状态:–2. 取消校验和后,在rancher机器界面,节点状态一直是Waiting for cluster agent to connect
需要查看哪些日志,确定什么错误?

那这样,你提供一下详细的 rancher 安装步骤,我看看在本地能不能重现

因为电脑在家中,我现在先写一段,如果欠缺回家再补

  1. 环境:vmware跑4个虚拟机,虚拟机:centos7.4, 配置了/etc/hosts,都添加了各个机器的主机名和ip关系
    2.所有机器执行系统配置:

sudo swapoff -a

永久关闭:注释 /etc/fstab 中的 swap 行

sudo sed -i ‘/swap/s/^/#/’ /etc/fstab
sudo setenforce 0
sudo sed -i ‘s/^SELINUX=enforcing/SELINUX=permissive/’ /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF
sudo sysctl --system

执行安装K3S

curl –sfL
https://rancher-mirror.rancher.cn/k3s/k3s-install.sh |
INSTALL_K3S_MIRROR=cn sh -s -
INSTALL_K3S_VERSION=v1.32.5+k3s1
–system-default-registry “registry.cn-hangzhou.aliyuncs.com

设置K3S镜像源/etc/rancher/k3s/registiry.yaml–registry.cn-hangzhou.aliyuncs.com,
执行systemctl restart k3s

安装rancher 2.11.3

  1. 创建购买的商业证书secret

kubectl create namespace cattle-system
kubectl -n cattle-system create secret tls tls-rancher-ingress \
–cert=/opt/rancher/cert/tls.crt \
–key=/opt/rancher/cert/tls.key

helm repo add rancher-stable https://rancher-mirror.rancher.cn/server-charts/stable
helm repo update

helm install rancher rancher-stable/rancher \
–namespace cattle-system \
–set hostname=rancher.gc.com \
–set ingress.tls.source=secret \
–version 2.11.3 \
–set systemDefaultRegistry=registry.cn-hangzhou.aliyuncs.com \
–set replicas=1

安装完rancher后,系统设置

  1. 在globle设置agent-tls-mode 修改为 system-store
  2. 在globle设置system-default-registry:https://registry.cn-hangzhou.aliyuncs.com,应用后--后来又修改registry.cn-hangzhou.aliyuncs.com,但是fleet和gitops相关pod拉取镜像为https://registry.cn-hangzhou.aliyuncs.com,导致pod一直起不来

执行下游RKE2注册:

  1. 创建集群,选择customer->RKE2, 版本为rancher2.11.3支持最新版本,其他参数都是默认
  2. 在下游集群执行注册命令
  3. 最终注册节点在rancher页面就停留在Waiting for cluster agent to connect

帮忙看下是哪步操作不对。

目前已经解决了,原因如下:

  1. 集群没有使用独有DNS,无法解析域名, 域名在每个节点都配置在hosts里面,包括在windows里面
  2. 下游rke2注册的时候 pod cattle-cluster-agent需要利用域名向rancher注册信息,导致在容器里面无法解析

解决方法:
./kubectl --kubeconfig /etc/rancher/rke2/rke2.yaml -n kube-system edit configmap rke2-coredns-rke2-coredns,增加配置

 hosts {
        192.168.32.128 rancher.unisoc.com
        fallthrough
    }

完整片段如下:

.:53 {
    errors
    health
    ready
    hosts {
        192.168.32.128 rancher.unisoc.com
        fallthrough
    }
    kubernetes cluster.local in-addr.arpa ip6.arpa {
        pods insecure
        fallthrough in-addr.arpa ip6.arpa
    }
    forward . /etc/resolv.conf
    cache 30
    reload
}
1 个赞