This repo contains code to deploy Openshift 4 for my homelab. It focuses on UPI with vSphere 6.7u3, a full write up is available on openshift.com.
May 2021 - The code here is working against 4.7.
On a Mac you will need to install a few packages via brew
.
brew install jq watch gsed
Code for each OCP release lives on a numbered branch. The master branch represents the latest stable iteration and will likely be behind branches. In otherwords, check the number branches first before looking at master.
- This repo requires Terraform 0.13 or newer
- Install
oc tools
with./install-oc-tools.sh --latest 4.6
- This code use yamldecode - details here
- Create
~/.config/ocp/vsphere.yaml
foryamldecode
use, sample content:
alex@mooncake ~ % cat .config/ocp/vsphere.yaml
vsphere-user: administrator@vsphere.local
vsphere-password: "123!"
vsphere-server: 192.168.1.240
vsphere-dc: ktzdc
vsphere-cluster: ktzcluster
- Configure DNS - https://blog.ktz.me/configure-unbound-dns-for-openshift-4/ - if using CoreDNS this is optional.
- Create
install-config.yaml
and ensurecluster_slug
matchesmetadata: name:
below.
apiVersion: v1
baseDomain: openshift.lab.int
compute:
- hyperthreading: Enabled
name: worker
replicas: 0
controlPlane:
hyperthreading: Enabled
name: master
replicas: 3
metadata:
name: ocp4
platform:
vsphere:
vcenter: 192.168.1.240
username: administrator@vsphere.local
password: supersecretpassword
datacenter: ktzdc
defaultDatastore: nvme
fips: false
pullSecret: 'YOUR_PULL_SECRET'
sshKey: 'YOUR_SSH_PUBKEY'
-
Customize
clusters/lab/terraform.tfvars
with any relevant configuration. -
Run
make tfinit
to initialise Terraform modules -
Run
make lab
to create the VMs and generate/install ignition configs -
Monitor install progress with
make wait-for-bootstrap
-
Check and approve pending CSRs with
make get-csr
andmake approve-csr
-
Run
make bootstrap-complete
to destroy the bootstrap VM -
Run
make wait-for-install
and wait for the cluster install to complete -
Enjoy!