Overview
Sometimes users face problems with debugging the application code base within Kubernetes. Every time the user would need to build a container image and then deploy it on Kubernetes, this makes troubleshooting applications difficult.
Azure Dev Spaces
Azure Dev Spaces offers a solution for operating with a team on a container-based solution. It is an extension of AKS that permits developers to simply run and debug the code within the context of larger applications without effecting another environment, users can test application module inside the AKS with the help of Azure Dev Spaces and share a development cluster between team members with no interference. It provides the concept of a space, which allows working in isolation and without the fear of breaking the system.
You can use Azure Dev Spaces with CLI, Visual Studio and Visual Studio Code. It’s very flexible and works with all environments.
Prerequisites
- Azure subscription
- Visual Studio
- Azure CLI
- AKS cluster
Before configuration, we will need an create an AKS cluster if you don’t have an existing cluster you can use the below command to create a new AKS cluster. Also, you can use the azure portal, but we will be using Azure CLI to create the cluster:
$ az login
$ az account list –output table
$ az account set –subscription <subscription ID>
$ az group create –name MyResourceGroup –location <region>
$ az aks create -g MyResourceGroup -n MyAKS –location <region> –generate-ssh-keys
Next, run the following command to install Azure CLI tools in your system:
$ az aks get-credentials -n <aks_name> -g <resource_group_name>
$ az aks use-dev-spaces -g MyResourceGroup -n MyAKS
Enabling Azure Dev Space for your Application
- Open up Visual Studio. (make sure Azure SDK is enabled in Visual Studio)
- Create a new ASP. Net core application
- Select Azure Dev Spaces at runtime
- After your selection there will be a prompt displayed to verify your subscription. Choose your correct subscription, AKS name and Dev Spaces namespace.
- After clicking on ok the bundling process will begin, and the below two files will be generated
- azds.yml
- Dockerfile
The azds.yml file contains Helm chart configuration, you can update this chart as per your requirement. The Dockerfile contains your container image configuration
6. When your project is running you can attach the debugger like this
We have configured AKS dev spaces in our AKS cluster you can do similar for configure azure dev spaces in your AKS cluster.