Installing OpenShift on Azure
DevOps Training Architect II
In this lab you will be running the Ansible playbooks to install OpenShift on your cluster from your bastion host. Once installed you will have a funtional OpenShift cluster in Azure.
Install OpenShift and Connect
In this hands-on lab, we will need to install the necessary packages and configure the bastion host to run the OpenShift installation playbooks.
Log in to the Azure Portal using the credentials provided on the lab instructions page.
Configure Cloud Shell
If prompted with a Welcome to Microsoft Azure get started window, click Maybe layer.
On the left-hand side navigation menu, click All Resources.
Let's set up Cloud Shell by clicking the Cloud Shell button in the top-right corner of the screen:
!["Azure Cloud Shell"]( https://raw.githubusercontent.com/linuxacademy/content-az-300-lab-repos/master/images/cloudshell.PNG "Azure Cloud Shell")
Begin configuring the Cloud Shell, click Bash.
Leave the default for the storage mounted window.
Click Show advanced settings.
Leave the existing subscription, resource group, and storage account.
Note: If the storage account does not populate, ensure that South Central US is selected for the Cloud Shell region field .
Under Storage account, click the radio button for Use existing.
Under File share, choose the radio button Create new and specify okdcloudshell as the new file share.
Click Create Storage.
Note: We should see a status of
Download SSH Keys for the Lab
We will need to pull down the SSH keys to be able connect to the VMs using SSH. First, make the
.sshdirectory, if it isn't already there, with:
cdinto the directory with:
Pull down the SSH private key, and then the public key with the following commands and links:
wget https://raw.githubusercontent.com/linuxacademy/content-openshift-origin-azure/master/ssh/id_rsa wget https://raw.githubusercontent.com/linuxacademy/content-openshift-origin-azure/master/ssh/id_rsa.pub
Check the files with:
Set the correct permissions with:
chmod 600 id_rsa*
Run the Lab Prep Scripts
cdto go back to our home directory.
On the left-hand side navigation menu, click Virtual machines.
Click the Connect button.
On the Connect to virtual machine window, click the "Copy to clipboard" icon button for the Login using VM local account section.
Paste it into the Bash environment terminal. It should look similar to this:
yeswhen asked to continue connecting.
Note: We will need to SSH into each VM and run a prep script.
After we SSH into the a VM, we will first need to install
wget. We will need to download the associated script for the node found in the Git repo for the lab. The link is https://github.com/linuxacademy/content-openshift-origin-azure/tree/master/scripts/
Here are the VMs:
- For the
bastionVM-0it would be
- For the
masterVM-0it would be
- For the
infraVM-0it would be
- For the
appnodeVM-0it would be
For example, the format will look like this for
- For the
Once the download completes, we will need to make the script executable like:
sudo chmod +x bastionPrep.sh
Finally, we must run the script:
Note: This will take approximately 10-15 minutes to run.
Make sure that
sudois used or the script will fail:
sudo yum -y install wget
Note: Remember to repeat this process (using steps 1-11 as a reference) for each VM.
Install the Necessary Packages for the OpenShift Installation
Install the packages:
Next, install and enable the
sudo yum -y install centos-release-openshift-origin
sudo yum -y install openshift-ansible docker
We will need to add the following options to
sudo sed -i -e "s#^OPTIONS=`--selinux-enabled`#OPTIONS`--selinux-enabled --insecure-registry 172.30.0.0/16`#" /etc/sysconfig/docker"
Next, we will enable
docker-cleanup, and then Docker:
sudo systemctl enable docker-cleanup sudo systemctl enable docker
Start the Docker service:
sudo systemctl start docker
Create Your Inventory File
Use the inventory file from the Git repo to create and inventory file for the OpenShift installation. We will find the inventory file at this link:
We will need to copy this to
sudo vim /etc/ansible/hosts
Verify that no errors will be encountered:
sudo chmod -R 777 /usr/share/ansible/openshift-ansible/playbooks
Navigate to the directory:
Use Ansible to run the
deploy_cluster.ymlplaybooks to install OpenShift:
ansible-playbook prerequisites.yml ansible-playbook deploy_cluster.yml
deploy_cluster.ymlplaybook may take approximately 30 minutes to complete.
The install may get hung, but a retry file is created for us and can be used like so to run it again:
ansible-playbook deploy_cluster.yml --limit @/usr/share/ansible/openshift-ansible/playbooks/deploy_cluster.retry
exitto logout of the bastion host.
- Click Virtual machines in the left-hand side menu in the Microsoft Azure portal.
- Click masterVM-0.
- Click Connect.
- On the Connect to virtual machine window, click the "Copy to clipboard" icon button for the Login using VM local account section for the SSH command.
Paste the SSH command into the Bash environment terminal, that look like this:
Check the nodes:
oc get nodes
Note: We should see a
Congratulations — you've completed this hands-on lab!