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