opneshift 多节点测试

Openshift 多节点测试

部署设置inventory

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
vim mul-inventory
[OSEv3:children]
masters
nodes
etcd
[OSEv3:vars]
ansible_ssh_user=root
openshift_deployment_type=origin
openshif_release=v1.5
openshift_master_identity_providers=[{'name': 'keystone_provider', 'login': 'true', 'challenge': 'true', 'kind': 'KeystonePasswordIdentityProvider', 'domainName': 'default', 'url': 'http://172.16.130.214:5000' }]
openshift_docker_options="-l warn --ipv6=false"
openshift_master_cluster_method=native
openshift_master_cluster_hostname=node1.99cloud.com
openshift_master_cluster_public_hostname=172.16.50.43
openshift_additional_repos=[{'id': 'openshift-origin-local', 'name': 'OpenShift Origin', 'baseurl': 'http://172.16.50.43:8040/centos-openshift-origin', 'enabled': 1, 'gpgcheck': 0},{'id': 'openshift-bse-local', 'name': 'OpenShift Base', 'baseurl': 'http://172.16.50.43:8040/base', 'enabled': 1, 'gpgcheck': 0}]
openshift_docker_additional_registries=172.16.50.43:5000
openshift_docker_insecure_registries=0.0.0.0/0
openshift_examples_modify_imagestreams=true
openshift_cockpit_deployer_prefix=172.16.50.43:5000/openshift/
openshift_cockpit=172.16.50.43:5000/openshift/cockpit/kubernetes
openshift_disable_check=memory_availability,disk_availability,package_availability,package_update,docker_image_availability,docker_storage_driver,docker_storage
[masters]
openshif-2
[etcd]
openshif-2
openshif-3
openshif-4
[nodes]
openshif-3 openshift_schedulable=true openshift_node_labels="{'region': 'infra', 'zone': 'default'}"
openshif-2 openshift_schedulable=true
openshif-4 openshift_schedulable=true

执行部署命令

1
2
3
4
5
6
[root@openshif-2 ~]# ansible-playbook ~/zhu/openshift-ansible/playbooks/byo/config.yml -i mul-inventory
[root@openshif-2 ~]# kubectl get node
NAME STATUS AGE
172.16.50.33 Ready 16h
172.16.50.37 Ready 16h
172.16.50.54 Ready 16h

部署Openshift ha多节点测试

默认master节点负载均衡是haproxy,编写inventory

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
vim ha-inventory
[OSEv3:children]
masters
nodes
etcd
lb
[OSEv3:vars]
ansible_ssh_user=root
openshift_deployment_type=origin
openshif_release=v1.5
openshift_master_identity_providers=[{'name': 'keystone_provider', 'login': 'true', 'challenge': 'true', 'kind': 'KeystonePasswordIdentityProvider', 'domainName': 'default', 'url': 'http://172.16.130.214:5000' }]
openshift_docker_options="-l warn --ipv6=false"
### ha要打开native这个选项
openshift_master_cluster_method=native
openshift_master_cluster_hostname=node1.99cloud.com
openshift_master_cluster_public_hostname=172.16.50.43
openshift_additional_repos=[{'id': 'openshift-origin-local', 'name': 'OpenShift Origin', 'baseurl': 'http://172.16.50.43:8040/centos-openshift-origin', 'enabled': 1, 'gpgcheck': 0},{'id': 'openshift-bse-local', 'name': 'OpenShift Base', 'baseurl': 'http://172.16.50.43:8040/base', 'enabled': 1, 'gpgcheck': 0}]
openshift_docker_additional_registries=172.16.50.43:5000
openshift_docker_insecure_registries=0.0.0.0/0
openshift_examples_modify_imagestreams=true
openshift_cockpit_deployer_prefix=172.16.50.43:5000/openshift/
openshift_cockpit=172.16.50.43:5000/openshift/cockpit/kubernetes
openshift_disable_check=memory_availability,disk_availability,package_availability,package_update,docker_image_availability,docker_storage_driver,docker_storage
[etcd]
openshif-2
openshif-3
openshif-4
[lb]
openshif-1
[nodes]
openshif-3 openshift_schedulable=true openshift_node_labels="{'region': 'infra', 'zone': 'default'}"
openshif-2 openshift_schedulable=true
openshif-4 openshift_schedulable=true

执行命令

1
2
3
4
5
6
[root@openshif-2 ~]# ansible-playbook ~/zhu/openshift-ansible/playbooks/byo/config.yml -i mul-inventory
[root@openshif-2 ~]# kubectl get node
NAME STATUS AGE
172.16.50.33 Ready 16h
172.16.50.37 Ready 16h
172.16.50.54 Ready 16h

参考文档https://docs.openshift.org/latest/install_config/install/advanced_install.html

坚持原创技术分享,您的支持将鼓励我继续创作!