The goal of this repository is to provide a simple, reproducible way to deploy an OpenShift Container Platform lab using the vSphere IPI method with Static IP Addresses and an internally hosted Load Balancer. Once completed the Cluster will be deployed with 3 Masters with Static IPs, 3 Workers from a MachineSet with DHCP issued IPs, and an optional CoreDNS server to host the DNS entries for the API and Ingress VIPs.
NOTE: This repository is meant for a Lab only. This method is not supported by Red Hat whatsoever.
This is a concise summary of everything you need to do to use the repo. The rest of the document goes into details of every step.
- Edit
group_vars/all.yml
, the following must be changed while the rest can remain the same- pull secret
- ip and host/domain names
- vcenter details
- datastore name
- datacenter name
- cluster name
- username and passwords of admin accounts
- If you wish to run a specific Channel and Version modify the following in
group_vars/all.yml
:- download.channel
- download.version
- For the CoreDNS VM to be able to pull the image from Quay.io you must specify an
coredns_vm.upstream_dns
. It cannot have itself as a primary DNS Server.
-
vSphere ESXi and vCenter 6.7U3 or 7.0 installed.
- 6.5 is not supported by this repository due to HW Version 15.
-
A datacenter created with a vSphere host added to it, a datastore exists and has adequate capacity
-
Ansible (preferably latest) on the machine where this repo is cloned.
- Before you install Ansible, install the
epel-release
, runyum -y install epel-release
- Before you install Ansible, install the
-
Your DNS Provider (PiHole, AdGuard, etc) should be configured to lookup your
base_domain
from yourcoredns_vm.ipaddr
- Optionally, you configure the
coredns_vm.upstream_dns
to be your primary DNS Server and then configure your workstation or bastion host to use the CoreDNS Server as your primary DNS Server. - If you wish to use the CoreDNS as your primary DNS Server see the deploy-ipi-lab.yml Extra Variables section below.
- Optionally, you configure the
-
You must be running an OS with a glibc version higher than 2.32 such as Fedora 33 or higher or you can deploy from the ocp4-vsphere-deploy-container
NOTE: If you are going to use the CoreDNS vm as your primary DNS Server you must specify your vcenter in group_vars/all.yml as an IP address as no A Record will exist.
Pre-populated entries in group_vars/all.yml are ready to be used unless you need to customize further. Any updates described below refer to group_vars/all.yml unless otherwise specified.
- Get the pull secret from here. Update the file on the line with location of your
pull_secret
. ex. ~/openshift/pull-secret.json - Get the vCenter details:
- IP address
- Admin account username
- Admin account password
- Datacenter name (created in the prerequisites mentioned above)
- Cluster name
- Datastore name
- Downloadable link to
govc
(vSphere CLI, pre-populated) - OpenShift cluster
- base domain (pre-populated with example.com)
- cluster name (pre-populated with ocp4)
# Deploy the Lab and all components
ansible-playbook deploy-ipi-lab.yml
config_local_dns=true
- Configures /etc/resolv.conf or systemd-resolved to use CoreDNS as primary DNS after CoreDNS has been deployed.
skip_dns=true
- Skips deploying a DNS server if proper DNS is already configured.
specific_version=4.6.z
- Deploys a specific version of OpenShift. Must be in 4.x.z format.
# Destroy the Lab and all components
ansible-playbook destroy-ipi-lab.yml -e cluster=true
# Destroy the Lab and all components and revert DNS Configuration
ansible-playbook destroy-ipi-lab.yml -e cluster=true -e config_local_dns=true
- Necessary Linux packages installed for the installation
- Necessary folders [bin, downloads, install-dir] created
- OpenShift client, install and .ova binaries downloaded to the downloads folder
- Unzipped versions of the binaries installed in the bin folder
- In the install-dir folder:
- master.ign and worker.ign
- Copy of the install-config.yaml
- A folder is created in the vCenter under the mentioned datacenter and the template is imported
- The template file is edited to carry certain default settings and runtime parameters common to all the VMs
- VMs (coredns, bootstrap, master0-2, 3 workers) are generated in the designated folder and (in state of) poweredon
# In the root folder of this repo run the following commands
export KUBECONFIG=$(pwd)/install-dir/auth/kubeconfig
export PATH=$(pwd)/bin:$PATH
# OpenShift Client Commands
oc whoami
oc get co
Vijay Chintalapati, Mike Allmen, and all the contributors to ocp4-vsphere-upi-automation Repo that inspired this repository.
Morgan Peterman