HealthChecks.Kubernetes.Aspire 1.0.1

dotnet add package HealthChecks.Kubernetes.Aspire --version 1.0.1
                    
NuGet\Install-Package HealthChecks.Kubernetes.Aspire -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HealthChecks.Kubernetes.Aspire" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HealthChecks.Kubernetes.Aspire" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="HealthChecks.Kubernetes.Aspire" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HealthChecks.Kubernetes.Aspire --version 1.0.1
                    
#r "nuget: HealthChecks.Kubernetes.Aspire, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package HealthChecks.Kubernetes.Aspire@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HealthChecks.Kubernetes.Aspire&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=HealthChecks.Kubernetes.Aspire&version=1.0.1
                    
Install as a Cake Tool

Aspire.HealthChecks.Kubernetes

Aspire.HealthChecks.Kubernetes provides extension methods to easily add Kubernetes-related health checks to your ASP.NET Core applications and the Aspire Dashboard. These health checks help monitor the health of your application in a Kubernetes environment by checking the status of the Kubernetes API, nodes, and pods. You can use it with, or without the Aspire integration.

About Kubernetes Health Checks

Kubernetes health checks are essential for ensuring that your application is running smoothly within a Kubernetes cluster. They allow you to monitor the health of the Kubernetes API, nodes, and pods, providing insights into the operational status of your application. These checks can be integrated into your ASP.NET Core application to provide a robust health monitoring solution. The 3 health checks used by Kubernetes are:

  • Startup: Checks if the application has started successfully.
  • Live: Checks if the application is still running and responsive.
  • Ready: Checks if the application is ready to handle requests.

Features

  • Simple extension method to register all Kubernetes health checks
  • Designed for .NET 9 and ASP.NET Core applications
  • Easily extensible for custom health checks

Getting Started

Installation

Add a reference to the Aspire.HealthChecks.Kubernetes project or package in your ASP.NET Core application.

dotnet add package HealthChecks.Kubernetes.Aspire

If you are using the Aspire Dashboard, add a reference to the Aspire.Hosting.HealthChecks.Kubernetes project in your Aspire AppHost project.

dotnet add package HealthChecks.Kubernetes.Aspire.Hosting

Usage

Asp.Net Core Application

This will add the 3 health checks to your application. You can then easily use them in your kubernetes pod yaml file to configure the health checks for your application. That way Kubernetes can monitor the health of your application and restart it if necessary.

In your Program.cs:

var builder = WebApplication.CreateBuilder(args);

// Register The general Health Check service
var healthChecksBuilder = builder.Services.AddHealthChecks();

// Add your Health Checks with the Tags from Aspire.HealthChecks.Kubernetes.Common.Constants
healthChecksBuilder.Services.Configure<HealthCheckServiceOptions>(o =>
{
	o.Registrations.Add(new HealthCheckRegistration("My Health Check", new MyHealthCheck(), null, [Constants.LiveTag]));
});

var app = builder.Build();

// Register Kubernetes health checks
app.UseKubernetesHealthChecks();

await app.RunAsync();
Aspire AppHost

If you are using the Aspire Dashboard, you can easily add the Kubernetes health checks to your Aspire AppHost project. This will automatically register the health checks with the Aspire Dashboard, allowing you to monitor the health of your application from the dashboard.

In your Program.cs:

var builder = DistributedApplication.CreateBuilder(args);

/// Add your application
builder.AddProject<MyApp>(nameof(MyApp))
	.WithKubernetesHealthChecks();

var app = builder.Build();

await app.RunAsync();

License

This project is licensed under the Unlicense.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on HealthChecks.Kubernetes.Aspire:

Package Downloads
RESTworld.AspNetCore

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 140 9/16/2025
1.0.0 61 8/1/2025