openshift3.11.0+centos7.5部署安装

      openshift3.11.0+centos7.5部署安装已关闭评论

1. 环境介绍

名称 版本 说明
c720175.xiodi.cn centos7.5
c720176.xiodi.cn centos7.5
c720177.xiodi.cn centos7.5
openshift 3.11.0

openshift镜像下载地址:

2. 安装前配置

(1)selinux 配置(三个节点)
// selinux 改成 enforcing 或 Permissive
# grep "^\s*[^#\t].*$" /etc/selinux/config
SELINUX=permissive
SELINUXTYPE=targeted 
(2)配置 base和epel(三个节点)
# cat /etc/yum.repos.d/aliyun-base-epel.repo      // 我这里使用的是 nexus代理的,您可以使用下面的一种方法
[base]
name=aliyun-base
baseurl=http://192.168.20.221:8081/repository/aliyun-base/$releasever/os/$basearch/
gpgcheck=0
enabled=1

[extras]
name=aliyun-epel
baseurl=http://192.168.20.221:8081/repository/aliyun-base/$releasever/extras/$basearch/
gpgcheck=0
enabled=1

[epel]
name=aliyun-epel
baseurl=http://192.168.20.221:8081/repository/aliyun-epel/$releasever/$basearch/
gpgcheck=0
enabled=1

// 方法2
# yum -y install epel-release.noarch
(3)域名解析,三个节点最好都做,如果使用dns解析,则不需要
# vi  /etc/hosts
192.168.20.175   c720175.xiodi.cn
192.168.20.176   c720176.xiodi.cn
192.168.20.177   c720177.xiodi.cn
(4)配置ssh免密钥登陆
[root@c720175 ~]# ssh-keygen
[root@c720175 ~]# for host in c720175.xiodi.cn c720176.xiodi.cn  c720177.xiodi.cn;\
  do ssh-copy-id -i ~/.ssh/id_rsa.pub $host;done
(5)安装ansible,下载openshift-ansible
[root@c720175 ~]# yum -y install git
[root@c720175 ~]# yum install centos-release-ansible26 -y && yum install ansible-2.6.5 -y
[root@c720175 ~]# git clone -b release-3.11 https://github.com/openshift/openshift-ansible.git

2. 安装 openshift

(1)安装依赖包
[root@c720175 ~]# vi  hosts
[OSEv3:children]
masters
nodes
etcd

[OSEv3:vars]
ansible_ssh_user=root
openshift_deployment_type=origin
#openshift_release="3.11"
openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}]

openshift_public_hostname=openshift.xiodi.cn
openshift_master_default_subdomain=xiodi.cn
openshift_ca_cert_expire_days=3650
openshift_node_cert_expire_days=3650
openshift_master_cert_expire_days=3650
etcd_ca_default_days=3650

#openshift_hosted_manage_registry=false
openshift_disable_check=memory_availability,disk_availability,docker_image_availability,docker_storage
#openshift_enable_service_catalog=false
#template_service_broker_install=false
#ansible_service_broker_install=false
#osn_storage_plugin_deps=[]
#openshift_enable_service_catalog=false
#openshift_cluster_monitoring_operator_install=false

[masters]
c720175.xiodi.cn
[etcd]
c720175.xiodi.cn
[nodes]
c720175.xiodi.cn openshift_node_group_name='node-config-master'
c720176.xiodi.cn openshift_node_group_name='node-config-compute'
c720177.xiodi.cn openshift_node_group_name='node-config-infra'


[root@c720175 ~]# ansible-playbook -i ./hosts ./openshift-ansible/playbooks/prerequisites.yml
[root@c720175 ~]# systemctl status docker           // docker应该已经安装成功
(2)三个节点分别导入相应的镜像
[root@c720175 ~]# tar -xf openshift-3.11.0-master-images.tar.gz
[root@c720175 ~]# ./docker.images.sh load-images

[root@c720176 ~]# tar -xf openshift-3.11.0-node-compute-images.tar.gz
[root@c720176 ~]# ./docker.images.sh load-images

[root@c720177 ~]# tar -xf openshift-3.11.0-node-infra-images.tar.gz
[root@c720177 ~]# ./docker.images.sh load-images
(3)执行部署
[root@c720175 ~]# ansible-playbook -i ./hosts ./openshift-ansible/playbooks/deploy_cluster.yml
(4)增加一个用户
[root@c720175 ~]# htpasswd -c -b /etc/origin/master/htpasswd user password

3. 验证

(1)在 windows客户端,修改 hosts文件,添加如下内容:
192.168.20.175  c720175.xiodi.cn
192.168.20.175  openshift.xiodi.cn
(2)浏览器打开:

https://openshift.xiodi.cn ,用户名密码为上面定义