hbhe0316
作者hbhe03162019-01-02 14:51
数据库管理员, IBM

Redhat openshift okd 3.11 all in one 环境安装

字数 9627阅读 2328评论 2赞 3

1.环境准备

服务器需要一台台:一台主节点服务器,master、compute、infra安装部署在一起。
[root@master master]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)

[root@master master]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.2.172 master.example.com master
[root@master master]# hostname
master.example.com
[root@master master]# ifconfig enp0s3
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.172 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::e892:c499:5c22:cd7f prefixlen 64 scopeid 0x20<link>
ether 08:00:27:bf:6c:a4 txqueuelen 1000 (Ethernet)
RX packets 2058259 bytes 2745973294 (2.5 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1158605 bytes 102988378 (98.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
关闭防火墙
[root@master master]# systemctl stop firewalld
[root@master master]# systemctl disable firewalld

2.安装软件包

[root@master ~]# yum -y install docker git wget net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct docker

3.安装ansible

[root@master ~]#yum install ansible -y

4.启动docker并设置自启动

[root@master ~]# service docker restart
[root@master ~]# chkconfig docker on

5.配置SSH免登陆

ssh-keygen -f ~/.ssh/id_rsa -N ''
for host in master.example.com
do
ssh-copy-id -i ~/.ssh/id_rsa.pub $host;
done

6.下载docker images

[root@master images]# docker images
xumzl9ojjej

xumzl9ojjej

REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/openshift/origin-node v3.11 438d61da63d1 6 days ago 1.16 GB
docker.io/openshift/origin-control-plane v3.11 00f980c345c1 6 days ago 825 MB
docker.io/openshift/origin-template-service-broker v3.11 259f8cc891b4 6 days ago 332 MB
docker.io/openshift/origin-haproxy-router v3.11 316c2621011d 6 days ago 407 MB
docker.io/openshift/origin-pod v3.11 045ddf827c75 6 days ago 258 MB
docker.io/openshift/origin-pod v3.11.0 045ddf827c75 6 days ago 258 MB
docker.io/openshift/origin-deployer v3.11.0 d05e619aac21 6 days ago 380 MB
docker.io/openshift/origin-console v3.11 a404662970fb 5 weeks ago 260 MB
docker.io/ansibleplaybookbundle/origin-ansible-service-broker latest aeccb74bcbbe 2 months ago 530 MB
docker.io/openshift/origin-service-catalog v3.11 78d3f7adb5a1 2 months ago 325 MB
docker.io/openshift/origin-web-console v3.11 be30b6cce5fa 2 months ago 339 MB
docker.io/openshift/origin-docker-registry v3.11 a0d5ad164395 2 months ago 305 MB
docker.io/openshift/origin-metrics-server v3.11 8c99f32f40d3 2 months ago 311 MB
docker.io/openshift/origin-metrics-heapster v3.11 69421c019449 2 months ago 710 MB
docker.io/openshift/origin-metrics-hawkular-metrics v3.11 59e2258250c4 2 months ago 860 MB
docker.io/openshift/origin-metrics-schema-installer v3.11 342f50fded7d 2 months ago 551 MB
docker.io/openshift/origin-metrics-cassandra v3.11 8176cfabc16b 2 months ago 590 MB
docker.io/cockpit/kubernetes latest 4ec8c5b8a486 2 months ago 336 MB
quay.io/coreos/cluster-monitoring-operator v0.1.1 4488a207a5bc 3 months ago 510 MB
quay.io/coreos/prometheus-config-reloader v0.23.2 2ed5973a47af 4 months ago 12.2 MB
quay.io/coreos/prometheus-operator v0.23.2 835a7e260b35 4 months ago 47 MB
docker.io/openshift/prometheus-alertmanager v0.15.2 68bbd0006378 4 months ago 233 MB
docker.io/openshift/prometheus-node-exporter v0.16.0 f9f775bf6d0e 5 months ago 216 MB
docker.io/openshift/prometheus v2.3.2 e362c322f000 5 months ago 316 MB
docker.io/grafana/grafana 5.2.1 1bfead9ff707 6 months ago 245 MB
quay.io/coreos/kube-rbac-proxy v0.3.1 992ac1a5e7c7 6 months ago 40.2 MB
quay.io/coreos/etcd v3.2.22 ff5dd2137a4f 6 months ago 37.3 MB
quay.io/coreos/kube-state-metrics v1.3.1 a9c8f313b7aa 8 months ago 22.2 MB
docker.io/openshift/oauth-proxy v1.1.0 90c45954eb03 10 months ago 235 MB
quay.io/coreos/configmap-reload v0.0.1 3129a2ca29d7 24 months ago 4.79 MB
或者离线下载,下载地址链接:https://pan.baidu.com/s/1UCCy6EdhdRNDuIy1LDtILg
提取码:jxy1 ,将images.tar和docker.images.sh下载

[root@master images]#./docker.images.sh load-images
bxm61qhtgu

bxm61qhtgu

7.克隆仓库ansible-openshift

[root@master ~]# git clone https://github.com/openshift/openshift-ansible /home/openshift-ansible

8.修改yum源

[root@master yum.repos.d]# cd /etc/yum.repos.d
[root@master yum.repos.d]# cat all.repo
[centos-openshift-origin311]
name=CentOS OpenShift Origin
baseurl=http://buildlogs.centos.org/centos/7/paas/x86_64/openshift-origin311/
enabled=1
gpgcheck=0
gpgkey=/etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-PaaS

[centos-openshift-origin311-testing]
name=CentOS OpenShift Origin Testing
baseurl=http://buildlogs.centos.org/centos/7/paas/x86_64/openshift-origin311/
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-PaaS

[centos-openshift-origin311-debuginfo]
name=CentOS OpenShift Origin DebugInfo
baseurl=http://debuginfo.centos.org/centos/7/paas/x86_64/
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-PaaS

[centos-openshift-origin311-source]
name=CentOS OpenShift Origin Source
baseurl=http://vault.centos.org/centos/7/paas/Source/openshift-origin311/
enabled=0
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-PaaS

[root@master yum.repos.d]# yum clean all && make makecache

9.修改ansible的hosts文件

[root@master yum.repos.d]# cd /etc/ansible/
[root@master ansible]# cat 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 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 AllowAllPasswordIdentityProvider
#openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}]
openshift_disable_check=memory_availability,disk_availability,docker_image_availability,docker_storage

# host group for masters
[masters]
master.example.com

# host group for etcd
[etcd]
master.example.com

# host group for nodes, includes region info
[nodes]
master.example.com openshift_node_group_name='node-config-all-in-one'
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 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 AllowAllPasswordIdentityProvider
#openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}]
openshift_disable_check=memory_availability,disk_availability,docker_image_availability,docker_storage

# host group for masters
[masters]
master.example.com

# host group for etcd
[etcd]
master.example.com

#host group for nodes, includes region info
[nodes]
#master.example.com openshift_node_group_name='node-config-master'
master.example.com openshift_node_group_name='node-config-all-in-one'
#node1.example.com openshift_node_group_name='node-config-compute'
#node2.example.com openshift_node_group_name='node-config-compute'

10.执行命令检查

[root@master ansible]# ansible-playbook -i hosts /home/openshift-ansible/playbooks/prerequisites.yml

11.执行命令安装

[root@master ansible]# ansible-playbook -i hosts /home/openshift-ansible/playbooks/deploy_cluster.yml
c6bqvaqr6fs

c6bqvaqr6fs

12.创建密码

[root@master ansible]#htpasswd -cb /etc/origin/master/htpasswd admin mypwd
[root@master ansible]#oc adm policy add-cluster-role-to-user cluster-admin admin

13.查看node节点

[root@master ansible]# oc get nodes
587hvtjejjj

587hvtjejjj

14.在windows下修改hosts文件,加入

192.168.2.172 master.example.com master

15.访问浏览器https://master.example.com:8443

用户admin/mypwd登录
pouw9zm7m7n

pouw9zm7m7n

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

3

添加新评论2 条评论

#wuwenpin软件开发工程师, 南京
2019-03-29 22:59
非常感谢分享
#wuwenpin软件开发工程师, 南京
2019-03-29 22:59
非常感谢分享
Ctrl+Enter 发表

关于TWT  使用指南  社区专家合作  厂商入驻社区  企业招聘  投诉建议  版权与免责声明  联系我们
© 2020  talkwithtrend — talk with trend,talk with technologist 京ICP备09031017号-30