Skip to main content
.NETFramework4.6.2net8.0net9.0

Experimental package. Provides support for Kubernetes TCP health probes.

Published
Jul 10, 2024
2y ago
Total Downloads
192.3K
192,311

Install

dotnet add package Microsoft.Extensions.Diagnostics.Probes --version 9.0.0-preview.6.24353.1
ProductVersions
.NET
net8.0net9.0
Other
.NETFramework4.6.2

README

Microsoft.Extensions.Diagnostics.Probes

Answers Kubernetes liveness, startup, and readiness TCP probes based on the results from the Health Checks service.

Install the package

From the command-line:

dotnet add package Microsoft.Extensions.Diagnostics.Probes

Or directly in the C# project file:

<ItemGroup>
  <PackageReference Include="Microsoft.Extensions.Diagnostics.Probes" Version="[CURRENTVERSION]" />
</ItemGroup>

Usage Example

The health check endpoints can be registered and configured with the following methods:

public static IServiceCollection AddKubernetesProbes(this IServiceCollection services)
public static IServiceCollection AddKubernetesProbes(this IServiceCollection services, IConfigurationSection section)
public static IServiceCollection AddKubernetesProbes(this IServiceCollection services, Action<KubernetesProbesOptions> configure)

Each type of probe handler can have its details configured separately.

services.AddKubernetesProbes(options =>
{
    options.LivenessProbe.TcpPort = 2305;
    options.StartupProbe.TcpPort = 2306;
    options.ReadinessProbe.TcpPort = 2307;
})

The HealthAssessmentPeriod property defines how often the health-checks are assessed. By default 30 seconds.

Each probe can also specify Func<HealthCheckRegistration, bool>? FilterChecks to customize which health checks are run.

Feedback & Contributing

We welcome feedback and contributions in our GitHub repo.

Changes from Previous Version

No structural changes between v9.0.0-preview.5.24311.7 and v9.0.0-preview.6.24353.1.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 3 target frameworks; confirm the exact target used by your application.The published metadata declares 16 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.