OpenShift 4 KVM IPI

Terraform first approach to install an OpenShift 4 cluster under KVM / libvirt and HAProxy as the load balancer.

It takes advantage of libvirt Network namespaces to set up wildcard DNS for default ingress so you don’t have to.

It will automatically generate the install-config.yaml for the cluster, generate cluster SSH key pair and SSH key pair for load balancer node.

This has been tested against Terraform v0.12.

Usage

Add libvirt dnsmasq server to Network Manager

In /etc/NetworkManager/dnsmasq.d/ create a file for the DNS configuration. For example, we might use:

cat <<EOF > sudo /etc/NetworkManager/dnsmasq.d/ocp.dnsmasq.conf
server=/ocp.example.io/192.168.200.1
EOF

Restart Network Manager:

sudo systemctl restart NetworkManager

Override Terraform Variables for OpenShift Installer and Pull Secret

In terraform.tfvars:

openshift_installer = "<path-to-openshift-installer>"
pull_secret_file    = "<path-to-pull-secret-file>"

Override Terraform Variables for OpenShift Cluster Nodes

For now, consult variables.tf.

TODO This will be updated later to provide more comphrensive configuration guidance.

Install

terraform init
terraform plan
terraform apply -auto-approve

HAProxy statistics page is enabled and you can reach it via: http://loadbalancer.<cluster-name>.<base-domain-name>:8404/stats

Uninstall

terraform destroy -auto-approve