Covers a cloud-native readiness checklist for .NET services: stateless design, probes and graceful shutdown, OpenTelemetry logs, metrics and traces, resilience and timeouts, externalised config and managed identity, container security, scaling and operability, and enforcing it through a service template, Aspire service defaults, pipeline gates and platform policy.
My checklist has seven areas: stateless and disposable (any replica can be killed), health (startup, readiness and liveness probes with distinct jobs, plus graceful shutdown that fits the grace period), telemetry (OpenTelemetry logs, metrics and traces, an SLO and alerts), resilience (a timeout on every outbound call, the standard resilience handler, idempotent message handlers), configuration and secrets (validated options, managed identity, Key Vault), security (non-root chiseled images, scanning, least-privilege identity, private networking) and operability (resource requests, an autoscale rule, an owner and a runbook).
I enforce it with a paved road, not a document: a service template and shared service-defaults package that make the right thing the default, plus a few automated gates in the pipeline and Azure Policy. The trade-off is standardisation versus team autonomy, so I gate only what protects production.
"A cloud-native service is one the platform can start, scale, move and stop without a human, and that tells you what it is doing while it runs. My checklist follows from that. Stateless: no files on local disk, no in-memory session, Data Protection keys shared. Health: a startup probe, a readiness probe that fails during warm-up and shutdown, and a liveness probe that checks only the process. Telemetry: OpenTelemetry for traces, metrics and logs with a
service.nameand version, so a request can be followed across services. Resilience: every outbound call has a timeout, retries happen in one place, and message handlers are idempotent. Config: validated options withValidateOnStart, managed identity instead of connection-string passwords. Security: non-root chiseled images, scanned and signed. Operability: requests and limits, an autoscale rule, an owner, dashboards and a runbook.The hard part is not the list, it is getting [n] teams to follow it. For example, at [company] we [had a wiki checklist nobody read]. I [built a service template and a shared ServiceDefaults package, modelled on Aspire's, that wired OpenTelemetry, health endpoints, resilience and JSON logging with one call, and added three pipeline gates: image scan, probes present, no secrets]. [New services went from about two weeks of production hardening to two days, and checklist-related incidents dropped from N to M per quarter.]
The mistake I see is a 60-item checklist enforced in a review meeting. It slows teams down and still misses things. I keep the blocking list short, about ten items that prevent outages or breaches, automate those, and make the rest advice built into the template."
| Area | Must have (blocking) | Should have |
|---|---|---|
| Stateless | No local writes outside /tmp; session and Data Protection keys external |
Read-only root file system |
| Health | /health/ready, /health/live, startup probe; ShutdownTimeout < grace period |
Warm-up before readiness |
| Telemetry | OpenTelemetry traces + metrics + structured logs; service.name, service.version |
SLO with burn-rate alerts |
| Resilience | Timeout on every outbound call; one retry layer; idempotent consumers | Bulkheads, load shedding, rate limits |
| Config and secrets | Options validated on start; no secrets in image or repo; managed identity | App Configuration, feature flags |
| Security | Non-root, chiseled/distroless image; image scanning; HTTPS; least-privilege RBAC | Image signing, private endpoints, network policies |
| Operability | CPU/memory requests and limits; autoscale rule; owner and on-call; runbook | Load test result, cost tag |
| Mechanism | What it enforces | Cost |
|---|---|---|
Service template (dotnet new) |
Project layout, Dockerfile, probes, Program.cs | Template maintenance |
| Shared ServiceDefaults package | OpenTelemetry, health checks, resilience, logging | Versioning across teams |
| Pipeline gates | Image scan, tests, secret scan, manifest lint (probes, limits) | Some build time |
| Azure Policy / Kubernetes admission (Gatekeeper, Kyverno) | Non-root, no latest tag, limits set, approved registries |
Platform team effort |
| Scorecard (e.g. Backstage) | Visibility of the should-haves | Portal to run |
A platform of 18 .NET services had seven incidents in a quarter traced to missing timeouts, absent probes or secrets in config files. After a template plus shared defaults and four pipeline gates, new services passed production review in one pass, and the next two quarters had one incident of that kind.
Checks whether the candidate can define production readiness for cloud-native .NET services and, more importantly, drive adoption across teams.
Green flags
Red flags
The CNCF definition talks about containers, service meshes, microservices, immutable infrastructure and declarative APIs, but the operational core is simpler: the platform must be able to manage the process without a human, and humans must be able to understand it from the outside.
Platform needs Humans need
+-------------------------------+ +-----------------------------+
| start fast, report readiness | | traces across services |
| stop gracefully on SIGTERM | | metrics: rate, errors, p99 |
| scale by adding replicas | | structured logs with ids |
| config injected at run time | | an owner and a runbook |
| resource needs declared | | SLOs and alerts |
+-------------------------------+ +-----------------------------+
Every checklist item maps to one of these boxes.
Aspire's ServiceDefaults project shows the pattern: one extension method, AddServiceDefaults(), configures OpenTelemetry (ASP.NET Core, HttpClient and runtime instrumentation, OTLP export), default health checks, service discovery and AddStandardResilienceHandler for every HttpClient, and MapDefaultEndpoints() maps /health and /alive. An organisation can publish its own version as an internal NuGet package with its conventions (JSON console logs, Azure Monitor exporter, health endpoint names, required resource attributes). Teams get the checklist for one line of code, and the platform team upgrades everyone by releasing a new package version.
service.name, service.version, deployment.environment.name. Without them, traces from 18 services are unreadable.Microsoft.AspNetCore.Hosting and System.Net.Http meters, built into .NET 8+.Timeouts must shrink down the chain (gateway 10 s > service 5 s > dependency 2 s). Retries only for idempotent operations and only at one layer. A circuit breaker stops hammering a failing dependency. For messaging, idempotent handlers plus a dead-letter queue with an alert. Rate limiting (AddRateLimiter) and concurrency limits protect the service from its callers.
mcr.microsoft.com/dotnet/aspnet:10.0-noble-chiseled), non-root user (UID 1654 app in the official images), port 8080.readOnlyRootFilesystem: true with an emptyDir for /tmp.CPU and memory requests let the scheduler place pods; a memory limit stops one leak from taking down a node (and .NET reads cgroup limits to size the GC heap). An autoscale rule (HPA on CPU, or KEDA on queue length / HTTP concurrency in Container Apps) and a pod disruption budget keep capacity during node maintenance. Each service has an owning team, an on-call rota and a runbook linked from its alerts.
ServiceDefaults class library with AddServiceDefaults() and use it in two minimal APIs; view both in the Aspire dashboard.runAsNonRoot: false, and test it in kind.trivy image on an sdk image and on a chiseled aspnet image and compare the vulnerability counts.readOnlyRootFilesystem and find what in your app still writes to disk.An organisation-level service-defaults package (modelled on Aspire's) that turns most of the checklist into one call.
// Contoso.ServiceDefaults/Extensions.cs (.NET 10 class library, FrameworkReference Microsoft.AspNetCore.App)
namespace Microsoft.Extensions.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using OpenTelemetry;
using OpenTelemetry.Metrics;
using OpenTelemetry.Resources;
using OpenTelemetry.Trace;
public static class ServiceDefaultsExtensions
{
public static TBuilder AddServiceDefaults<TBuilder>(this TBuilder builder) where TBuilder : IHostApplicationBuilder
{
// Telemetry: one resource identity for logs, metrics and traces.
builder.Logging.AddOpenTelemetry(o => { o.IncludeFormattedMessage = true; o.IncludeScopes = true; });
builder.Services.AddOpenTelemetry()
.ConfigureResource(r => r.AddService(builder.Environment.ApplicationName,
serviceVersion: typeof(ServiceDefaultsExtensions).Assembly.GetName().Version?.ToString()))
.WithMetrics(m => m.AddAspNetCoreInstrumentation().AddHttpClientInstrumentation().AddRuntimeInstrumentation())
.WithTracing(t => t.AddAspNetCoreInstrumentation(o => o.Filter = ctx => !ctx.Request.Path.StartsWithSegments("/health"))
.AddHttpClientInstrumentation())
.UseOtlpExporter(); // endpoint from OTEL_EXPORTER_OTLP_ENDPOINT: Collector, Aspire dashboard or Azure Monitor
// Health: liveness has no checks; readiness checks are tagged "ready" by each service.
builder.Services.AddHealthChecks().AddCheck("self", () => HealthCheckResult.Healthy(), ["live"]);
// Resilience: every HttpClient gets timeouts, retries and a circuit breaker.
builder.Services.ConfigureHttpClientDefaults(http => http.AddStandardResilienceHandler());
// Disposability: fits preStop 10 s + 25 s inside a 40 s grace period.
builder.Services.Configure<HostOptions>(o => o.ShutdownTimeout = TimeSpan.FromSeconds(25));
return builder;
}
public static WebApplication MapDefaultEndpoints(this WebApplication app)
{
app.MapHealthChecks("/health/live", new HealthCheckOptions { Predicate = c => c.Tags.Contains("live") });
app.MapHealthChecks("/health/ready", new HealthCheckOptions { Predicate = c => c.Tags.Contains("ready") });
return app;
}
}
// A team's service: the checklist costs two lines.
var builder = WebApplication.CreateBuilder(args);
builder.AddServiceDefaults();
builder.Services.AddHealthChecks().AddSqlServer(builder.Configuration.GetConnectionString("Orders")!, tags: ["ready"]);
var app = builder.Build();
app.MapDefaultEndpoints();
app.MapGet("/orders/{id:int}", (int id) => Results.Ok(new { id }));
app.Run();
# Pipeline gate idea: reject manifests missing the basics (conftest / Kyverno-style rule, pseudo-policy)
require:
- spec.template.spec.containers[*].readinessProbe
- spec.template.spec.containers[*].resources.requests.memory
- spec.template.spec.securityContext.runAsNonRoot == true
deny:
- image tag == "latest"
dotnet-counters (GC heap, working set, CPU) and container metrics (container_memory_working_set_bytes, CPU throttling), set the memory request near steady-state working set and the limit with 25-50% headroom, set the CPU request at typical usage, and revisit after major releases. .NET sizes its GC heap from the cgroup memory limit (75% by default via GCHeapHardLimitPercent).NuGetAudit, on by default in .NET 9+ SDKs, including transitive packages), lock files and package source mapping, generate an SBOM, and sign images so admission only accepts what your pipeline built.The checklist itself is easy to write; the senior contribution is the delivery mechanism. The best checklists are invisible: a team runs dotnet new contoso-api, gets a service that already has telemetry, probes, resilience and a hardened Dockerfile, and only meets the gates when they deliberately go off the road. Keep the blocking set small and objective (machine-checkable), and treat the template like a product with a changelog and an owner.
| Enforcement option | When it fits | Cost | When not to |
|---|---|---|---|
| Written checklist + review | 1-3 teams, early days | Reviewer time, inconsistency | More than a handful of services |
| Template + shared defaults | Many teams on one stack | Maintaining the template and package | Very heterogeneous stacks |
| Policy as code (Azure Policy, Kyverno) | Security and platform invariants | Platform team effort, exceptions process | Style preferences |
| Scorecards (Backstage) | Visibility across 20+ services | Portal to operate | Small estates |
Measure success by lead time for a new service to reach production and by the number of incidents whose root cause is a checklist item.
Service defaults is a shared class library that each service calls with builder.AddServiceDefaults(). It is code you own, generated by the template:
HttpClient and runtime instrumentation, exported over OTLP when OTEL_EXPORTER_OTLP_ENDPOINT is set.self check; MapDefaultEndpoints() maps /health (readiness) and /alive (liveness), only in Development by default.HttpClient gets service discovery and the standard resilience handler (timeouts, retries, circuit breaker).It is a starting baseline, not a finished production configuration. Before production each service tunes retries for non-idempotent calls, decides how health endpoints are exposed, registers its own ActivitySource and Meter names, and sets sampling.
A health check is an automated decision: the orchestrator or load balancer acts on it, so it must answer exactly the question the actor asks. Liveness asks "is this process stuck?", so the answer is a restart. It never checks shared dependencies. Readiness asks "should this instance get traffic now?" It checks warm-up and local essentials, not something every instance shares. Startup probes give slow starts time before liveness applies.
The classic failure is a database check in liveness or readiness: one database blip makes every instance fail together. You get a fleet restart or zero healthy backends, which turns a partial outage into a total one. In ASP.NET Core I use tagged checks mapped to separate endpoints, keep them cheap and time-boxed, and keep detailed output internal. Dependency health goes to monitoring and alerts, where a human decides.
I rank by blast radius. Blocking first: the database password in a plain env var in Git (rotate it now, then use Workload Identity with Entra authentication to Azure SQL, or Key Vault); running as root on the SDK image (huge attack surface, compilers and a shell for an attacker: multi-stage build, chiseled runtime, runAsNonRoot).
Then reliability: :latest (you can't tell what's running or roll back: use version or SHA tags), no probes (traffic hits unready pods, hung pods never restart), no requests or limits (noisy neighbours, evictions, and .NET sizing itself to the whole node), one replica (downtime on every deploy).
Then diagnostics and polish: exec-form entry point for SIGTERM, .dockerignore, labels. I close with policy so the cluster rejects these by default.
How to tell it (STAR)
**S:** We had [18] .NET services moving to Container Apps, and [7] incidents in one quarter. **T:** As [senior engineer on the platform group], I was asked to stop repeat incidents without slowing teams down. **A:** I tagged the root causes from every post-incident review and showed that [6] were missing basics: no timeouts, wrong probes, secrets in config, no traces. Instead of a longer checklist, I built a service template and a shared ServiceDefaults package so the basics came for free, and automated four blocking gates in the pipeline. **R:** New services reached production in [2 days instead of 2 weeks], and checklist-type incidents fell from [7] to [1] over the next two quarters.
Last updated 23 Nov 2026.