**I have modified this from jameread/single-node-openshift-azure-tutorial to cover issues I encountered during deployment and also draw out examples of how to install other Openshift Versions. The original guide is based off RHEL 7.6 which at writing is currently out of date, and should be updated to cover RHEL 8.x. Additionally the original guide deploys version 3.11 of OpenShift. This guide will also explain how to change this version if desired.
This simple tutorial/demo script will talk you through the creation of a single virtual machine (node) on Azure that is running OpenShift. It will use the "oc cluster up" mechanism to deploy OpenShift, which is great just for demos, labs, and that sort of thing.
This would not be the recommended way for a production deployment of OpenShift on Azure. If you want to learn more about that, then check out this repository instead; http://aka.ms/openshift
This is community documentation - not official Red Hat documentation or guidance.
-
A working Azure account with at least $50 credit.
-
Access to Red Hat OpenShift Container Platform subscriptions (NFRs, or lab repositories).
|
Note
|
This lab would also work with OKD (community OpenShift), but the instructions and repositories would be a little different. Unfortunately you are on your own if you want to try OKD! |
-
You’ll need a working Azure subscription and portal login to complete this.
-
Create a Azure RHEL virtual machine and connect to it with SSH.
-
Enable the OpenShift repositories.
-
Configure Docker, and start a simple "all in one" OpenShift environment.
-
Profit! … and then run more exciting OpenShift workloads on Azure ;-)
This lab should between 20-30 minutes to complete.
|
Note
|
Instructions may be deliberately brief, encouraging you to look into the answer a little yourself. Don’t be upset if some steps take you a little longer to find or fix, but do ask for help if you get stuck too long! |
Naviate to the Azure Marketplace;
Provision a new RHEL 7.x machine. Use the latest version of RHEL available (7.6 at the time of writing). Use common sense details for the VM hostname, etc.
-
Authentication Type: You should use a SSH key if you have one, otherwise, create a strong password!
-
Resource Group: Create new: openshift_occlusterup
-
Region: Use a region that is near to you!
OpenShift in this environment will run quite happily on 2x CPUs and 8Gb/RAM, but 4x CPUs and 16GB RAM is a lot nicer. If you have the credits available, this lab recomments using a D4s_v3 sized virtual machine on Azure.
Use managed disks if prompted. OpenShift will work just find with a Standard HDD storage, but if you have the credits available, select a Premium SSD. A 16Gb Disk will be enough for this environment.
When complete, go and find the virtual machine;
When the virtual machine has been provisioned, set a DNS name in the virtual machine overview and take a note of the public IP address in your notes.
Port 8443, 22, and 80 should be open. You should add these as inbound ports in the network security group.
All instructions in the rest of the lab guide require root access, and to be in the root home directory.
sudo su cd /root/
RHEL machines provisioned from the marketplace come connected to Red Hat Update Infrastructure. However, Red Hat Update Infrastructure is for RHEL only, not OpenShift.
rpm -e rhui-azure-rhel7
subscription-manager register Username: … Password: …
Find a pool ID with OpenShift, and make a note of the pool ID.
subscription-manager list --available
Attach to this pool;
subscription-manager attach --pool=...
Disable all default repos, and then attach to the required repos.
subscription-manager repos --disable '*'
subscription-manager repos --enable 'rhel-7-server-rpms' subscription-manager repos --enable 'rhel-7-server-extras-rpms' subscription-manager repos --enable 'rhel-7-server-ose-3.11-rpms'
The rhel-7-server-ose-3.11-rpms covers the RPMs to install OpenShift 3.11, substitute this with the below if you want to deploy a different version.
If the above repos do not show up, enter the below commands: subscription-manager register subscription-manager refresh subscription-manager attach --auto
Add the insecure registry options in the docker configuration file /etc/docker/daemon.json;
{ "insecure-registries": ["172.30.0.0/16"] }
|
Note
|
Do not change the IP address of the insecure-registries, leave it as default - 172.30.0.0. This is the IP Network address of the docker0 interface on your virtual machine.
|
Make docker start on boot, and then start it manually;
systemctl enable docker systemctl start docker
docker login https://registry.redhat.io Username: ... Password: ...
Make sure you are in the root home directory before continuing;
cd /root/
We’re going to run OpenShift, running inside a container. It will take about 10 minutes to come up and should be fully automatic.
oc cluster up --enable '*,automation-service-broker,service-catalog,template-service-broker' --public-hostname=<yourPublicIpAddress/publicFqdn> --routing-suffix=<FqdnExcludingFirstComponent>
Note: You must use a valid DNS name (or IP address with nip.io) or the cluster may hang trying to contact itself when starting.
Have a little look around ;-) You can login as developer with any password.
These tasks are optional. You can skip over this section if you like.
On the virtual machine, enter this command;
oc cluster add centos-imagestreams
Installing the Open Service Broker for Azure is a 2-step process. The first step is getting a service principal, the second issue is then installing the service broker.
A service broker is like a "username and password" to have admin access for Azure.
Install the service broker using instructions from here;
-
Deploy
php-ascii-pets; https://github.com/jamesread/php-ascii-pets.git -
If you know quite a lot about OpenShift already, but not Azure, start from challenge #7; https://github.com/palma21/openshiftlab#challenge—7-monitoring-openshift-with-azure-oms
-
If you know quite a lot about Azure already, but not OpenShift, start from challenge #2; https://github.com/palma21/openshiftlab#challenge—2-create-and-manage-projects
-
.NET and Azure focussed OpenShift demo; https://github.com/city-holidays-on-openshift-azure
-
If you fancy a challenge; https://github.com/jbossdemocentral/coolstore-microservice
If you made a mistake when running oc cluster up, you need to follow the below to correct it: 1. oc cluster down 2. Go to /root and remove openshift.local.clusterup - this is important and previous config will be mixed in with your re-deployment. 3. Re run oc cluster up with needed parameters.






