rancher 集群加节点

rancher 集群加节点

节点主机10.11.0.16

安装常用工具

yum install vim git net-tools wget gcc yum-utils device-mapper-persistent-data lvm2 -y

内核参数设置

tee /etc/sysctl.d/k8s.conf <

禁用selinux

setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

禁用swap

swapoff -a
sed 's/._swap._/#&/' /etc/fstab

安装docker-ce

#添加源信息
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum makecache fast
#安装docker-ce
yum -y install docker-ce
#设置开机启动
systemctl enable docker
#启动docker
systemctl start docker
#镜像加速
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://53qevzvm.mirror.aliyuncs.com"]
}
EOF
systemctl daemon-reload
#重启docker
systemctl restart docker

免密登录

#添加用户
useradd rancher
#设置用户组
usermod -G docker rancher
#修改密码
passwd rancher
#以rancher用户生成ssh秘钥
su rancher
ssh-keygen

集群机子10.10.0.6

下发秘钥

ssh-copy-id [email protected]

编辑 cluster.yml 添加节点

- address: 10.11.0.16
  port: "22"
  internal_address: ""
  role:
  - controlplane
  - worker
  - etcd
  hostname_override: ""
  user: rancher
  docker_socket: /var/run/docker.sock
  ssh_key: ""
  ssh_key_path: ~/.ssh/id_rsa
  ssh_cert: ""
  ssh_cert_path: ""
  labels: {}
  taints: []

启动

./rke_linux-amd64 up --config cluster.yml

你可能感兴趣的:(rancher 集群加节点)