标签:目录 file include 其他 详细介绍 and enter size sysconfig
v1.0
节点 | 说明 | 主机名 | IP |
Master | 主控制节点 | openshiftmaster.dynastech.com | 192.168.30.95 |
Etcd | 协调服务节点 | openshiftetcd.dynastech.com | 192.168.30.96 |
Node1 | 计算节点1 | openshiftnode1.dynsatech.com | 192.168.30.102 |
Node2 | 计算节点2 | openshiftnode2.dynastech.com | 192.168.30.98 |
Node3 | 计算节点3 | openshiftnode3.dynastech.com | 192.168.30.110 |
?
校验并安装centos linux 7系统
等待校验完成
(这里可以选择桌面版,如下图,服务器建议最小安装)
这里我为了测试方便,直接修改各个节点hosts文件
用xshell5连接各个节点
进入编辑vi /etc/hosts
开始编辑按insert
编辑完成esc,
保存并退出:wq
强制退出不保存!q
[root@所有节点 ~]# yum install -y lrzsz git wget net-tools bind-utils iptables-services bridge-utils bash-completion
[root@所有节点 ~]# yum install -y docker
[root@openshiftectd ~]# systemctl start iptables
[root@openshiftectd ~]# systemctl enable iptables
命令: fdisk -l
如图所示,添加的数据盘挂载在/dev/sdb目录下
[root@所有节点 ~]# vi /etc/sysconfig/docker-storage-setup
[root@所有节点 ~]# docker-storage-setup
vi /etc/sysconfig/docker
追加参数:
--registry-mirror=https://docker.mirrors.ustc.edu.cn
systemctl enable docker
systemctl start docker
systemctl status docker
[root@openshiftectd ~]# yum install -y etcd
[root@openshiftectd ~]# systemctl enable etcd
[root@openshiftectd ~]# systemctl start etcd
下载安装包
http://mirrors.neusoft.edu.cn/epel/7/x86_64/e/
上传到master
[root@openshiftmaster ~]# yum install -y epel-release-7-10.noarch.rpm
[root@openshiftmaster ~]# yum install -y --enablerepo=epel ansible pyOpenSSL
?
[root@openshiftmaster ~]# ssh-keygen -f /root/.ssh/id_rsa -N ‘‘
[root@openshiftmaster ~]# vi /etc/ssh/ssh_config
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
[root@openshiftmaster ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub openshiftmaster.dynastech.com
[root@openshiftmaster ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub openshiftetcd.dynastech.com
[root@openshiftmaster ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub openshiftnode1.dynastech.com
[root@openshiftmaster ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub openshiftnode2.dynastech.com
[root@openshiftmaster ~]# ssh-copy-id -i ~/.ssh/id_rsa.pub openshiftnode3.dynastech.com
[root@openshiftmaster ~]# git clone https://github.com/openshift/openshift-ansible
参考:https://docs.openshift.org/latest/install_config/install/advanced_install.html
[root@openshiftmaster ~]# vi /etc/ansible/hosts
添加如下内容
# Create an OSEv3 group that contains the masters and nodes 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 password
ansible_ssh_user=root
?
# If ansible_ssh_user is not root, ansible_become must be set to true
#ansible_become=true
?
openshift_deployment_type=origin
?
# uncomment the following to enable htpasswd authentication; defaults to DenyAllPasswordIdentityProvider
?
openshift_master_identity_providers=[{‘name‘: ‘htpasswd_auth‘, ‘login‘: ‘true‘, ‘challenge‘: ‘true‘, ‘kind‘: ‘HTPasswdPasswordIdentityProvider‘, ‘filename‘: ‘/etc/origin/master/htpasswd‘}]
?
# host group for masters
[masters]
openshiftmaster.dynastech.com
?
# host group for etcd
[etcd]
openshiftetcd.dynastech.com
?
# host group for nodes, includes region info
[nodes]
openshiftmaster.dynastech.com
openshiftnode1.dynastech.com
openshiftnode2.dynastech.com
openshiftnode3.dynsatech.com
?
[root@openshiftmaster ~]# ansible-playbook openshift-ansible/playbooks/byo/config.yml
?
等待运行完成,正常情况已经配置完成。
?
硬件配置太低会有如下错误:
?
解决此错误的方法是编辑/etc/ansible/hosts
加入如下配置,跳过检查项
?
由于是运行在pc机上的,硬件配置不够,我在这里同时将etcd合并到了master节点(即将ectd安装到master节点并启动),在配置hosts时,将etcd指向master节点,停用了node3,配置变成如下图所示
(如果参考者的运行环境,硬件配置可以,这里不必要删减节点)
再次运行
[root@openshiftmaster ~]# ansible-playbook openshift-ansible/playbooks/byo/config.yml
即成功通过安装。
安装成功的汇总信息如下图
[root@openshiftmaster ~]# oc get nodes
[root@openshiftmaster ~]# htpasswd -b /etc/origin/master/htpasswd admin admin
配置本机hosts文件,将master节点ip指向其主机名
用admin登录web站点
至此OpenShift集群搭建完毕!开始探索吧………
?
后记:
此文档不详尽处:
https://docs.openshift.org/latest/install_config/install/advanced_install.html
标签:目录 file include 其他 详细介绍 and enter size sysconfig
原文地址:http://www.cnblogs.com/zhangning/p/7251810.html