You are connecting to a Kubernetes cluster running in the private subnet of Azure Virtual Network (VNET) from your DevBox.
Here, you will connect to a Kubernetes cluster running in a private subnet from your DevBox. This would be done by setting up a bastion host that advertises the VNET CIDR to your DevZero network so that you can access the private service through the network tunneling.
Before you begin, follow the Connecting to Azure guide to set up the Bastion Host to access your private Azure services.
To connect to AKS running in the private subnet, ensure it is within the same Resource Group and VNET containing the Bastion Host.
If the above criteria are followed, then log into your DevBox and follow these steps:
Go to your DevBox and install Azure CLI:
After the installation is successful, you need to authenticate your Microsoft Azure account with Azure CLI using the following command:
Following your setup with Azure CLI, you also need to download the kubectl binaries:
Install kubectl:
After your initial setup is done, your DevBox should be ready for accessing the cluster:
You need to select your Subscription ID in Azure Cli with the following command:
Use the following command to connect to your cluster:
Check if the cluster is accessible:
If you need to make a new AKS Cluster running in a private subnet and access it through DevZero's network, then follow the below steps:
Go to Home > Kubernetes Services or you can search for Azure Kuberntes Service in the search bar and click on Create Kubernetes Cluster.
In the Basics section, select the resource group you previously selected for your VNET.
Enter your Cluster name and region and choose your desired node image.
Select your desired Node Pool machine configuration in the Node Pools section.
Go to the Networking section and check the Enable private cluster
and Bring your own Azure virtual network
options, respectively.
After checking these two options, you will be asked to choose your VNET. Then, create a new subnet dedicated to Kubernetes and choose that subnet.
Enter a Kubernetes service address range that doesn't overlap with your VNET CIDR. For Example, if your VNET CIDR Range is 10.0.0.0/16, then it is recommended that you make your Kubernetes service address range 192.168.0.0/16.
Provide a Kubernetes DNS service IP Address and enter your DNS name prefix.
Click on Review + Create and click on Create to create Kubernetes Cluster.
Now that you have created the cluster, you need to authenticate your DevBox with the az
cli tool:
Go to your DevBox and install Azure CLI:
After the installation is successful, you need to authenticate your Microsoft Azure account with Azure CLI using the following command:
Following your setup with Azure CLI, you also need to download the kubectl binaries:
Install kubectl:
After your initial setup is done, your DevBox should be ready for accessing the cluster:
You need to select your Subscription ID in Azure CLI with the following command:
Use the following command to connect to your cluster:
Check if the cluster is accessible: