Ansible hosts 文件定义 OpenShift 群集中的节点。

过程

  1. 克隆https://github.com/vmware/nsx-integration-for-openshift中的 NCP GitHub 存储库。hosts 文件位于 openshift-ansible-nsx 目录中。您必须将 hosts 文件保留在 openshift-ansible-nsx 目录中。某些 playbook 会认为这是 hosts 文件的路径。
  2. 在 [masters] 和 [nodes] 部分中,指定 OpenShift 虚拟机的主机名和 IP 地址。例如,
        [masters]
        admin.rhel.osmaster ansible_ssh_host=101.101.101.4
      
        [single_master]
        admin.rhel.osmaster ansible_ssh_host=101.101.101.4
     
        [nodes]
        admin.rhel.osmaster ansible_ssh_host=101.101.101.4 openshift_ip=101.101.101.4 openshift_schedulable=true openshift_hostname=admin.rhel.osmaster
        admin.rhel.osnode ansible_ssh_host=101.101.101.5 openshift_ip=101.101.101.5 openshift_hostname=admin.rhel.osnode
     
        [etcd]
     
        [OSEv3:children]
        masters
        nodes
        etcd

    请注意,openshift_ip 指定群集内部 IP,如果要使用的接口不是默认接口,则需要设置该值。主节点中的 ncp 相关角色使用 single_master 变量以仅执行一次某些任务,例如,NSX-T Data Center 管理层面资源配置。

  3. 设置 SSH 访问,以便从运行 Ansible 角色的节点(通常为主节点)中访问所有节点,而不使用密码:
        ssh-keygen
        ssh-copy-id -i ~/.ssh/id_rsa.pub root@admin.rhel.osnode
  4. 更新 [OSEv3:vars] 部分。可以在 OpenShift 容器平台文档网站的“高级安装”中找到所有参数的详细信息(在 https://docs.openshift.com 中搜索“高级安装”)。例如,
        # Set the default route fqdn
        openshift_master_default_subdomain=apps.corp.local
    
        os_sdn_network_plugin_name=cni
        openshift_use_openshift_sdn=false
        openshift_node_sdn_mtu=1500
    
        # If ansible_ssh_user is not root, ansible_become must be set to true
        ansible_become=true
    
        openshift_master_default_subdomain
          This is the default subdomain used in the OpenShift routes for External LB
    
        os_sdn_network_plugin_name
          Set to 'cni' for the NSX Integration
    
        openshift_use_openshift_sdn
          Set to false to disable the built-in OpenShift SDN solution
    
        openshift_hosted_manage_router
          Set to false to disable creation of router during installation. The router has to be manually started after NCP and nsx-node-agent are running.
    
        openshift_hosted_manage_registry
          Set to false to disable creation of registry during installation. The registry has to be manually started after NCP and nsx-node-agent are running.
     
        deployment_type
          Set to openshift-enterprise
    
        openshift_hosted_manage_registry
          Set to false to disable auto creation of registry
    
        openshift_hosted_manage_router
          Set to false to disable auto creation of router
    
        openshift_enable_service_catalog
          Set to false to disable service_catalog
    
        (For OpenShift 3.9 only) skip_sanity_checks
          Set to true
    
        (For OpenShift 3.9 only) openshift_web_console_install
          Set to false
  5. 检查您是否具有到所有主机的连接:
        ansible OSEv3 -i /PATH/TO/HOSTS/hosts -m ping

    结果应类似于以下内容。如果没有,请解决连接问题。

        openshift-node1 | SUCCESS => {
           "changed": false,
           "ping": "pong"
        }
        openshift-master | SUCCESS => {
           "changed": false,
           "ping": "pong"
        }

下一步做什么

安装 CNI 插件和 OVS。请参见安装 CNI 插件、OVS 和 NCP Docker 映像