主机准备
类型 | 主机名 | IP | 操作系统 | CPU 内存 |
---|---|---|---|---|
Master | master.rabbit.com | 192.168.8.207 | CentOS 7.3 | 2核4G |
Node1 | node1.rabbit.com | 192.168.8.208 | CentOS 7.3 | 2核2G |
安装前预配置 所有节点都要执行
1. 配置每个节点主机名
hostnamectl set-hostname master.rabbit.com #master节点执行hostnamectl set-hostname node1.rabbit.com #node1节点执行
2. 编辑每个节点 /etc/hosts
192.168.8.207 master.rabbit.com192.168.8.208 node1.rabbit.com
ping 每个节点看是否可到达
3. 每个节点开启SELinux
configure SELINUXTYPE=targeted in the /etc/selinux/config file:# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:# enforcing - SELinux security policy is enforced.# permissive - SELinux prints warnings instead of enforcing.# disabled - No SELinux policy is loaded.SELINUX=enforcing# SELINUXTYPE= can take one of these three values:# targeted - Targeted processes are protected,# minimum - Modification of targeted policy. Only selected processes are protected.# mls - Multi Level Security protection.SELINUXTYPE=targeted
4. 关闭所有节点的防火墙
systemctl stop firewalld systemctl disable firewalld
安装及配置软件包
1. 所有的节点下执行以下命令安装Openshift依赖的软件包。
yum install wget git net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct yum update
2. 安装docker 配置阿里云加速器
yum install -y docker systemctl enable docker
参考链接:http://blog.xianshiyue.com/%E5%AE%89%E8%A3%85docker/
3. Configuring Docker Storage
4. 配置 Docker Container Logs
参考链接:http://blog.xianshiyue.com/docker-log-%E9%85%8D%E7%BD%AE/
5. 启动 docker
systemctl start docker
后面的步骤都在master节点上执行
6. 需要启用EPEL仓库以安装Ansible
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sed -i -e "s/^enabled=1/enabled=0/" /etc/yum.repos.d/epel.repo yum -y --enablerepo=epel install ansible pyOpenSSL
7. 下载 openshift-ansible ,我这里下载3.7 版本
地址:https://github.com/openshift/openshift-ansible
8. 确保所有的节点之间可以正常的访问,需要生成SSH密钥
ssh-keygenfor host in master.rabbit.com node1.rabbit.com ;do ssh-copy-id -i ~/.ssh/id_rsa.pub $host;done
配置Ansible
配置Ansible的hosts配置文件(记录了Ansible需要操作的目标主机信息)。
1. 备份原有的hosts文件
mv -f /etc/ansible/hosts /etc/ansible/hosts.org
2. 创建/etc/ansible/hosts文件,添加下面的内容。
# Create an OSEv3 group that contains the masters, nodes, and etcd groups[OSEv3:children] masters nodes etcd# Set variables common for all OSEv3 hosts[OSEv3:vars]# SSH user, this user should allow ssh based auth without requiring a passwordansible_ssh_user=root# If ansible_ssh_user is not root, ansible_become must be set to true#ansible_become=trueopenshift_release=3.7.0openshift_deployment_type=origin openshift_disable_check=disk_availability,docker_storage,memory_availability,docker_image_availability,package_version,package_availability# uncomment the following to enable htpasswd authentication; defaults to DenyAllPasswordIdentityProvideropenshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]# host group for masters[masters] master.rabbit.com# host group for etcd[etcd] master.rabbit.com# host group for nodes, includes region info[nodes] master.rabbit.com openshift_schedulable=True openshift_node_labels="{'region': 'infra'}"node1.rabbit.com openshift_node_labels="{'region': 'infra', 'zone': 'east'}"
执行安装
ansible-playbook ~/openshift-ansible-openshift-ansible-3.7.22-1/playbooks/byo/config.yml
安装过程比较长,耐心等待,一般情况都不会太顺利,会有错误,根据提示解决错误后继续执行相同的命令安装
作者:9527华安
链接:https://www.jianshu.com/p/2d1e5ce931c8
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦