Skip to content

Instantly share code, notes, and snippets.

@leifmadsen
Last active January 17, 2023 22:01
Show Gist options
  • Select an option

  • Save leifmadsen/c991165fa3274d337415c1a875fd7aed to your computer and use it in GitHub Desktop.

Select an option

Save leifmadsen/c991165fa3274d337415c1a875fd7aed to your computer and use it in GitHub Desktop.
OpenShift 3.9 + GlusterFS + Service Brokers

OpenShift Origin 3.9 Deployment

Deployment of OpenShift Origin 3.9 with GlusterFS and Service Brokers including Ansible Service Broker. Deployed on virtual machines provided by base-infra-bootstrap. Deployment of OpenShift Origin is done via openshift-ansible.

base-infra-bootstrap

Deploy the virtual machines.

Inventory Configuration

mkdir -p ~/src/openshift_deployment/inventory
cd ~/src/openshift_deployment
git clone https://github.com/redhat-nfvpe/base-infra-bootstrap
cd base-infra-bootstrap
cat > inventory/atomic-vars.yaml <<EOF
---
centos_genericcloud_url: http://cloud.centos.org/centos/7/atomic/images/CentOS-Atomic-Host-7-GenericCloud.qcow2
image_destination_name: CentOS-7-x86_64-GenericCloud.qcow2
host_type: "atomic"
images_directory: /home/images/openshiftlab
spare_disk_location: /home/images/openshiftlab
ssh_proxy_user: root
ssh_proxy_host: virthost
vm_ssh_key_path: /home/lmadsen/.ssh/id_openshiftlab
bridge_networking: true
bridge_name: br1
bridge_physical_nic: "enp3s0"
bridge_network_name: "br1"
bridge_network_cidr: 192.168.3.0/24
domain_name: home.61will.space
virtual_machines:
  - name: openshift-master
    node_type: master
    system_ram_mb: 8192
  - name: openshift-node-1
    node_type: nodes
    system_ram_mb: 16384
  - name: openshift-node-2
    node_type: nodes
    system_ram_mb: 16384
  - name: openshift-node-3
    node_type: nodes
    system_ram_mb: 16384
EOF

cat > inventory/atomic.inventory <<EOF
# vim: set ft=yaml shiftwidth=2 tabstop=2 expandtab :
openshift-master ansible_host=openshift-master.home.61will.space
openshift-node-1 ansible_host=openshift-node-1.home.61will.space
openshift-node-2 ansible_host=openshift-node-2.home.61will.space
openshift-node-3 ansible_host=openshift-node-3.home.61will.space
#openshift-node-4 ansible_host=openshift-node-4.home.61will.space
#openshift-node-5 ansible_host=openshift-node-5.home.61will.space
#openshift-node-6 ansible_host=openshift-node-6.home.61will.space

[OSEv3:children]
masters
nodes
etcd
glusterfs

[OSEv3:vars]
ansible_become=yes
debug_level=2

# storage
openshift_storage_glusterfs_namespace=glusterfs
openshift_storage_glusterfs_name=storage
openshift_storage_glusterfs_storageclass_default=true

# service broker
openshift_enable_service_catalog=true
openshift_service_catalog_image_version=v3.9

# etcd
#openshift_hosted_etcd_storage_kind=dynamic
#openshift_hosted_etcd_storage_volume_name=etcd-vol
#openshift_hosted_etcd_storage_access_modes=["ReadWriteOnce"]
#openshift_hosted_etcd_storage_volume_size=128M
#openshift_hosted_etcd_storage_labels={'storage': 'etcd'}

# main setup
#openshift_master_unsupported_embedded_etcd=true
openshift_disable_check=disk_availability,memory_availability,docker_image_availability
openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]
openshift_deployment_type=origin
containerized=true
openshift_release=v3.9
#openshift_version=3.9
#openshift_image_tag=v3.9
enable_excluders=false
openshift_clock_enabled=true

# hostname setup
openshift_hostname_check=true
openshift_master_default_subdomain=apps.home.61will.space

# registry storage
#openshift_hosted_registry_storage_kind=glusterfs

# ansible service broker
ansible_service_broker_registry_user=<DOCKERHUB_USERNAME>
ansible_service_broker_registry_password=<DOCKERHUB_PASSWORD>
ansible_service_broker_registry_organization=ansibleplaybookbundle
ansible_service_broker_registry_whitelist=[".*-apb$"]
ansible_service_broker_local_registry_whitelist=[".*"]


[masters]
openshift-master

[etcd]
openshift-master

[nodes]
openshift-master openshift_node_labels="{'region': 'infra', 'zone': 'default'}" openshift_schedulable=true
openshift-node-[1:3] openshift_node_labels="{'region': 'primary', 'zone': 'default'}" openshift_schedulable=true

[glusterfs]
openshift-node-[1:3]

[glusterfs:vars]
glusterfs_devices=[ "/dev/vdb" ]
r_openshift_storage_glusterfs_use_firewalld=false
r_openshift_storage_glusterfs_firewall_enabled=true
openshift_storage_glusterfs_timeout=900
openshift_storage_glusterfs_wipe=true

#[glusterfs_registry]
#openshift-node-[4:6] glusterfs_devices='[ "/dev/vdb" ]'

[all:vars]
ansible_user=centos
ansible_ssh_private_key_file=/home/lmadsen/.ssh/id_openshiftlab
EOF

cat > inventory/virthost.inventory <<EOF
virt_host ansible_host=virthost ansible_ssh_user=root

[virthosts]
virt_host

[all:vars]
ansible_ssh_common_args='-o StrictHostKeyChecking=no'
EOF

Deploy Virtual Machines

# get you some virtual machines!
ansible-playbook -i inventory/virthost.inventory -e "@./inventory/atomic-vars.yml" virt-host-setup.yml

# reboot the virtual machines so DNS sets up properly on the network
ansible -i ~/src/github/leifmadsen/inventory/vms.local.generated all -a "sudo /sbin/reboot"

Setup wildcard DNS domain

In your local router/DNS system, setup a wildcard domain for apps.home.61will.space or whatever your apps.<local_domain> is. Note that this is configured in the above atomic.inventory file and you should adjust the domains to match your setup.

Deploy OpenShift

cd ~/src/openshift_deployment
git clone https://github.com/openshift/openshift-ansible
cd openshift-ansible
git fetch --all
git checkout origin/release-3.9
ansible-playbook -i ~/src/openshift_deployment/base-infra-bootstrap/inventory/atomic.inventory  \
    playbooks/prerequisites.yml playbooks/deploy_cluster.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment