部署环境:
Rancher IP:192.168.1.11 安装软件:Rancher/Docker-ce
node1 IP:192.168.1.12 安装软件:Docker-ce
node2 IP:192.168.1.13 安装软件:Docker-ce
Rancher服务器:
免密码登录:
ssh-keygen -t rsa //一路回车键即可
ssh-copy-id node1 //第一次输入 yes 和 hduser 的密码
ssh-copy-id node2
全部主机:
#永久关闭防火墙与selinux
systemctl disable firewalld
systemctl stop firewalld
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
#打开路由转发,否则待会生成镜像会报错!
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p
配置解析文件:
vim /etc/hosts
添加以下内容:
192.168.1.11 master
192.168.1.12 node1
192.168.1.13 node2
#配置阿里云源:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#安装最新版本 Docker 依赖版本环境(如果安装过,则不需要执行该步骤):
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
cat /etc/yum.repos.d/docker-ce.repo
2. 安装 Docker
yum install docker-ce
systemctl start docker
systemctl enable docker
#阿里云加速docker拉取镜像(否则下载镜像时,会很慢会卡顿):
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://aq63ygn3.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
Rancher:
#使用 Docker 创建并运行 Rancher 容器
docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:v2.0.8
#打开浏览器:http://192.168.1.11
docker pull rancher/rancher-agent:v2.0.8
docker pull rancher/hyperkube:v1.11.2-rancher1
docker pull rancher/rke-tools:v0.1.13
docker pull rancher/nginx-ingress-controller:0.16.2-rancher1
docker pull rancher/hello-world
docker pull rancher/calico-node:v3.1.1
docker pull rancher/calico-cni:v3.1.1
docker pull rancher/k8s-dns-dnsmasq-nanny-amd64:1.14.10
docker pull rancher/k8s-dns-kube-dns-amd64:1.14.10
docker pull rancher/k8s-dns-sidecar-amd64:1.14.10
docker pull rancher/coreos-etcd:v3.2.18
docker pull rancher/pause-amd64:3.1
docker pull rancher/metrics-server-amd64:v0.2.1
docker pull rancher/coreos-flannel:v0.9.1
docker pull rancher/nginx-ingress-controller-defaultbackend:1.4
docker pull rancher/cluster-proportional-autoscaler-amd64:1.0.0