|
| 1 | +--- |
| 2 | +title: Create an Azure Red Hat OpenShift 4.3 Cluster | Microsoft Docs |
| 3 | +description: Create a cluster with Azure Red Hat OpenShift 3.11 |
| 4 | +author: lamek |
| 5 | +ms.author: suvetriv |
| 6 | +ms.service: container-service |
| 7 | +ms.topic: conceptual |
| 8 | +ms.date: 03/06/2020 |
| 9 | +keywords: aro, openshift, az aro, red hat, cli |
| 10 | +#Customer intent: As a customer, I want to create an ARO custer using the command line. |
| 11 | +--- |
| 12 | + |
| 13 | +# Create, access, and manage an Azure Red Hat OpenShift 4.3 Cluster |
| 14 | + |
| 15 | +> [!IMPORTANT] |
| 16 | +> Azure Red Hat OpenShift (ARO) 4.3 is offered in preview. Preview features are self-service and are provided as is and as available and are excluded from the service-level agreement (SLA) and limited warranty. Therefore, the features aren't meant for production use. |
| 17 | +
|
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +You'll need the following to create an Azure Red Hat OpenShift 4.3 cluster: |
| 21 | + |
| 22 | +- Azure CLI version 2.0.72 or greater |
| 23 | + |
| 24 | +- The 'az aro' extension |
| 25 | + |
| 26 | +- A virtual network containing two empty subnets, each with no network security group attached. Your cluster will be deployed into these subnets. |
| 27 | + |
| 28 | +- A cluster AAD application (client ID and secret) and service principal, or sufficient AAD permissions for `az aro create` to create an AAD application and service principal for you automatically. |
| 29 | + |
| 30 | +- The RP service principal and cluster service principal must each have the Contributor role on the cluster virtual network. If you have the "User Access Administrator" role on the virtual network, `az aro create` will set up the role assignments for you automatically. |
| 31 | + |
| 32 | +### Install the 'az aro' extension |
| 33 | +The `az aro` extension allows you to create, access, and delete Azure Red Hat OpenShift clusters directly from the command line using the Azure CLI. |
| 34 | + |
| 35 | +> [!Note] |
| 36 | +> The `az aro` extension is currenty in preview. It may be changed or removed in a future release. |
| 37 | +> To opt-in for the `az aro` extension preview you need to register the `Microsoft.RedHatOpenShift` resource provider. |
| 38 | +> |
| 39 | +> ```console |
| 40 | +> az provider register -n Microsoft.RedHatOpenShift --wait |
| 41 | +> ``` |
| 42 | +
|
| 43 | +1. Log in to Azure. |
| 44 | +
|
| 45 | + ```console |
| 46 | + az login |
| 47 | + ``` |
| 48 | +
|
| 49 | +2. Run the following command to install the `az aro` extension: |
| 50 | + |
| 51 | + ```console |
| 52 | + az extension add --source https://arosvc.blob.core.windows.net/az-preview/aro-0.1.0-py2.py3-none-any.whl |
| 53 | + ``` |
| 54 | + |
| 55 | +3. Verify the ARO extension is registered. |
| 56 | + |
| 57 | + ```console |
| 58 | + az -v |
| 59 | + ... |
| 60 | + Extensions: |
| 61 | + aro 0.1.0 |
| 62 | + ... |
| 63 | + ``` |
| 64 | + |
| 65 | +### Create a virtual network containing two empty subnets |
| 66 | + |
| 67 | +Follow these steps to create a virtual network containing two empty subnets. |
| 68 | + |
| 69 | +1. Set the following variables. |
| 70 | + |
| 71 | + ```console |
| 72 | + LOCATION=eastus #the location of your cluster |
| 73 | + RESOURCEGROUP="v4-$LOCATION" #the name of the resource group where you want to create your cluster |
| 74 | + CLUSTER=cluster #the name of your cluster |
| 75 | + ``` |
| 76 | + |
| 77 | +2. Create a resource group for your cluster. |
| 78 | + |
| 79 | + ```console |
| 80 | + az group create -g "$RESOURCEGROUP" -l $LOCATION |
| 81 | + ``` |
| 82 | + |
| 83 | +3. Create the virtual network. |
| 84 | + |
| 85 | + ```console |
| 86 | + az network vnet create \ |
| 87 | + -g "$RESOURCEGROUP" \ |
| 88 | + -n vnet \ |
| 89 | + --address-prefixes 10.0.0.0/9 \ |
| 90 | + >/dev/null |
| 91 | + ``` |
| 92 | + |
| 93 | +4. Add two empty subnets to your virtual network. |
| 94 | + |
| 95 | + ```console |
| 96 | + for subnet in "$CLUSTER-master" "$CLUSTER-worker"; do |
| 97 | + az network vnet subnet create \ |
| 98 | + -g "$RESOURCEGROUP" \ |
| 99 | + --vnet-name vnet \ |
| 100 | + -n "$subnet" \ |
| 101 | + --address-prefixes 10.$((RANDOM & 127)).$((RANDOM & 255)).0/24 \ |
| 102 | + --service-endpoints Microsoft.ContainerRegistry \ |
| 103 | + >/dev/null |
| 104 | + done |
| 105 | + ``` |
| 106 | + |
| 107 | +5. Disable network policies for Private Link Service on your virtual network and subnets. This is a requirement for the ARO service to access and manage the cluster. |
| 108 | + |
| 109 | + ```console |
| 110 | + az network vnet subnet update \ |
| 111 | + -g "$RESOURCEGROUP" \ |
| 112 | + --vnet-name vnet \ |
| 113 | + -n "$CLUSTER-master" \ |
| 114 | + --disable-private-link-service-network-policies true \ |
| 115 | + >/dev/null |
| 116 | + ``` |
| 117 | + |
| 118 | +## Create a cluster |
| 119 | + |
| 120 | +Run the following command to create a cluster. |
| 121 | + |
| 122 | +```console |
| 123 | +az aro create \ |
| 124 | + -g "$RESOURCEGROUP" \ |
| 125 | + -n "$CLUSTER" \ |
| 126 | + --vnet vnet \ |
| 127 | + --master-subnet "$CLUSTER-master" \ |
| 128 | + --worker-subnet "$CLUSTER-worker" |
| 129 | +``` |
| 130 | + |
| 131 | +>[!NOTE] |
| 132 | +> It normally takes about 35 minutes to create a cluster. |
| 133 | +
|
| 134 | +## Access the cluster console |
| 135 | + |
| 136 | +You can find the cluster console URL (of the form `https://console-openshift-console.apps.<random>.<location>.aroapp.io/`) under the Azure Red Hat OpenShift 4.3 cluster resource. Run the following command to view the resource: |
| 137 | + |
| 138 | +```console |
| 139 | +az aro list -o table |
| 140 | +``` |
| 141 | + |
| 142 | +You can log into the cluster using the `kubeadmin` user. Run the following command to find the password for the `kubeadmin` user: |
| 143 | + |
| 144 | +```dotnetcli |
| 145 | +az aro list-credentials -g "$RESOURCEGROUP" -n "$CLUSTER" |
| 146 | +``` |
| 147 | + |
| 148 | +## Delete a cluster |
| 149 | + |
| 150 | +Run the following command to delete a cluster. |
| 151 | + |
| 152 | +```console |
| 153 | +az aro delete -g "$RESOURCEGROUP" -n "$CLUSTER" |
| 154 | + |
| 155 | +# (optional) |
| 156 | +for subnet in "$CLUSTER-master" "$CLUSTER-worker"; do |
| 157 | + az network vnet subnet delete -g "$RESOURCEGROUP" --vnet-name vnet -n "$subnet" |
| 158 | +done |
| 159 | +``` |
0 commit comments