mahmoudalide / hetzner-ocp4

Installing OCP 4 on single bare metal server.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Strongly recommend: configure Hetzner Firewall

Here an example Hetzner firewall configuration:

Name Source IP Destination IP Source port Destination port Protocol TCP flags Action
ssh 22 tcp accept
api+ingress 80,443,6443 tcp accept
icmp icmp accept
outgoing connections 32768-65535 tcp ack accept

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.9-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, azure 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
Azure azure_client_id: 'client_id'
azure_secret: 'key'
azure_subscription_id: 'subscription_id'
azure_tenant: 'tenant_id'
azure_resource_group: 'dns_zone_resource_group'
Hetzner hetzner_account_api_token: 93543ade82AA$73.....
hetzner_zone: domain.tld
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
vm_autostart false Create cluster VMs with autostart enabled
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.)
sdn_plugin_name OVNKubernetes This allows you to change SDN plugin. Valid values are OpenShiftSDN and OVNKubernetes. (Default is OVNKubernetes.)
masters_schedulable true Set to false if don't want to allow workload onto the master nodes. (Default is to allow this)

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-${cluster_name} ./watch-stats.sh
Start cluster after reboot ./ansible/04-start-cluster.yml

About

Installing OCP 4 on single bare metal server.

License:Apache License 2.0


Languages

Language:YAML 60.1%Language:Markdown 39.1%Language:Shell 0.3%Language:Dockerfile 0.3%Language:HTML 0.2%