添加hosts
cat > /etc/hosts <<EOF
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.14.132 master1.ma.com lb.ma.com openshift-cluster.ma.com
192.168.14.133 node1.ma.com
192.168.14.134 etcd1.ma.com
61.91.161.217 gcr.io
61.91.161.217 www.gcr.io
EOF
master1安装docker & ansible:
yum install docker -y
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://50208f86.m.daocloud.io
systemctl daemon-reload && systemctl start docker
yum install python-pip -y
cd
mkdir .pip
cd .pip
cat > pip.conf <<EOF
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
EOF
yum install gcc libffi-devel python-devel openssl-devel -y
pip install cryptography
pip install ansible
修改/etc/ansible/hosts为:
[OSEv3:children]
masters
nodes
etcd
lb
[OSEv3:vars]
ansible_ssh_user=root
deployment_type=origin
openshift_version=1.4.1
openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]
openshift_master_cluster_method=native
openshift_master_cluster_hostname=openshift-cluster.ma.com
openshift_master_cluster_public_hostname=openshift-cluster.ma.com
openshift_master_default_subdomain=ma.com
[masters]
master1.ma.com
[etcd]
etcd1.ma.com
[lb]
lb.ma.com
[nodes]
master1.ma.com openshift_node_labels="{'region': 'infra', 'zone': 'default'}"
node1.ma.com openshift_node_labels="{'region': 'primary', 'zone': 'shenzhen'}"
下载openshift代码:
用最新稳定版本1.4.1 https://github.com/openshift/origin/releases
克隆代码
git clone https://github.com/openshift/openshift-ansible.git
ansible运行安装:
ansible-playbook -i /etc/ansible/hosts /root/openshift-ansible/playbooks/byo/config.yml -b -v --private-key=~/.ssh/id_rsa
报错:
本来打算三台机器,这样规划
[root@node1 ~]# cat /etc/hosts
cat > /etc/hosts <<EOF
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.14.132 node1.ma.com master1.ma.com etcd1.ma.com lb.ma.com openshift-cluster.ma.com
192.168.14.133 node2.ma.com master2.ma.com etcd2.ma.com
192.168.14.134 node3.ma.com master3.ma.com etcd3.ma.com
61.91.161.217 gcr.io
61.91.161.217 www.gcr.io
EOF
无奈报错:
TASK [openshift_master : Start and enable master api on first master] **********
skipping: [master2.ma.com] => {"changed": false, "skip_reason": "Conditional check failed", "skipped": true}
skipping: [master3.ma.com] => {"changed": false, "skip_reason": "Conditional check failed", "skipped": true}
FAILED - RETRYING: TASK: openshift_master : Start and enable master api on first master (1 retries left).
fatal: [master1.ma.com]: FAILED! => {"attempts": 1, "changed": false, "failed": true, "msg": "Unable to start service origin-master-api: Job for origin-master-api.service failed because the control process exited with error code. See \"systemctl status origin-master-api.service\" and \"journalctl -xe\" for details.\n"}
NO MORE HOSTS LEFT *************************************************************
to retry, use: --limit @/root/openshift-ansible/playbooks/byo/config.retry
PLAY RECAP *********************************************************************
etcd1.ma.com : ok=119 changed=36 unreachable=0 failed=0
etcd2.ma.com : ok=109 changed=31 unreachable=0 failed=0
etcd3.ma.com : ok=109 changed=31 unreachable=0 failed=0
lb.ma.com : ok=80 changed=10 unreachable=0 failed=0
localhost : ok=10 changed=0 unreachable=0 failed=0
master1.ma.com : ok=267 changed=63 unreachable=0 failed=1
master2.ma.com : ok=245 changed=63 unreachable=0 failed=0
master3.ma.com : ok=245 changed=64 unreachable=0 failed=0
node1.ma.com : ok=90 changed=7 unreachable=0 failed=0
node2.ma.com : ok=91 changed=9 unreachable=0 failed=0
node3.ma.com : ok=90 changed=6 unreachable=0 failed=0
看来把三台master三台node合在一起,etcd也合在一起并不是好事.报错了.