准备好环境,在安装之前请先了解openshift提供的ansible有大量的安装选项
文档地址:https://docs.okd.io/latest/install/configuring_inventory_file.html
1、配置/etc/ansible/hosts
[OSEv3:children] masters nodes etcd [OSEv3:vars] openshift_deployment_type=origin ansible_ssh_user=root openshift_master_cluster_hostname=m1.example.com openshift_master_cluster_public_hostname=www.oc.example.com openshift_hosted_registry_cert_expire_days=100000 openshift_ca_cert_expire_days=100000 openshift_node_cert_expire_days=100000 openshift_master_cert_expire_days=100000 etcd_ca_default_days=100000 openshift_master_api_port=8443 openshift_master_default_subdomain=oc.example.com openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider'}] openshift_disable_check=memory_availability,disk_availability,package_availability,package_update,dexampleker_image_availability,dexampleker_storage_driver,dexampleker_storage [masters] m1.example.com m2.example.com m3.example.com [etcd] m1.example.com m2.example.com m3.example.com [nodes] m1.example.com openshift_node_group_name='node-config-master-infra' m2.example.com openshift_node_group_name='node-config-master-infra' m3.example.com openshift_node_group_name='node-config-master-infra' n1.example.com openshift_node_group_name='node-config-compute' n2.example.com openshift_node_group_name='node-config-compute' n3.example.com openshift_node_group_name='node-config-compute'
注意系统组件默认安装在node-config-master-infra节点上
2、运行安装程序
运行检查脚本
# ansible-playbook /root/openshift-ansible/playbooks/prerequisites.yml
没有问题运行安装脚本,如果想省事可以打开openshift_disable_check
ansible-playbook /root/openshift-ansible/playbooks/deploy_cluster.yml
如果太慢可以试着网络加速(你懂得),或者提前把需要的镜像下载好
安装号以后验证一下节点是否都正常
# oc get node
看一下STATUS是否为Ready
浏览器打开https://www.oc.example.cn:8443/console/ 看是否正常