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)
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
- Azure CLI version 2.6.0 or later is installed
- 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=eastusaz 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
- If you have multiple Azure subscriptions, specify the relevant subscription ID:
az account set --subscription <SUBSCRIPTION ID>
- Register the Microsoft resource providers:
az provider register -n Microsoft.RedHatOpenShift --waitaz provider register -n Microsoft.Compute --waitaz provider register -n Microsoft.Storage --waitaz 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
- Set the following variables in the shell environment in which you will execute the az commands.
export LOCATION=eastus # the location of your clusterexport RESOURCEGROUP=aro-rg # the name of the resource group where you want to create your clusterexport CLUSTER=cluster # the name of your cluster
- 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"}
- Create a virtual network.
az network vnet create \--resource-group $RESOURCEGROUP \--name aro-vnet \--address-prefixes 10.0.0.0/22az network vnet subnet create \--resource-group $RESOURCEGROUP \--vnet-name aro-vnet \--name master-subnet \--address-prefixes 10.0.0.0/23 \--service-endpoints Microsoft.ContainerRegistryaz network vnet subnet create \--resource-group $RESOURCEGROUP \--vnet-name aro-vnet \--name worker-subnet \--address-prefixes 10.0.2.0/23 \--service-endpoints Microsoft.ContainerRegistryaz 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