Ahead of the Game: Exploring Helm Features with .NET Aspire & Aspir8 Preview 7

Joseph Whiteaker
5 min readMay 10, 2024

--

With the recent release of .NET Aspire Preview 7 just a few days ago and Aspire set to go general availability (GA) next month, there’s no better time to dive into the future of application deployment. The continuous evolution of these tools promises to streamline the deployment process even further, ensuring that developers can stay ahead of the curve with the latest features and enhancements.

Aspire Logo

I’m particularly excited to announce a significant update that I personally advocated for — an advanced Helm feature in Aspirate. Back in January, I opened an issue on the Aspirate repository to suggest this feature, and thanks to the outstanding efforts of David Sekula, whose work can be seen on GitHub, this functionality has now been incorporated.

This addition not only enhances tool capabilities but also underscores the vital role of community collaboration in software development. I also can’t thank David without also giving praise to those who have been contributing to Aspire and working really hard on it.

For those who are not familiar with Aspire, Aspire simplifies running containers and managing all your microservices locally, optimizing both development and testing phases. Aspirate complements this by handling the manifest.json file generated by the .NET CLI (in conjunction with the aspire workload), building your .NET applications into container images, and publishing them to a registry. Furthermore, Aspirate now takes it a step further by generating Helm charts for your containers and integrating an OpenTelemetry dashboard for comprehensive monitoring.

This blog post will guide you through setting up a Helm chart using the newly updated Aspire and Aspirate, detailing every step to ensure that your deployment process is not just faster, but also more reliable and scalable. Whether you’re a seasoned developer or just starting out, these instructions will help you harness the full potential of the latest advancements in these powerful tools, making your application deployment a streamlined and effective process.

Prerequisites

Ensure you have the following tools installed:

  1. Chocolatey (for Windows users)
  2. Rancher Desktop
  3. .NET 8 SDK

Setup Instructions

Step 1: Install Necessary Tools

If you are on Windows, first install Chocolatey:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Install Rancher Desktop via Chocolatey:

choco install rancher-desktop
  • Install .NET 8 SDK (ensure you have the latest .NET SDK installed to handle all .NET related workloads and commands).

Download .NET 8.0 (Linux, macOS, and Windows) (microsoft.com)

Step 2: Install Aspire and Aspirate Tools

Update installed workloads to ensure all components are current:

dotnet workload update

Install Aspire:

dotnet workload install aspire

List all installed workloads to confirm installation:

dotnet workload list

Install Aspirate with prerelease versions available:

dotnet tool install -g aspirate --prerelease

Step 3: Setup Local Docker Registry

Create a Docker volume for your registry data:

docker volume create registry-data

Run a local Docker Registry container:

docker run -d -p 5001:5000 --restart always --name registry -v registry-data:/var/lib/registry registry:2

Step 4: Initialize Aspire Application

Create and navigate to your new project directory:

mkdir aspire-demo
cd aspire-demo
dotnet new aspire-starter --output AspireDemo
cd AspireDemo

Step 5: Configure the Application

Navigate to the application host directory:

cd .\AspireDemo.AppHost\

The App Host project contains a program.cs file that should look something along the lines of this

var builder = DistributedApplication.CreateBuilder(args);

var apiService = builder.AddProject<Projects.AspireDemo_ApiService>("apiservice");

builder.AddProject<Projects.AspireDemo_Web>("webfrontend")
.WithExternalHttpEndpoints() // This means hey ingress look at me!
.WithReference(apiService);

builder.Build().Run();

Initialize Aspirate configuration:

aspirate init
  • Follow the interactive setup to configure Docker settings, default container registry, and other preferences. Make sure to enter localhost:5001 when asked for default container registry.

Step 6: Generate Helm Chart

Generate a Helm chart with Aspirate, ensuring to customize the process based on your application’s architecture:

aspirate generate --output-format helm
  • Select ‘no’ when asked to use all previous state values, this will allow you to select yes to having an oltp dashboard included in your helm chart.

Step 7: Deploy Using Helm

Navigate to the directory containing your newly created Helm chart:

cd .\aspirate-output\Chart

Deploy your application:

helm upgrade aspire-preview-7-demo . --install --namespace aspire-demo --create-namespace --wait

Step 8: Access Your Application

  • Use Rancher UI to port forward the services.
  • Access the Aspire dashboard and Blazor UI created from the Helm chart.

Here is the Aspire Dashboard (very similar to the local development dashboard). For more info on the Dashboard, here are the docs: Explore .NET Aspire dashboard — .NET Aspire | Microsoft Learn

Aspire OLTP Dashboard
Aspire Traces Dashboard

And here is the blazor application that was port forwarded in the blazor app.

Blazor Application

Conclusion

As we’ve explored, the integration of Aspire and Aspirate with Helm offers a robust solution for deploying and managing applications efficiently and reliably. By leveraging the capabilities of these tools, you can significantly reduce the complexity of your deployment processes, making them faster and more scalable.

With .NET Aspire Preview 7 now available and the upcoming GA release, this is an opportune time to start experimenting with the new features and enhancements. By familiarizing yourself with these tools now, you’ll be well-prepared to take full advantage of Aspire once it becomes GA, ensuring that your projects are not only up to date but also utilizing the best practices in technology.

Whether you’re deploying complex microservices or simple applications, the combination of Aspire, Aspirate, and Helm provides a powerful, streamlined approach to modern deployment challenges. Start implementing these tools in your projects today to experience firsthand the benefits they bring to your development lifecycle. Remember, staying ahead in the fast-paced world of software development means continually adapting and learning — Aspire and Aspirate with Helm are here to make that journey smoother and more efficient.

--

--