|
| 1 | +--- |
| 2 | +title: Deploy vCluster Platform on Azure using AKS |
| 3 | +sidebar_label: Azure |
| 4 | +sidebar_position: 4 |
| 5 | +description: Learn how to deploy and configure vCluster Platform on Azure with AKS. |
| 6 | +--- |
| 7 | + |
| 8 | +import Image from "@site/src/components/Image"; |
| 9 | +import InstallNextSteps from "../../_partials/install/install-next-steps.mdx"; |
| 10 | +import ListHelmVersions from '../../_partials/install/list-helm-versions.mdx'; |
| 11 | +import BasePrerequisites from '../../_partials/install/base-prerequisites.mdx'; |
| 12 | +import InstallCli from '../../../vcluster/_partials/deploy/install-cli.mdx'; |
| 13 | +import KubeconfigUpdate from '../../../docs/_partials/kubeconfig_update.mdx'; |
| 14 | +import ProAdmonition from '../../../vcluster/_partials/admonitions/pro-admonition.mdx'; |
| 15 | +import InterpolatedCodeBlock from "@site/src/components/InterpolatedCodeBlock"; |
| 16 | + |
| 17 | + |
| 18 | +import Flow, { Step } from '@site/src/components/Flow'; |
| 19 | + |
| 20 | +import Label from '@site/src/components/Label'; |
| 21 | + |
| 22 | + |
| 23 | +This guide provides instructions for deploying the platform on Azure using [Azure Kubernetes Service (AKS)](https://learn.microsoft.com/en-us/azure/aks/). |
| 24 | + |
| 25 | +<!-- vale off --> |
| 26 | +## Prerequisites |
| 27 | + |
| 28 | +Ensure you have the following: |
| 29 | +<BasePrerequisites /> |
| 30 | +- vCluster CLI installed: <InstallCli /> |
| 31 | +- [Azure CLI (`az` CLI)](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) installed. |
| 32 | +:::note |
| 33 | +Ensure you have the necessary permissions to create clusters and manage Azure services. |
| 34 | +::: |
| 35 | + |
| 36 | +## Create a AKS cluster |
| 37 | + |
| 38 | +<Flow id="create-gke-cluster"> |
| 39 | + |
| 40 | +<Step> |
| 41 | +Prepare the environment. |
| 42 | + |
| 43 | +Start by creating an AKS cluster using the `az` CLI. Set up your environment variables: |
| 44 | + |
| 45 | +<InterpolatedCodeBlock |
| 46 | + code={`export RANDOM_ID="$(openssl rand -hex 3)" |
| 47 | +export RESOURCE_GROUP_NAME=[[VAR:RESOURCE_GROUP_NAME:vcluster-demo-ResourceGroup-$RANDOM_ID] |
| 48 | +export REGION=[[VAR:REGION:westeurope]] |
| 49 | +export CLUSTER_NAME=[[VAR:CLUSTER_NAME:vcluster-demo-$RANDOM_ID]] |
| 50 | +export DNS_LABEL=[[VAR:DNS_LABEL:vcluster-demo-dns-$RANDOM_ID]] |
| 51 | +`} |
| 52 | + language="bash" |
| 53 | + title="Set environment variables" |
| 54 | +/> |
| 55 | +</Step> |
| 56 | + |
| 57 | +<Step> |
| 58 | +(Optional) Create a resource group if the specified resource group name does not exist: |
| 59 | + |
| 60 | +<InterpolatedCodeBlock |
| 61 | + code={`az group create --name $RESOURCE_GROUP_NAME --location $REGION`} |
| 62 | + language="bash" |
| 63 | + title="Create a resource group" |
| 64 | +/> |
| 65 | +</Step> |
| 66 | + |
| 67 | +<Step> |
| 68 | +Create the cluster. |
| 69 | + |
| 70 | +<InterpolatedCodeBlock |
| 71 | + code={`az aks create --resource-group $RESOURCE_GROUP_NAME --name $CLUSTER_NAME --node-count 2`} |
| 72 | + language="bash" |
| 73 | + title="Create AKS cluster" |
| 74 | +/> |
| 75 | + |
| 76 | + :::info |
| 77 | + This process typically takes about 10-15 minutes. |
| 78 | + ::: |
| 79 | + |
| 80 | +Using the default values, this command creates a AKS cluster named `vcluster-demo` in the `westeurope` |
| 81 | +region with two nodes. |
| 82 | + |
| 83 | +</Step> |
| 84 | + |
| 85 | +<Step> |
| 86 | +Download the Kubeconfig file for the new cluster: |
| 87 | + |
| 88 | +<InterpolatedCodeBlock |
| 89 | + code={`az aks get-credentials --resource-group $RESOURCE_GROUP_NAME --name $CLUSTER_NAME`} |
| 90 | + language="bash" |
| 91 | + title="Get Kubeconfig" |
| 92 | +/> |
| 93 | +</Step> |
| 94 | + |
| 95 | +<Step> |
| 96 | +Verify the cluster creation. |
| 97 | + |
| 98 | +Verify that AKS was created successfully by listing the nodes: |
| 99 | + |
| 100 | +```bash title="List cluster nodes" |
| 101 | +kubectl get nodes |
| 102 | +``` |
| 103 | + |
| 104 | +You should see an output similar to the following: |
| 105 | + |
| 106 | +```bash title="Example output" |
| 107 | +NAME STATUS ROLES AGE VERSION |
| 108 | +aks-nodepool1-41068841-vmss000000 Ready <none> 6m4s v1.31.8 |
| 109 | +aks-nodepool1-41068841-vmss000001 Ready <none> 6m11s v1.31.8 |
| 110 | +``` |
| 111 | + |
| 112 | +</Step> |
| 113 | + |
| 114 | +</Flow> |
| 115 | + |
| 116 | +## Set up the platform |
| 117 | + |
| 118 | +After the AKS cluster is running, deploy the platform. |
| 119 | + |
| 120 | +### Install the platform |
| 121 | + |
| 122 | +<Flow> |
| 123 | +<Step> |
| 124 | +[Deploy the platform](/platform/install/quick-start-guide) using the vCluster CLI. |
| 125 | + |
| 126 | +:::note idempotency |
| 127 | +The following command is _idempotent_, meaning that running it again does |
| 128 | +not result it creating another cluster with the same name. |
| 129 | +::: |
| 130 | + |
| 131 | +```bash title="Deploy the platform using vCluster CLI |
| 132 | +vcluster platform start |
| 133 | +``` |
| 134 | + |
| 135 | +The command prompts you to enter the email address for the admin user: |
| 136 | + |
| 137 | +```bash title="Expected deployment output" |
| 138 | +By providing your email, you accept our Terms of Service and Privacy Statement: |
| 139 | +Terms of Service: https://www.loft.sh/legal/terms |
| 140 | +Privacy Statement: https://www.loft.sh/legal/privacy |
| 141 | +? Please specify an email address for the admin user |
| 142 | +``` |
| 143 | + |
| 144 | +:::tip |
| 145 | +If the command takes too long to execute—such as when other cluster operations are in progress—rerun the command. |
| 146 | +::: |
| 147 | + |
| 148 | +</Step> |
| 149 | + |
| 150 | +<Step> |
| 151 | +Connect to the platform. |
| 152 | + |
| 153 | +After the platform is deployed, your default browser opens with the platform UI, and you should see output similar to the following: |
| 154 | + |
| 155 | +```bash title="platform deployment output" |
| 156 | +########################## LOGIN ############################ |
| 157 | + |
| 158 | +Username: admin |
| 159 | +Password: 9758c908-b931-4edd-b3cb-3f034e50651a # Change via UI or via: vcluster platform reset password |
| 160 | + |
| 161 | +Login via UI: https://hyx4907.loft.host |
| 162 | +Login via CLI: vcluster platform login https://hyx4907.loft.host |
| 163 | + |
| 164 | +################################################################# |
| 165 | + |
| 166 | +vCluster Platform was successfully installed and can now be reached at: https://hyx4907.loft.host |
| 167 | + |
| 168 | +Thanks for using vCluster Platform! |
| 169 | +19:34:46 done You are successfully logged into vCluster Platform! |
| 170 | +- Use `vcluster platform create vcluster` to create a new virtual cluster |
| 171 | +- Use `vcluster platform add vcluster` to add an existing virtual cluster to a vCluster platform instance |
| 172 | +``` |
| 173 | + |
| 174 | +When logging in using the UI, provide the following details: |
| 175 | + |
| 176 | +- **First Name** |
| 177 | +- **Last Name** |
| 178 | +- **Email** (pre-filled with the address you supplied earlier) |
| 179 | +- **Organization** |
| 180 | + |
| 181 | +To log in using the CLI, run the `Login via CLI` command provided above. |
| 182 | + |
| 183 | +This completes the basic platform deployment. For additional configuration and available features, see the [Next steps section](#post-install-steps). |
| 184 | + |
| 185 | +You can _optionally_ perform additional configuration steps: |
| 186 | + |
| 187 | +- [Expose the platform UI using the load balancer](#load-balancer) |
| 188 | +- [Set up a custom domain and configure DNS](#setup-domain-dns) |
| 189 | + |
| 190 | +</Step> |
| 191 | +</Flow> |
| 192 | + |
| 193 | +### Expose the platform UI using load balancer {#load-balancer} |
| 194 | + |
| 195 | +<Flow> |
| 196 | +<Step> |
| 197 | +Optionally, you can expose the platform UI using a LoadBalancer service to make it accessible outside the cluster. |
| 198 | + |
| 199 | +:::note |
| 200 | +This assumes the platform is deployed in the `vcluster-platform` namespace which is a |
| 201 | +default deployment namespace. |
| 202 | +::: |
| 203 | + |
| 204 | +```bash |
| 205 | +cat <<EOF | kubectl apply -f - |
| 206 | +apiVersion: v1 |
| 207 | +kind: Service |
| 208 | +metadata: |
| 209 | + name: vcluster-platform-loadbalancer |
| 210 | + namespace: vcluster-platform |
| 211 | +spec: |
| 212 | + type: LoadBalancer |
| 213 | + externalTrafficPolicy: Cluster |
| 214 | + selector: |
| 215 | + app: loft |
| 216 | + ports: |
| 217 | + - name: https |
| 218 | + protocol: TCP |
| 219 | + port: 443 |
| 220 | + targetPort: 10443 |
| 221 | +EOF |
| 222 | + |
| 223 | +``` |
| 224 | + |
| 225 | +</Step> |
| 226 | + |
| 227 | +<Step> |
| 228 | +After the service is active, obtain the external IP address: |
| 229 | + |
| 230 | +```bash |
| 231 | +kubectl get svc vcluster-platform-loadbalancer -n vcluster-platform |
| 232 | +``` |
| 233 | + |
| 234 | +Navigate to the IP address in your browser `https://<EXTERNAL_IP>`. |
| 235 | + |
| 236 | +:::tip |
| 237 | +The platform uses a self-signed certificate, so you should |
| 238 | +accept the warning in your browser. For production use, replace the default self-signed certificate with a valid [TLS certificate](/platform/configure/domain#configure-tls). |
| 239 | +::: |
| 240 | + |
| 241 | +</Step> |
| 242 | + |
| 243 | +</Flow> |
| 244 | + |
| 245 | +### Set up custom domain and configure DNS {#setup-domain-dns} |
| 246 | + |
| 247 | +Optionally, you can set up a custom domain, SSL certificate, and configure DNS to provide a secure URL for accessing the platform. |
| 248 | +[Official Azure guide](https://learn.microsoft.com/en-us/azure/aks/app-routing-dns-ssl) |
| 249 | + |
| 250 | +<Flow> |
| 251 | +<Step> |
| 252 | +All necessary steps for configuring DNS and SSL for Azure Kubernetes Service (AKS) App Routing are thoroughly described in the official Azure documentation. |
| 253 | +Please refer to the guide here: [Configure DNS and SSL for AKS App Routing](https://learn.microsoft.com/en-us/azure/aks/app-routing-dns-ssl). |
| 254 | +</Step> |
| 255 | + |
| 256 | +<Step> |
| 257 | +Connect the platform to the custom domain. |
| 258 | + |
| 259 | +After DNS is set up, you can start the platform using the following command: |
| 260 | + |
| 261 | +```bash |
| 262 | +vcluster platform start --host=vcluster-platform.yourdomain.tld |
| 263 | +``` |
| 264 | + |
| 265 | +:::info |
| 266 | +For more information on how to configure a custom domain, see the [Configure external acess and TLS documentation](/platform/configure/domain). |
| 267 | +::: |
| 268 | + |
| 269 | +</Step> |
| 270 | +</Flow> |
| 271 | + |
| 272 | +## Next steps {#post-install-steps} |
| 273 | + |
| 274 | +<InstallNextSteps /> |
| 275 | + |
| 276 | +You can also use Google as an identity provider and [configure SSO](/platform/configure/single-sign-on/providers/google) to enable user |
| 277 | +authentication to the platform. |
| 278 | + |
| 279 | +## Cleanup |
| 280 | + |
| 281 | +If you deployed the AKS cluster with this tutorial, and want to clean up the resources, run the |
| 282 | +following command: |
| 283 | + |
| 284 | +```bash title="Clean up resources" |
| 285 | +az container clusters delete $CLUSTER_NAME --zone $ZONE --quiet |
| 286 | +``` |
0 commit comments