Deploy Anyscale on Azure Kubernetes Service (AKS)
1. Install Anyscale's python client package
pip install -U anyscale
anyscale login # authenticate
2. Configure your Cloud Provider account
az login
3. Terraform your Azure Account to create an AKS cluster
Enter information about where you want to deploy your AKS cluster.
Run the following commands to create an Anyscale Cloud with a basic AKS cluster.
git clone https://github.com/anyscale/terraform-kubernetes-anyscale-foundation-modules
cd terraform-kubernetes-anyscale-foundation-modules/examples/azure/aks-new_cluster/
Create and populate the Terraform variable file.
cat <<EOF > terraform.tfvars
aks_cluster_name = "<your_aks_cluster_name>"
azure_subscription_id = "<your_subscription_id>"
azure_location = "<your_azure_region>"
EOF
Apply the Terraform and wait for resources to be created. This may take a couple minutes.
terraform init
terraform plan
terraform apply
The Terraform output provides an example Cloud registration command. Take note of the following outputs:
- Operator IAM client ID
- Storage account name
- Container name
Provide information from the Terraform output:
4. Install additional AKS components
Ensure that you are authenticated to the AKS cluster
az aks get-credentials --resource-group <azure_resource_group_name> --name <your_aks_cluster_name> --overwrite-existing
Install the Kubernetes Autoscaler helm chart.
helm repo add autoscaler https://kubernetes.github.io/autoscaler
helm upgrade cluster-autoscaler autoscaler/cluster-autoscaler \
--version 9.46.0 \
--namespace kube-system \
--set 'autoDiscovery.clusterName'=<your_aks_cluster_name> \
--install
Install the nginx ingress controller.
helm repo add nginx https://kubernetes.github.io/ingress-nginx
helm upgrade ingress-nginx nginx/ingress-nginx \
--version 4.12.1 \
--namespace ingress-nginx \
--values sample-values_nginx.yaml \
--create-namespace \
--install
(Optional) Install the Nvidia device plugin.
helm repo add nvdp https://nvidia.github.io/k8s-device-plugin
helm upgrade nvdp nvdp/nvidia-device-plugin \
--namespace nvidia-device-plugin \
--version 0.17.1 \
--values values_nvdp.yaml \
--create-namespace \
--install
5. Install the Anyscale Operator Helm chart
helm repo add anyscale https://anyscale.github.io/helm-charts
helm repo update anyscale
If you wish to customize the Helm chart to add custom Patches or additional pod shapes, follow these instructions in the documentation.
6. Register the Anyscale Cloud resources
Run the command produced by the Terraform script. The command should look similar to the commands below. Verify all variables are entered correctly.
anyscale cloud register \
--name <your_cloud_name> \
--region <your_azure_region> \
--provider azure \
--compute-stack k8s \
--cloud-storage-bucket-name 'abfss://<blob_storage_name>@<storage_account>.dfs.core.windows.net' \
--cloud-storage-bucket-endpoint 'https://<storage_account>.blob.core.windows.net'
Take note of the Cloud Deployment ID in the output.
7. Deploy the Anyscale Operator on your AKS cluster
Run the following commands to deploy the Anyscale Operator with your Cloud Deployment ID. Verify all variables are entered correctly. The release name and namespace are up to you to define.
helm upgrade anyscale-operator anyscale/anyscale-operator \
--set-string global.auth.anyscaleCliToken=<anyscale_cli_token> \
--set-string global.cloudDeploymentId=<your_cloud_deployment_id> \
--set-string global.cloudProvider=azure \
--set-string global.auth.iamIdentity=<anyscale_operator_client_id> \
--set-string workloads.serviceAccount.name=anyscale-operator \
--namespace anyscale-operator \
--create-namespace \
-i
It may take several minutes for your Anyscale Cloud to be ready to use. You can watch the deployment status using the following command.
kubectl get deployments anyscale-operator -n anyscale-operator -w
8. Verify your Anyscale Cloud
It may take several minutes for your Anyscale Cloud to be ready to use. Run the following command to verify that your newly created Anyscale Cloud is fully functional and ready to use.
anyscale job submit --cloud <your_cloud_name> --working-dir https://github.com/anyscale/docs_examples/archive/refs/heads/main.zip -- python hello_world.py