如果出现无法载图的情况,请检查与github的连通性
环境 centos7.9 4C4G rancher版本v2.7.3
k8s节点 1 2 3 docker pull rancher/rancher-agent:v2.7.3 docker save rancher-agent:v2.7.3 -o rancher-agent.v2.7.3.tar.gz ctr -n=k8s.io image import rancher-agent.v2.7.3.tar.gz
rancher节点 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 systemctl disable firewalld.service --now setenforce 0 sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config swapoff -a modprobe br_netfilter echo "modprobe br_netfilter" >> /etc/profilecat > /etc/sysctl.d/k8s.conf <<EOF net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 EOF sysctl -p /etc/sysctl.d/k8s.conf mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backupwget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum install -y yum-utils device-mapper-persistent-data lvm2 wget net-tools nfs-utils lrzsz gcc gcc-c++ make cmake libxml2-devel openssl-devel curl curl-devel unzip sudo ntp libaio-devel wget vim ncurses-devel autoconf automake zlib-devel python-devel epel-release openssh-server socat ipvsadm conntrack ntpdate yum install docker-ce docker-ce-cli containerd.io -y systemctl enable docker --now cat > /etc/docker/daemon.json << EOF { "registry-mirrors": [ "https://bsx9xf1d.mirror.aliyuncs.com", "https://hub-mirror.c.163.com", "https://docker.m.daocloud.io", "https://ghcr.io", "https://mirror.baidubce.com", "https://docker.nju.edu.cn" ], "exec-opts": [ "native.cgroupdriver=systemd" ] } EOF systemctl daemon-reload systemctl restart docker docker pull rancher/rancher:v2.7.3 docker run -d --restart=unless-stopped -p 80:80 -p 443:443 \ --privileged rancher/rancher:v2.7.3
rancher的使用
查看初始密码:
1 2 3 4 5 6 7 8 9 10 docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ec079a88c302 rancher/rancher:v2.7.3 "entrypoint.sh" 2 minutes ago Up 2 minutes 0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp thirsty_hellman docker logs ec079a88c302 2>&1 | grep "Bootstrap Password:" 2024/04/23 03:31:17 [INFO] Bootstrap Password: gprr6tkn5jrzsxpkqz5ttddd2fj5dw5dcm95jb6t4rm8xm5sg2lfd5 需要设置强密码:(这是我设置的) JRmK6EBKc)8VS]R
添加时,在master节点上输入下图的红框内内容,使其加入rancher