https://github.com/jamesread/single-node-openshift-azure-tutorial
How to setup a simple, single-node OpenShift demo on Azure, ready for other workloads.
https://github.com/jamesread/single-node-openshift-azure-tutorial
azure demo openshift
Last synced: 6 months ago
JSON representation
How to setup a simple, single-node OpenShift demo on Azure, ready for other workloads.
- Host: GitHub
- URL: https://github.com/jamesread/single-node-openshift-azure-tutorial
- Owner: jamesread
- Created: 2018-12-07T12:24:25.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-26T10:34:52.000Z (over 7 years ago)
- Last Synced: 2025-04-05T00:45:36.981Z (about 1 year ago)
- Topics: azure, demo, openshift
- Language: Makefile
- Homepage:
- Size: 565 KB
- Stars: 7
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
Awesome Lists containing this project
README
:data-uri:
:sectnums:
:toc:
= single-node-openshift-azure-tutorial
== What is this?
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.**
=== What do I need before I get started?
1. A working Azure account with at least $50 credit.
2. 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!
=== What will I do in this tutorial?
1. You'll need a working Azure subscription and portal login to complete this.
2. Create a Azure RHEL virtual machine and connect to it with SSH.
3. Enable the OpenShift repositories.
4. Configure Docker, and start a simple "all in one" OpenShift environment.
5. 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!
== Provision a RHEL virtual machine from the marketplace
Naviate to the Azure Marketplace;
image::images/marketplaceRhel.png[]
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!
image::images/provisioningDialog.png[]
=== Sizing
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.
=== Disks
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.
=== Start the provisioning, and wait for it to complete
image::images/waitForProvisioning.png[]
When complete, go and find the virtual machine;
image::images/provisioningComplete.png[]
=== Set a DNS name
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.
image::images/dnsName.png[]
=== Edit the Network Security Groups, and add a few basic rules;
Port 8443, 22, and 80 should be open. You should add these as inbound ports in the network security group.
image::images/nsg.png[]
=== SSH into your VM
Use your favorite SSH client (if you're on Windows, download PuTTY) to connect to the OpenShift virtual machine. You need to use the username and ssh key/password specified during the provisioning process.
Get ready for some OpenShifting :-)
== Prepare the machine for OpenShift
=== Become root
All instructions in the rest of the lab guide require root access, and to be in the root home directory.
sudo su
cd /root/
=== Disconnect from Red Hat Update Infrastructure;
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
=== Configure OpenShift repositories
In the next section, choose link:#subs-option-a[__Option A__] **or** link:#subs-option-b[__Option B__]. Don't do both :-)
[#subs-option-a]
==== Option a) If you have a working Red Hat subscription;
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'
[#subs-option-b]
==== Option b) If you have a repository provided by your lab administrator;
cd /etc/yum.repos.d/
wget http://YOUR-ADDRESS-HERE.cloudapp.azure.com/repos/lab.repo
=== Install the `oc` client, Docker and Git
yum install atomic-openshift-clients docker git -y
=== Enable port 8443 in the Linux firewall;
Port 8443 is for the OpenShift Web Administration console.
Port 80 is for your web application containers.
firewall-cmd --add-port 80/tcp --permanent
firewall-cmd --add-port 8443/tcp --permanent
firewall-cmd --reload
== Setup Docker
=== Insecure registries
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
////
=== Configure iptables
service iptables start
iptables -F INPUT
////
=== Login to the Red Hat Container Registry
In the next section, choose link:#registry-option-a[__Option A__] **or** link:#registry-option-b[__Option B__]. Don't do both :-)
[#registry-option-a]
==== Option a) If you have a working Red Hat user and login
docker login https://registry.redhat.io
Username: ...
Password: ...
[#registry-option-b]
==== Option b) If you have a registry login file provided by your lab administrator
[FIXME]
Instructions not yet written for this!
== Start and Login to OpenShift
=== Start OpenShift
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= --routing-suffix=.nip.io
**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.
=== Login to the web interface
https://.azure.com:8443/console
Have a little look around ;-) You can login as *developer* with any password.
image::images/openshiftLogin.png[]
== Optional Azure tasks;
These tasks are **optional**. You can skip over this section if you like.
=== Add .NET support from CentOS
On the virtual machine, enter this command;
oc cluster add centos-imagestreams
=== Service Broker for Azure
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.
==== Create a service principal
A service broker is like a "username and password" to have admin access for Azure.
https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal
==== Install the service broker
Install the service broker using instructions from here;
https://github.com/Azure/open-service-broker-azure#openshift-project-template
== What can I try now?
1. Deploy `php-ascii-pets`; https://github.com/jamesread/php-ascii-pets.git
2. 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
3. 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
4. .NET and Azure focussed OpenShift demo; https://github.com/city-holidays-on-openshift-azure
5. If you fancy a challenge; https://github.com/jbossdemocentral/coolstore-microservice