Get started with Visual Studio Kubernetes Tools

The Visual Studio Kubernetes Tools help streamline the development of containerized applications targeting Kubernetes. Visual Studio can automatically create the configuration-as-code files needed to support Kubernetes deployment, such as Dockerfiles and Helm charts. You can debug your code in a live Azure Kubernetes Service (AKS) cluster using Azure Dev Spaces, or publish directly to an AKS cluster from inside Visual Studio.

This tutorial covers using Visual Studio to add Kubernetes support to an project and publish to AKS. If you are primarily interested in using Azure Dev Spaces to debug and test your project running in AKS, you can jump to the Azure Dev Spaces tutorial instead.


To leverage this new functionality, you'll need:

  • Docker Desktop installed on your development workstation (that is, where you run Visual Studio), if you wish to build Docker images, debug Docker containers running locally, or publish to AKS. (Docker is not required for building and debugging Docker containers in AKS using Azure Dev Spaces.)
  • If you wish to publish to AKS from Visual Studio (not required for debugging in AKS using Azure Dev Spaces):

    1. The AKS publishing tools, available as a separate download.

    2. An Azure Kubernetes Service cluster. For more information, see Creating an AKS cluster. Be sure to connect to the cluster from your development workstation.

    3. Helm CLI installed on your development workstation. For more information see Installing Helm.

    4. Helm configured against your AKS cluster by using the helm init command. For more information on how to do this, see How to configure Helm.

Create a new Kubernetes project

Once you have the appropriate tools installed, launch Visual Studio and create a new project. Under Cloud, choose the Container Application for Kubernetes project type. Select this project type and choose OK.

Screenshot of creating a new Kubernetes app project

In the Visual Studio start window, search for Kubernetes, and choose the Container Application for Kubernetes.

Screenshot of creating a new Kubernetes app project

Provide the project name.

Screenshot of creating a new Kubernetes app project

You can then choose which type of ASP.NET Core web application to create. Choose Web Application. The usual Enable Docker Support option does not appear on this dialog. Docker support is enabled by default for a container application for Kubernetes.

Screenshot of web app selection

Screenshot of web app selection

Add Kubernetes support to an existing project

Alternatively, you can add Kubernetes support to an existing ASP.NET Core web application project. To do this, right-click on the project, and choose Add > Container Orchestrator Support.

Screenshot of Add Container Orchestrator menu item

Screenshot of Add Container Orchestrator menu item

In the dialog box, select Kubernetes/Helm and choose OK.

Screenshot of Add Container Orchestrator dialog box

What Visual Studio creates for you

After creating a new Container Application for Kubernetes project or adding Kubernetes container orchestrator support to an existing project, you see some additional files in your project that facilitate deploying to Kubernetes.

Screenshot of Solution Explorer after adding Container Orchestrator support

Screenshot of Solution Explorer after adding Container Orchestrator support

The added files are:

  • a Dockerfile, which allows you to generate a Docker container image hosting this web application. As you'll see, the Visual Studio tooling leverages this Dockerfile when debugging and deploying to Kubernetes. If you prefer to work directly with the Docker image, you can right-click on the Dockerfile and choose Build Docker Image.

    Screenshot of Build Docker Image option

  • a Helm chart, and a charts folder. These yaml files make up the Helm chart for the application, which you can use to deploy it to Kubernetes. For more information on Helm, see

  • azds.yaml. This contains settings for Azure Dev Spaces, which provides a rapid, iterative debugging experience in Azure Kubernetes Service. For more information, see the Azure Dev Spaces documentation.

Publish to Azure Kubernetes Service (AKS)

With all these files in place, you can use the Visual Studio IDE to write and debug your application code, just as you always have. You can also use Azure Dev Spaces to quickly run and debug your code running live in an AKS cluster. For more information, please reference the Azure Dev Spaces tutorial

Once you have your code running the way you want, you can publish directly from Visual Studio to an AKS cluster.

To do this, you first need to double-check that you've installed everything as described in the Prerequisites section under the item for publishing to AKS, and run through all the command line steps given in the links. Then, set up a publish profile that publishes your container image to Azure Container Registry (ACR). Then AKS can pull your container image from ACR and deploy it into the cluster.

  1. In Solution Explorer, right-click on your project and choose Publish.

    Screenshot of Publish menu item

  2. In the Publish screen, choose Container Registry as the publish target, and follow the prompts to select your container registry. If you don't already have a container registry, choose Create New Azure Container Registry to create one from Visual Studio. For more information, see Publish your container to Azure Container Registry.

    Screenshot of Pick a publish target screen

  3. Back in Solution Explorer, right click on your solution and click Publish to Azure AKS.

    Screenshot of Publish to Azure AKS menu item

  4. Choose your subscription and your AKS cluster, along with the ACR publish profile that you just created. Then click OK.

    Screenshot of Publish to AKS screen

    This takes you to the Publish to Azure AKS screen.

  5. Choose the Configure Helm link to update the command line used to install the Helm charts on the server.

    Screenshot of Configure Helm link

    Updating the command line is useful if there are custom command line arguments that you wish to specify, such as a different Kubernetes context or chart name.

    Screenshot of Helm configure screen

  6. When you are ready to deploy, click the Publish button to publish your application to AKS.

    Screenshot of publish to Azure AKS screen

Congratulations! You can now use the full power of Visual Studio for all your Kubernetes app development.

Remove Kubernetes support

  1. In Solution Explorer, under Properties, open launchSettings.json.

  2. Delete the section Container in Kubernetes.

  3. If you're switching back to Docker compose, select that project in Solution Explorer, right-click and choose Set as Startup Project.

  4. (Optional) You can also delete other artifacts listed as mentioned earlier in the article, such as the charts folder and azds.yaml.

Next steps

Learn more about Kubernetes development on Azure by reading the AKS documentation.

Learn more about Azure Dev Spaces by reading the Azure Dev Spaces documentation