Install Portworx on Azure Kubernetes Service (AKS)
This guide provides instructions for installing Portworx on Azure Kubernetes Service (AKS) using either PX-StoreV1 or PX-StoreV2.
PX-StoreV1 is the traditional storage backend for Portworx Enterprise. PX-StoreV2 focuses on volume management with optimized metadata handling and performance metrics, making it suitable for high-performance environments. For more information about these backends, refer to the PX-StoreV2 concept topic.
- For PX-StoreV2, the
add-drivemethod is not supported for horizontally expanding the storage pool by adding drives.- only
resize-diskorautois supported.
- only
- If you have a compute load that can elastically increase or decrease based on workload demand, you might want to learn how to install Portworx in disaggregated mode.
Prerequisites
- An AKS cluster that meets the Portworx prerequisites
- The Azure CLI must be installed
- Supported disk types
- Portworx recommends that you set max number of storage nodes. When specified Portworx will ensure the desired number of storage nodes exist in the zone.
- For production environments Portworx, Inc. recommends 3 Availability Zones (AZs) with one node per zone.
- For existing clusters, name of "AKS cluster Infrastructure Resource Group" or initial Resource Group name used to create the cluster and cluster name.
- If you're using Azure Cloud Drive encryption using your own key, you must have an Azure KeyVault instance created in the same region as the AKS cluster.
Prepare your AKS platform
To set up the Azure Kubernetes Service (AKS) to use Portworx, follow the steps below.
-
Log in to Azure and save your
az loginsubscription ID ("id") for future reference:az login[
{
"cloudName": "AzureCloud",
"homeTenantId": "xxxxxxxx-xxxx-xxxx-xxxx-1234567890ab",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-1234567890ab",
"isDefault": true,
"managedByTenants": [],
"name": "Example name",
"state": "Enabled",
"tenantId": "xxxxxxxx-xxxx-xxxx-xxxx-1234567890ab",
"user": {
"name": "user@example.com",
"type": "user"
}
}
] -
Set the subscription:
az account set --subscription <Your-Azure-Subscription-UUID> -
Get the Azure locations using the Azure CLI command:
az account list-locations -
Create an Azure Resource Group by specifying its name and the location in which you will be deploying your AKS cluster:
az group create --name <resource-group-name> --location <location> -
Create the AKS cluster in the above Resource Group using either the Azure CLI or the Azure Portal. If you have already deployed an AKS cluster, then create the Service Principal for the Resource Group in which your AKS cluster is present.
- If you want to use Azure ultra disks, add the
--enable-ultra-ssdparameter to theaz aks createcommand while creating the AKS cluster. For more information, see the Azure documentation.
- If you want to use Azure ultra disks, add the
-
Create a custom role for Portworx. Enter the subscription ID using the subscription ID value you saved in step 1, also specify a role name:
az role definition create --role-definition '{
"Name": "<your-role-name>",
"Description": "",
"AssignableScopes": [
"/subscriptions/<your-subscription-id>"
],
"Actions": [
"Microsoft.ContainerService/managedClusters/agentPools/read",
"Microsoft.Compute/disks/delete",
"Microsoft.Compute/disks/write",
"Microsoft.Compute/disks/read",
"Microsoft.Compute/virtualMachines/write",
"Microsoft.Compute/virtualMachines/read",
"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/write",
"Microsoft.Compute/virtualMachineScaleSets/virtualMachines/read"
],
"NotActions": [],
"DataActions": [],
"NotDataActions": []
}'
Create a Service Principal and secret in Azure AD
-
Find the AKS cluster Infrastructure Resource Group, the following command shows the Infrastructure Resource Group for a given cluster name and AKS resource group:
az aks show -n <aks-cluster-name> -g <aks-resource-group> | jq -r '.nodeResourceGroup' -
Create a service principal for Portworx custom role and replace the following with your cluster's values:
- Your AKS cluster name
- Your subscription ID
- The name of the custom role that you created in the previous section
az ad sp create-for-rbac --role=<your-role-name> --scopes="/subscriptions/<your-subscription-id>/resourceGroups/<aks-infrastructure-resource-group>"{
"appId": "xxxxxxxx-xxxx-xxxx-xxxx-1234567890ab",
"displayName": "azure-cli-2020-10-10-10-10-10",
"name": "http://azure-cli-2020-10-10-10-10-10",
"password": "xxxxxxxx-xxxx-xxxx-xxxx-1234567890ab",
"tenant": "xxxxxxxx-xxxx-xxxx-xxxx-1234567890ab"
} -
Create a secret called
px-azureto give Portworx access to Azure APIs. Take the following fields from the previous output and use them in the following command:- Set
AZURE_TENANT_IDto the value fortenant - Set
AZURE_CLIENT_IDto the value forappId - Set
AZURE_CLIENT_SECRETto the value forpassword
kubectl create secret generic -n kube-system px-azure --from-literal=AZURE_TENANT_ID=<tenant> \
--from-literal=AZURE_CLIENT_ID=<appId> \
--from-literal=AZURE_CLIENT_SECRET=<password>secret/px-azure created - Set
Now that you've created the secret, you're ready to create the spec and deploy Portworx. The spec generator automatically incorporates the secret that you created, and Portworx will fetch the secret to authenticate. Proceed to the next section to install Portworx.
Install Portworx on AKS using the Operator
Generate the specs
- PX-StoreV1
- PX-StoreV2
-
Sign in to the Portworx Central console.
The system displays the Welcome to Portworx Central! page. -
In the Portworx Enterprise section, select Generate Cluster Spec.
The system displays the Generate Spec page. -
From the Portworx Version dropdown menu, select the Portworx version to install.
-
For Platform, select your K8s Azure as your cloud environment.
-
For Distribution Name, select Azure Kubernetes Service (AKS).
-
Click Save Spec to generate the specs. You may customize the storage and network for your Portworx cluster if needed, by clicking on Customize.
-
Sign in to the Portworx Central console.
The system displays the Welcome to Portworx Central! page. -
In the Portworx Enterprise section, select Generate Cluster Spec.
The system displays the Generate Spec page. -
From the Portworx Version dropdown menu, select the Portworx version to install.
-
For Platform, select your K8s Azure as your cloud environment.
-
For Distribution Name, select Azure Kubernetes Service (AKS) then click Customize at the bottom of the Summary section.
-
On the Basic page, ensure that the Use the Portworx Operator and Built-in ETCD options are selected. For Portworx version, select the same value from the dropdown that you have set as your Portworx version in the Configure your environment section and click Next.
-
In the Storage window, select PX-StoreV2 checkbox, and select volume type and size, rest keep the recommended default values and click Next.
-
Choose your network options and click Next.
-
Click Finish to generate the specs. You may customize the environment variable, registry, security, and advanced setting for your Portworx cluster if needed in Deployment window.
-
Save generated spec for future reference.
For deploying Portworx on an Azure Sovereign cloud, click Customize at the bottom of the Summary section. Navigate to the Customize page and specify the value of the AZURE_ENVIRONMENT variable under Environment Variables.
Deploy the Operator
To deploy the Operator, run the command that Portworx Central provided, which looks similar to the following:
kubectl apply -f 'https://install.portworx.com/<version-number>?comp=pxoperator'
serviceaccount/portworx-operator created
podsecuritypolicy.policy/px-operator created
clusterrole.rbac.authorization.k8s.io/portworx-operator created
clusterrolebinding.rbac.authorization.k8s.io/portworx-operator created
deployment.apps/portworx-operator created
Verify the Operator is running.
kubectl get pods -A | grep "portworx"
kube-system portworx-operator-584ccd74c7-7bhkt 1/1 Running 0 3m48s
Deploy the StorageCluster
To deploy the StorageCluster, use one of the following methods.
-
If you are not enabling cloud drive encryption using your own key, run the command that Portworx Central provided, which looks similar to the following:
kubectl apply -f 'https://install.portworx.com/<version-number>?operator=true&mc=false&kbver=&b=true&kd=type%3DPremium_LRS%2Csize%3D150&s=%22type%3DPremium_LRS%2Csize%3D150%22&c=px-cluster-xxxxxxxx-xxxx-xxxx-xxxx-3aefe978ab64&aks=true&stork=true&csi=true&mon=true&tel=false&st=k8s&promop=true'storagecluster.core.libopenstorage.org/px-cluster-xxxxxxxx-xxxx-xxxx-xxxx-8dfd338e915b created -
If you want to enable Azure cloud drive encryption using your own key, perform the following steps:
-
Download the spec that you generated in Portworx Central.
-
Create a Disk Encryption Set ID by using the instructions on Enable Customer Managed Keys page in the Microsoft documentation.
-
Append the
diskEncryptionSetIDvalue from the previous step to theStorageClusterspec you downloaded as follows:cloudStorage:
deviceSpecs:
- type=Premium_LRS,size=50,diskEncryptionSetID=<disk-encryption-set-id>Where
<disk-encryption-set-id>is in the following format:/subscriptions/<subscription>/resourceGroups/<resource-group>/providers/Microsoft.Compute/diskEncryptionSets/<disk-encryption-set-name> -
Apply the modified spec:
kubectl apply -f <spec-file.yaml>storagecluster.core.libopenstorage.org/px-cluster-xxxxxxxx-xxxx-xxxx-xxxx-8dfd338e915b created
-