# Installing OpenShift Using the Agent-Based Installer on VMware ### Scripts * SNO Script - https://github.com/tosin2013/openshift-4-deployment-notes/blob/master/vmware/agent-based/update-agent-sno.sh * Full Script Comming Soon ### Requirements **Install Govc** ``` sudo su - curl -L https://github.com/vmware/govmomi/releases/download/v0.35.0/govc_Linux_x86_64.tar.gz | tar -C /usr/local/bin -xvzf - govc chmod +x /usr/local/bin/govc govc exit ``` **Download trusted root CA certificates from the vSphere Web Services SDK** ``` export vcenter_fqdn=my_vcenter_fqdn curl -OL -k https://$vcenter_fqdn/certs/download.zip ``` **unzip the certs** ``` unzip download.zip ``` **Copy the certs into the anchors directory** ``` sudo cp certs/lin/* /etc/pki/ca-trust/source/anchors ``` **Update the ca-trust** ``` sudo update-ca-trust extract ``` **Install nmstate** The script assumes that you have the `nmstate` CLI installed on your system. `nmstate` is a tool for managing network configurations on Linux systems. To install it on a Red Hat Enterprise Linux (RHEL) system, run the following command: ``` sudo yum install nmstate -y ``` **Prepare Required Files** The script requires two files: the pull secret and the SSH public key. Follow these steps to prepare them: - Download the pull secret from https://cloud.redhat.com/openshift/install/pull-secret and save it as `$HOME/pull_secret.json`. - Generate an SSH key pair if you don't have one already, and save the public key as `$HOME/.ssh/id_rsa.pub`. **Create install-config.yaml and agent-config.yaml** The script creates two important files: `install-config.yaml` and `agent-config.yaml`. These files are used by the OpenShift installer to configure the cluster and the agent. - `install-config.yaml`: This file contains the configuration for the OpenShift cluster, including the base domain, networking settings, platform, pull secret, and SSH key. - `agent-config.yaml`: This file defines the configuration for the agent node, including the hostname, network interfaces, and network configuration. The script prompts you to enter the target directory for the installation, and the target DNS server. It then generates these files based on the provided input and the predefined variables. **Enable Disk UUID on Virtual Machines** To enable disk UUID on virtual machines, you need to set the `disk.EnableUUID` parameter to `TRUE` in the VMware vSphere configuration. This ensures that the virtual machine's disks are identified by their unique UUIDs, which is required for the OpenShift installer to work correctly. Follow these steps to enable disk UUID: - Open the VMware vSphere client and navigate to the cluster or host where you want to enable disk UUID. - Right-click on the cluster or host and select "Edit Settings." - In the "Advanced Settings" section, find the `disk.EnableUUID` parameter and set its value to `TRUE`. - Click "OK" to save the changes. **Create Cluster Manifests and Agent Image** After creating the `install-config.yaml` and `agent-config.yaml` files, the script runs the following commands to create the cluster manifests and the agent image: ``` openshift-install agent create cluster-manifests --dir "$HOME/${TARGET_DIR}" openshift-install --dir "$HOME/${TARGET_DIR}" agent create image ``` **Upload Agent Image to vSphere Datastore** The script assumes that you have the `govc` utility installed and configured with the necessary environment variables (`GOVC_URL`, `GOVC_USERNAME`, and `GOVC_PASSWORD`). It then uploads the generated `agent.x86_64.iso` image to the specified vSphere datastore and folder using the following command: ``` govc datastore.upload -ds ${VSPHERE_DATASTORE} $HOME/${TARGET_DIR}/agent.x86_64.iso ${DATASTORE_FOLDER}/agent.x86_64.iso ``` **Monitor Cluster Installation** Finally, the script provides instructions on how to monitor the cluster installation process. You need to export the `KUBECONFIG` environment variable and run the following command: ``` openshift-install agent wait-for install-complete --dir . ``` **Disconnected Deployments (Optional)** If you need to perform a disconnected deployment, the script includes an example `extra-config.yaml` file that you can use. This file configures the image content sources and additional trust bundles required for a disconnected deployment. To use the `extra-config.yaml` file, you need to create it in the `$HOME` directory and update the `mirror-registry.example.com` entries with the appropriate values for your environment. The script will automatically append the contents of `extra-config.yaml` to the `install-config.yaml` file. By following this tutorial, you should be able to install OpenShift using the agent-based installer, create the necessary configuration files, enable disk UUID on virtual machines, and monitor the cluster installation process.