To create an OpenShift cluster, follow the steps below.

  1. Create a directory for the cluster creation files.
    mkdir antrea-ocp 
    export ANTREAOCP=./antrea-ocp 
    cd $ANTREAOCP
  2. Create install-config.yaml. You can find a sample file at https://docs.openshift.com/container-platform/4.9/installing/installing_vsphere/installing-vsphere.html#installation-vsphere-config-yaml_installing-vsphere. Set the compute and control plane parameters based on your environment. The networkType parameter must be antrea. Make sure that apiVIP and ingressVIP are correctly set. Here is a sample install-config.yaml with Antrea as the CNI:
    apiVersion: v1 
    baseDomain: mylab.local 
    compute: 
    - hyperthreading: Enabled 
      name: worker 
      platform: 
        vsphere: 
          cpus: 6 
          memoryMB: 32000 
      replicas: 2 
    controlPlane: 
      hyperthreading: Enabled 
      name: master 
      platform: 
        vsphere: 
          cpus: 6 
          memoryMB: 32000 
      replicas: 3 
    metadata: 
      name: antrea_ocp 
    networking: 
      networkType: antrea 
      clusterNetwork: 
      - cidr: 10.4.0.0/16 
        hostPrefix: 23 
      machineCIDR: 192.114.16.0/24 
      serviceNetwork: 
      - 172.30.0.0/16 
    platform: 
      vsphere: 
        vcenter: vcenter.mylab.local 
        username: [email protected] 
        password: myvCenterPassword1! 
        datacenter: Datacenter1 
        defaultDatastore: NFS 
        fips: false 
        network: ocp-segment-1 
        cluster: Rack1 
        apiVIP: 192.114.16.6 
        ingressVIP: 192.114.16.7 
    pullSecret: <...> 
    sshKey: <...>
  3. Create the manifests:
    cp /path/to/install-config.yaml $ANTREAOCP 
    cd $ANTREAOCP 
    openshift-install create manifests
  4. Unzip the Kubernetes Operator manifest file (deploy.tar.gz) and copy the contents to the $ANTREOCP/manifests directory.
    mkdir /path/to/antrea-operator-for-kubernetes 
    cd /path/to/antrea-operator-for-kubernetes/ 
    tar xvfz deploy.tar.gz 
    cp / path/to/antrea-operator-for-kubernets/deploy/openshift $ANTREAOCP/manifests
  5. Edit the manifests to add the Antrea and operator images.
    • In operator.yaml, update the antrea-operator image with the URI of the Antrea operator container image.
    • In operator.antrea.vmware.com_v1_antreainstall_cr.yaml, change antreaImage to the URI of the Antrea container image.
  6. Create a cluster.
    cd $ANTREAOCP 
    openshift-install create cluster

    This will create the required bootstrap VM, controller VMs and worker nodes and form the OpenShift cluster with Antrea as the CNI. The operation can take on an average of 45 minutes to an hour depending on the configuration.

  7. When the cluster creation is complete, the following messages will be displayed:
    INFO Install complete! 
    INFO To access the cluster as the system:admin user when using 'oc', run 'export KUBECONFIG=$ANTREAOCP/auth/kubeconfig' 
    INFO Access the OpenShift web-console here: https://console-openshift-console.apps.antocp.mylab.local 
    INFO Login to the console with user: "kubeadmin", and password: "xHXfa-quE3N-X99Xs-dGVff" 
    INFO Time elapsed: 42m17s 

    If the DNS is set correctly, you will be able to access your cluster using the web-console.

    For CLI access, run the export KUBECONFIG as mentioned in the message above. For example:
    export KUBECONFIG=$ANTREAOCP/auth/kubeconfig
    oc get co 
    
    NAME                                       VERSION   AVAILABLE   PROGRESSING   DEGRADED   SINCE 
    antrea                                     1.2.2     True        False         False      162m 
    authentication                             4.7.28    True        False         False      31m 
    baremetal                                  4.7.28    True        False         False      157m 
    cloud-credential                           4.7.28    True        False         False      167m 
    cluster-autoscaler                         4.7.28    True        False         False      160m 
    config-operator                            4.7.28    True        False         False      162m 
    console                                    4.7.28    True        False         False      142m 
    csi-snapshot-controller                    4.7.28    True        False         False      151m 
    dns                                        4.7.28    True        False         False      160m 
    etcd                                       4.7.28    True        False         False      160m 
    image-registry                             4.7.28    True        False         False      155m 
    ingress                                    4.7.28    True        False         False      148m 
    insights                                   4.7.28    True        False         False      155m 
    kube-apiserver                             4.7.28    True        False         False      158m 
    kube-controller-manager                    4.7.28    True        False         False      159m 
    kube-scheduler                             4.7.28    True        False         False      159m 
    kube-storage-version-migrator              4.7.28    True        False         False      148m 
    machine-api                                4.7.28    True        False         False      156m 
    machine-approver                           4.7.28    True        False         False      160m 
    machine-config                             4.7.28    True        False         False      159m 
    marketplace                                4.7.28    True        False         False      159m 
    monitoring                                 4.7.28    True        False         False      146m 
    network                                    4.7.28    True        False         False      162m 
    node-tuning                                4.7.28    True        False         False      160m 
    openshift-apiserver                        4.7.28    True        False         False      147m 
    openshift-controller-manager               4.7.28    True        False         False      160m 
    openshift-samples                          4.7.28    True        False         False      152m 
    operator-lifecycle-manager                 4.7.28    True        False         False      160m 
    operator-lifecycle-manager-catalog         4.7.28    True        False         False      160m 
    operator-lifecycle-manager-packageserver   4.7.28    True        False         False      155m 
    service-ca                                 4.7.28    True        False         False      162m 
    storage                                    4.7.28    True        False         False      162m
  8. The cluster is now ready with Antrea as the CNI. At this point, you can deploy a new app or an Ingress controller, or perform any OpenShift cluster operation.
Note: It is recommended that you enable the nodePortLocal feature when NSX Advanced Load Balancer (ALB) is used as the Ingress controller. In antrea-operator-for-kubernets/deploy/openshift/operator.antrea.vmware.com_v1_antreainstall_cr.yaml, set the following parameters:
  • Under antreaAgentConfig, set NodePortLocal: true
  • Under antreaAgentConfig, set nplPortRange: 61000-62000 (you can change the port range based on your environment)