Ansible 主機檔案會定義 OpenShift 叢集中的節點。

程序

  1. 透過https://github.com/vmware/nsx-integration-for-openshift複製 NCP GitHub 存放庫。hosts 檔案位於 openshift-ansible-nsx 目錄中。必須將 hosts 檔案保留在 openshift-ansible-nsx 目錄中。某些 Playbook 假設這是 hosts 檔案的路徑。
  2. 在 [主機] 和 [節點] 區段中,指定 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 Container Platform 說明文件中找到所有參數的相關詳細資料以進行進階安裝 (在 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 映像