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