Create an OpenShift cluster on Azure

This section describes how to create an OpenShift cluster on Azure.

1. Installing the Azure CLI on Linux

The Azure CLI is a command-line tool that can be installed locally on Linux computers. The Azure CLI allows you connect to Azure and execute administrative commands on Azure resources. Please use Microsoft documents for details about the CLI. Essentials steps are described below for simplicity.

Examples of Ubuntu distributions: Ubuntu 14.04 LTS (Trusty Tahir), 16.04 LTS (Xenial Xerus), 18.04 LTS (Bionic Beaver), 20.04 LTS (Focal Fossa), 21.04 (Hirsute Hippo)

Warning: Ubuntu 20.04 (Focal Fossa) and 20.10 (Groovy Gorilla) include an azure-cli package with version 2.0.81 provided by the universe repository. This package is outdated and not recommended. If this package is installed, remove the package before continuing by running the command shown below.
sudo apt remove azure-cli -y && sudo apt autoremove -y

Install the CLI with a single command:

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

2. Creating an Azure Red Hat OpenShift 4 cluster

Full details about creating an OpenShift 4 cluster can be found at the following Microsoft documentation

Example steps from Microsoft documents (Example uses Ubuntu 20.04):

Check your azure account info

az account show

Pre-requisites

  1. Azure CLI version 2.6.0 or later is installed
  2. Azure Red Hat OpenShift requires a minimum of 40 cores to create and run an OpenShift cluster.
  • For example, to check the current subscription quota of the smallest supported virtual machine family SKU "Standard DSv3":
LOCATION=eastus
az vm list-usage -l $LOCATION \
--query "[?contains(name.value, 'standardDSv3Family')]" -o table

3. Verifying permissions

During this tutorial, you will create a resource group, which will contain the virtual network for the cluster. You must have either Contributor and User Access Administrator permissions or Owner permissions directly on the virtual network, or on the resource group or subscription containing it.

You will also need sufficient Azure Active Directory permissions (either a member user of the tenant, or a guest user assigned with the role Application administrator) for the tooling to create an application and service principal on your behalf for the cluster. See Member and guest users and Assign administrator and non-administrator roles to users with Azure Active Directory for more details.

Register the resource providers

  1. If you have multiple Azure subscriptions, specify the relevant subscription ID:
az account set --subscription <SUBSCRIPTION ID>
  1. Register the Microsoft resource providers:
az provider register -n Microsoft.RedHatOpenShift --wait
az provider register -n Microsoft.Compute --wait
az provider register -n Microsoft.Storage --wait
az provider register -n Microsoft.Authorization --wait

Get a Red Hat pull secret (optional)

A Red Hat pull secret enables your cluster to access the Red Hat container registries along with additional content. While these steps are optional, it is a recommended step.

See Microsoft documentation - Create cluster

Prepare a custom domain for your cluster (optional)

See Microsoft documentation - Custom domain

Create a virtual network containing two empty subnets

  1. Set the following variables in the shell environment in which you will execute the az commands.
export LOCATION=eastus # the location of your cluster
export RESOURCEGROUP=aro-rg # the name of the resource group where you want to create your cluster
export CLUSTER=cluster # the name of your cluster
  1. Create a resource group.
az group create \
--name $RESOURCEGROUP \
--location $LOCATION

Example of success result

{
"id": "/subscriptions/<guid>/resourceGroups/aro-rg",
"location": "eastus",
"name": "aro-rg",
"properties": {
"provisioningState": "Succeeded"
},
"type": "Microsoft.Resources/resourceGroups"
}
  1. Create a virtual network.
az network vnet create \
--resource-group $RESOURCEGROUP \
--name aro-vnet \
--address-prefixes 10.0.0.0/22
az network vnet subnet create \
--resource-group $RESOURCEGROUP \
--vnet-name aro-vnet \
--name master-subnet \
--address-prefixes 10.0.0.0/23 \
--service-endpoints Microsoft.ContainerRegistry
az network vnet subnet create \
--resource-group $RESOURCEGROUP \
--vnet-name aro-vnet \
--name worker-subnet \
--address-prefixes 10.0.2.0/23 \
--service-endpoints Microsoft.ContainerRegistry
az network vnet subnet update \
--name master-subnet \
--resource-group $RESOURCEGROUP \
--vnet-name aro-vnet \
--disable-private-link-service-network-policies true

Create the cluster

az aro create \
--resource-group $RESOURCEGROUP \
--name $CLUSTER \
--vnet aro-vnet \
--master-subnet master-subnet \
--worker-subnet worker-subnet \

To pull secret and custom domain name, you will need to pass additional information to the following command: az aro create : --pull-secret and --domain. This is described in more detail in the Microsoft documents - Tutorial to create cluster