/hetzner-ocp4

Installing OCP 4 on single bare metal server.

Apache License 2.0Apache-2.0

Disclaimer

This environment has been created for the sole purpose of providing an easy to deploy and consume a Red Hat OpenShift Container Platform 4 environment as a sandpit.

This install will create a 'Minimal Viable Setup', which anyone can extend to their needs and purpose.

Recent tests shows that SSD storage on the Server might be required for any persistent deployment to work correctly.

Use it at your own please and risk!

Release notes

Release notes

Contribution

If you want to provide additional features, please feel free to contribute via pull requests or any other means.

We are happy to track and discuss ideas, topics and requests via Issues.

Install Instructions

Our instructions are based on the CentOS Root Server as provided by https://www.hetzner.com/ , please feel free to adapt it to the needs of your preferred hosting provider. We are happy to get pull requests for an updated documentation, which makes consuming this setup easy also for other hosting providers.

These instructions are for running CentOS and 'root' machines which is setup following Hetzner CentOS documentation. You might have to modify commands if running on another Linux distro. Feel free to provided instructions for providers.

**NOTE: If you are running on other environments than bare metal servers from Hetzner, check if there is specific instruction under Infra providers list and then jump to section Initialize tools

** Supported root server operating systems: **

Infra providers

When following below instructional steps, you will end with a setup similar to

In case of Red Hat Enterprise Linux 7

Subscrip your RHEL Host:

subscription-manager register

subscription-manager attach --pool=...

subscription-manager repos --disable=*

subscription-manager repos \
    --enable="rhel-7-server-rpms" \
    --enable="rhel-7-server-extras-rpms" \
    --enable="rhel-7-server-ansible-2.8-rpms" \
    --enable="rhel-7-server-ose-4.2-rpms" \
    --enable="rhel-7-server-openstack-14-rpms"

In case of Red Hat Enterprise Linux 8

Subscrip your RHEL Host:

subscription-manager register

subscription-manager attach --pool=...

subscription-manager repos --disable=*

subscription-manager repos \
    --enable=rhel-8-for-x86_64-baseos-rpms \
    --enable=rhel-8-for-x86_64-appstream-rpms \
    --enable=rhel-8-for-x86_64-highavailability-rpms \
    --enable=ansible-2.8-for-rhel-8-x86_64-rpms \
    --enable=openstack-15-for-rhel-8-x86_64-rpms

In case of Centos 8

Enable ansible repo:

yum install -y centos-release-ansible-29.noarch

Initialize tools

Install ansible (min version 2.8) and git

[root@server ~]# yum install -y ansible git

You are now ready to clone this project to your CentOS system.

[root@server ~]# git clone https://github.com/RedHat-EMEA-SSA-Team/hetzner-ocp4.git

We are now ready to install libvirt as our hypervisor, provision VMs and prepare those for OCP.

Define variables for your cluster

Here is an example about cluster.yml file that contains information about the cluster that is going to be installed.

variable describtion
cluster_name Name of the cluster to be installed
public_domain Root domain that will be used for your cluster.
public_ip Override for public ip entries. defaults to hostvars['localhost']['ansible_default_ipv4']['address'].
dns_provider DNS provider, value can be route53, cloudflare,gcp or none. Check Setup public DNS records for more info.
letsencrypt_account_email Email address that is used to create LetsEncrypt certs. If cloudflare_account_email is not present for CloudFlare DNS recods, letsencrypt_account_email is also used with CloudFlare DNS account email
image_pull_secret Token to be used to authenticate to the Red Hat image registry. You can download your pull secret from https://cloud.redhat.com/openshift/install/metal/user-provisioned

Pre-releases

Read this if you want to deploy pre releases

Setup public DNS records

Current tools allow use of three DNS providers: AWS Route53, Cloudflare, GCP DNS or none. If you want to use Route53, Cloudflare or GCP as your DNS provider, you have to add a few variables. Check the instructions below.

DNS records are constructed based on cluster_name and public_domain values. With above values DNS records should be

  • api.cluster_name.public_domain
  • *.apps.cluster_name.public_domain

If you use another DNS provider, feel free to contribute. :D

With dns_provider: none the playbooks will not create public dns entries. (It will skip letsencrypt too) Please create public dns entries if you want to access your cluster.

Please configure in cluster.yml all necessary credentials:

DNS provider Variables
CloudFlare cloudflare_account_email: john@example.com
Use the global api key here! (API-Token is not supported!) (Details in #86)
cloudflare_account_api_token: 9348234sdsd894.....
cloudflare_zone: domain.tld
Route53 / AWS aws_access_key: key
aws_secret_key: secret
aws_zone: domain.tld
GCP gcp_project: project-name
gcp_managed_zone_name: 'zone-name'
gcp_managed_zone_domain: 'example.com.'
gcp_serviceaccount_file: ../gcp_service_account.json
none With dns_provider: none the playbooks will not create public dns entries. (It will skip letsencrypt too) Please create public dns entries if you want to access your cluster.

Optional configuration

Variable Default Description
storage_nfs false Install NFS Storage with dynamic provisioning
auth_redhatsso empty Install Red Hat SSO, checkout cluster-example.yml for an example
auth_htpasswd empty Install htpasswd, checkout cluster-example.yml for an example
auth_github empty Install GitHub IDP, checkout cluster-example.yml for an example
cluster_role_bindings empty Setup cluster role binding, checkout cluster-example.yml for an example
openshift_install_command check defaults Important for air-gapped installation. checkout docs/air-gapped.md
install_config_additionalTrustBundle empty Important for air-gapped installation. checkout docs/air-gapped.md
install_config_imageContentSources empty Important for air-gapped installation. checkout docs/air-gapped.md
letsencrypt_disabled false This allows you to disable letsencrypt setup. (Default is enabled letsencrypt.)

Prepare kvm-host and install OpenShift

[root@server ~]# cd hetzner-ocp4
[root@server ~]# ansible-playbook ./ansible/setup.yml

Additional documentation

Useful commands

Problem Command
Check haproxy connections podman exec -ti openshift-4-loadbalancer-demo ./watch-stats.sh
Start cluster after reboot ./ansible/04-start-cluster.yml