Monitoring OpenShift on Azure Using the Log Analytics Agent

3.5 hours
  • 5 Learning Objectives

About this Hands-on Lab

In this lab you will be deploying the Log Analytics agent for Azure in OpenShift to allow you to be able to monitor OpenShift from the Azure portal.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Configure Cloud Shell

Set up Cloud Shell by clicking the Cloud Shell button in the top-right corner of the screen:

"Azure Cloud Shell"

Configure Cloud Shell for Bash using the Advanced Settings. Use the existing subscription, resource group, and storage account. If your storage account does not populate, make sure that the South Central US region is selected. To make the file share, choose Create new and specify okdcloudshell as the new file share.

Download SSH Keys for the Lab

You will need to pull down the SSH keys so you can connect to the VMs using SSH. First make the .ssh directoy, if it isn’t already there, with the mkdir command.

Then, cd into the .ssh directory.

Now, use wget to pull down the SSH keys using these links:
https://raw.githubusercontent.com/linuxacademy/content-openshift-origin-azure/master/ssh/id_rsa
https://raw.githubusercontent.com/linuxacademy/content-openshift-origin-azure/master/ssh/id_rsa.pub

Change the permissions of the files to 600.

Run the Lab Prep Subscriptions

You will need to connect to each VM using SSH and run a prep script.

After you connect to a VM using SSH, you will first need to install wget.

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 VM links are:

  • For the bastionVM-0 it would be: wget https://raw.githubusercontent.com/linuxacademy/content-openshift-origin-azure/master/scripts/bastionPrep.sh
  • For the masterVM-0 it would be: wget https://raw.githubusercontent.com/linuxacademy/content-openshift-origin-azure/master/scripts/masterPrep.sh
  • For the infraVM-0 it would be: wget https://raw.githubusercontent.com/linuxacademy/content-openshift-origin-azure/master/scripts/infraPrep.sh
  • For the appnodeVM-0 it would be: wget https://raw.githubusercontent.com/linuxacademy/content-openshift-origin-azure/master/scripts/nodePrep.sh

Once the download completes, you will need to make the script executable.

Finally, you would run the script. Make sure you use sudo or the script will fail.

Install OpenShift

Use Ansible to run the prerequisites.yml and the deploy_cluster.yml playbooks to install OpenShift. Run these from the Bastion Host.

Deploy the OMS Agent in OpenShift

Log in to the master node and use the OpenShift CLI tools to:

  1. Download the ocp-omsagent.yaml file from the Git repo:

    https://raw.githubusercontent.com/linuxacademy/content-openshift-origin-azure/master/scripts/ocp-omsagent.yaml

  2. Create the omslogging project.

  3. Create a service account named omsagent.

  4. Add the cluster role cluster-reader to the service account.

  5. Set the Security Context Constraint to privileged for the service account.

  6. Deploy the agent using the oc create command.

Additional Resources

Another developer by the name of Little Rock popped in and said she read you can use Container Monitoring in Azure and it works with OpenShift. She said that the super-secret app that they are working on can be a resource hog, and they need every advantage they can get to help troubleshoot it. You tell her it is mostly set up, you just need to deploy the OMS agent in OpenShift, and it should start working. She said that it is awesome and she owes you a coffee. You asked, "Will you tell me what this super-secret project is that we are all killing ourselves over?" She just laughed and replied, "All in due time newbie, all in due time." Create a new project called omslogging, a service account called omsagent, and make sure the service account has the permissions it needs. You will also need to download the ocp-omsagent.yaml from the Git repo for the lab, and deploy the agent using that YAML file.

Note: Be sure to use the bastionhostPrep.sh, masterPrep.sh, infraPrep.sh, and nodePrep.sh for this lab. The lab prep takes about 10 to 15 minutes per node to run. The OpenShift installation will take 30 minutes or more. We have added time to accommodate this inconvenience.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?