Azure Kubernetes App Deploy
MicrosoftOfficialCreated by Microsoft
- Skill
- Tool integration
- Cloud and DevOps
- MIT
- Low risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill streamlines the deployment of web applications and APIs to an existing Azure Kubernetes Service (AKS) cluster. It performs automated framework detection to identify the application stack, generates appropriate Dockerfiles and Kubernetes manifests, and validates the configuration against AKS Deployment Safeguards. The process includes verification steps to ensure the application is correctly deployed and configured for the target environment.
What it does
- Detects application frameworks and sub-frameworks from project signal files.
- Automatically generates Dockerfiles and Kubernetes manifests based on detected project requirements.
- Validates configurations against AKS Deployment Safeguards (DS001–DS013).
- Resolves base image tags using floating major versions to maintain security and stability.
- Detects application ports and health endpoints to configure Kubernetes probes.
- Provides recovery procedures for deployment failures.
When to use it
- When you need to deploy an existing web application or API to an active AKS cluster.
- When you need to containerize a project for Kubernetes deployment.
- When you need to generate Kubernetes manifests tailored for Azure.
- When your deployment is failing due to AKS Deployment Safeguard checks.
- When setting up CI/CD pipelines for applications running on AKS.
Advantages
- Reduces manual effort in creating container and orchestration configurations.
- Ensures deployments adhere to established AKS Deployment Safeguards.
- Maintains up-to-date base images through automated major version resolution.
- Standardizes health probe and port configuration across different frameworks.
Usage examples
- “Deploy my Express application to the existing AKS cluster.”
- The agent detects the Node.js framework, generates a Dockerfile and Kubernetes manifests, validates them against AKS safeguards, and initiates the deployment.
- “My Spring Boot app deployment is failing AKS safeguard checks.”
- The agent analyzes the current configuration against the DS001-DS013 checklist to identify and resolve the specific safeguard violations.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/microsoft/azure-kubernetes-app-deploy/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip azure-kubernetes-app-deploy.zip -d .agents/skills
Documentation by Microsoft
Deploy to AKS
Use when: deploying a web app/API to AKS; containerizing for Kubernetes; generating manifests; AKS CI/CD; DS001–DS013 failures.
Not for: provisioning clusters (azure-kubernetes), AKS Automatic readiness (azure-kubernetes-automatic-readiness), non-AKS targets.
Workflow
Requires: existing AKS cluster, az login, kubectl configured. Follow phases/quick-deploy.md. On failure: references/rollback.md.
References
detection.md — framework/port/health detection
safeguards.md — DS001-DS013 checklist
workload-identity.md — Workload Identity setup
rollback.md — recovery procedures
base-images.md — base image policy and
<LATEST_STABLE_*>resolution
Knowledge Packs
Load knowledge-packs/frameworks/<framework>.md per detected framework. Available: spring-boot, express, nextjs, fastapi, django, nestjs, aspnet-core, go, flask
Templates
templates/ (dockerfiles/, k8s/, github-actions/, mermaid/).
Files
- ATTRIBUTION.mdAdded by AutoGineer1.0 KiB
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md2.0 KiB
- knowledge-packs/frameworks/aspnet-core.md7.3 KiB
- knowledge-packs/frameworks/django.md6.0 KiB
- knowledge-packs/frameworks/express.md6.7 KiB
- knowledge-packs/frameworks/fastapi.md5.8 KiB
- knowledge-packs/frameworks/flask.md6.2 KiB
- knowledge-packs/frameworks/go.md6.8 KiB
- knowledge-packs/frameworks/nestjs.md6.7 KiB
- knowledge-packs/frameworks/nextjs.md7.1 KiB
- knowledge-packs/frameworks/spring-boot.md6.0 KiB
- phases/quick-deploy.md7.8 KiB
- references/base-images.md3.6 KiB
- references/detection.md3.5 KiB
- references/rollback.md2.0 KiB
- references/safeguards.md2.9 KiB
- references/workload-identity.md7.4 KiB
- templates/dockerfiles/dotnet.Dockerfile2.6 KiB
- templates/dockerfiles/dotnet.dockerignore125 B
- templates/dockerfiles/go.Dockerfile2.1 KiB
- templates/dockerfiles/go.dockerignore128 B
- templates/dockerfiles/java.Dockerfile3.0 KiB
- templates/dockerfiles/java.dockerignore156 B
- templates/dockerfiles/node.Dockerfile3.0 KiB
- templates/dockerfiles/node.dockerignore173 B
- templates/dockerfiles/python.Dockerfile2.6 KiB
- templates/dockerfiles/python.dockerignore201 B
- templates/dockerfiles/rust.Dockerfile3.2 KiB
- templates/dockerfiles/rust.dockerignore87 B
- templates/github-actions/deploy.yml7.4 KiB
- templates/k8s/configmap.yaml1.0 KiB
- templates/k8s/deployment.yaml3.4 KiB
- templates/k8s/gateway.yaml1.5 KiB
- templates/k8s/hpa.yaml1.4 KiB
- templates/k8s/httproute.yaml1.3 KiB
- templates/k8s/ingress.yaml1.9 KiB
- templates/k8s/namespace.yaml734 B
- templates/k8s/networkpolicy.yaml1.6 KiB
- templates/k8s/pdb.yaml758 B
- templates/k8s/service.yaml864 B
- templates/k8s/serviceaccount.yaml1.4 KiB
- templates/mermaid/architecture-diagram.md1.6 KiB
- templates/mermaid/summary-dashboard.md1.7 KiB
knowledge-packs/frameworks/aspnet-core.md
ASP.NET Core Knowledge Pack
Applies to: Projects detected with
*.csprojcontainingMicrosoft.NET.Sdk.Webor referencingMicrosoft.AspNetCore.*packages
Quick Reference
| Property | Value |
|---|---|
| Signal files | *.csproj with Microsoft.NET.Sdk.Web or Microsoft.AspNetCore.* |
| Default port | 8080 (.NET 8+) |
| Health path | /healthz + /ready |
| Base template | templates/dockerfiles/dotnet.Dockerfile (+ references/base-images.md) |
Health Endpoints
ASP.NET Core has built-in health check middleware via Microsoft.Extensions.Diagnostics.HealthChecks:
| Endpoint | Purpose | Probe Type |
|---|---|---|
/healthz | Overall health | livenessProbe |
/ready | Dependency readiness | readinessProbe |
Required configuration
In Program.cs:
var builder = WebApplication.CreateBuilder(args);
// Register health checks
builder.Services.AddHealthChecks()
.AddNpgSql(builder.Configuration.GetConnectionString("DefaultConnection")!,
name: "postgresql",
tags: new[] { "ready" });
var app = builder.Build();
// Map health endpoints
app.MapHealthChecks("/healthz", new HealthCheckOptions
{
Predicate = _ => false // No dependency checks for liveness
});
app.MapHealthChecks("/ready", new HealthCheckOptions
{
Predicate = check => check.Tags.Contains("ready")
});The AspNetCore.HealthChecks.NpgSql NuGet package provides the PostgreSQL health check. Install with:
dotnet add package AspNetCore.HealthChecks.NpgSqlProbe configuration in Deployment manifest
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
periodSeconds: 15
timeoutSeconds: 3
failureThreshold: 3
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3Note: ASP.NET Core apps start significantly faster than JVM-based frameworks — initialDelaySeconds: 5 is typically sufficient.
Database Profiles
ASP.NET Core uses configuration providers and Entity Framework Core for database access:
| Configuration Source | Activation | Typical Usage |
|---|---|---|
appsettings.json | Default | Local dev with SQLite or LocalDB |
appsettings.Production.json | ASPNETCORE_ENVIRONMENT=Production | Production connection strings |
| Environment variables | Always override file config | AKS deployments |
Environment variables for PostgreSQL on AKS
env:
- name: ASPNETCORE_ENVIRONMENT
value: Production
- name: ConnectionStrings__DefaultConnection
value: "Host={{PG_SERVER_NAME}}.postgres.database.azure.com;Database={{DB_NAME}};Username={{IDENTITY_NAME}};Ssl Mode=Require"The double-underscore (__) in ConnectionStrings__DefaultConnection maps to the : separator in .NET configuration — ConnectionStrings:DefaultConnection.
Workload Identity with Azure.Identity
See references/workload-identity.md for connection patterns. Requires Azure.Identity and Npgsql.EntityFrameworkCore.PostgreSQL packages.
ConfigMap pattern
apiVersion: v1
kind: ConfigMap
metadata:
name: {{APP_NAME}}-config
data:
ASPNETCORE_ENVIRONMENT: "Production"
ConnectionStrings__DefaultConnection: "Host={{PG_SERVER_NAME}}.postgres.database.azure.com;Database={{DB_NAME}};Ssl Mode=Require"
DOTNET_EnableDiagnostics: "0"
DOTNET_RUNNING_IN_CONTAINER: "true"Writable Paths (DS012 Compliance)
When readOnlyRootFilesystem: true is set, ASP.NET Core needs /tmp writable:
Data Protection keys are written to a local directory by default for key persistence
Temporary files from multipart uploads and response buffering use
/tmpEntity Framework compiled models may write to temp directories
Required volume mount
volumes:
- name: tmp
emptyDir: {}
containers:
- name: app
volumeMounts:
- name: tmp
mountPath: /tmpData Protection key persistence
By default, ASP.NET Core Data Protection stores encryption keys in-memory when no persistent path is available, meaning keys are lost on pod restart. This breaks authentication cookies and anti-forgery tokens across pod restarts or in multi-replica deployments.
For production, persist keys to Azure Blob Storage:
builder.Services.AddDataProtection()
.PersistKeysToAzureBlobStorage("<connection-string>", "<container>", "<blob-name>")
.ProtectKeysWithAzureKeyVault(new Uri("<key-vault-uri>"), new DefaultAzureCredential());Alternatively, mount a PVC at a known path and configure:
builder.Services.AddDataProtection()
.PersistKeysToFileSystem(new DirectoryInfo("/keys"));Resource Sizing
ASP.NET Core on the .NET runtime is efficient but needs moderate memory for the CLR.
| Resource | Request | Limit |
|---|---|---|
| CPU | 200m | 500m |
| Memory | 256Mi | 512Mi |
Port Configuration
Default port: 8080 (since .NET 8; previously 80 in .NET 7 and earlier)
Env var override:
ASPNETCORE_URLS=http://+:8080orASPNETCORE_HTTP_PORTS=8080Code override:
builder.WebHost.UseUrls("http://+:8080")inProgram.cs
The port change from 80 to 8080 in .NET 8 aligns with non-root container best practices — port 80 requires elevated privileges. Set DOTNET_EnableDiagnostics=0 to disable diagnostic pipes that require writable paths not available in read-only filesystems.
Build Commands
| Variant | Build Command | Output |
|---|---|---|
| Framework-dependent | dotnet publish -c Release -o ./publish | ./publish/<app-name>.dll — requires .NET runtime on target |
| Self-contained | dotnet publish -c Release --self-contained -o ./publish | ./publish/<app-name> — includes .NET runtime |
| Single-file | dotnet publish -c Release --self-contained -p:PublishSingleFile=true -o ./publish | Single executable binary |
The -c Release flag enables compiler optimizations and disables debug symbols — always use it for production builds.
EF Core Migrations
Run dotnet ef database update as an init container — never in the Dockerfile build stage (no database access) and never in the entrypoint (race condition when multiple replicas start simultaneously).
Common Issues on AKS
| Issue | Symptom | Fix |
|---|---|---|
| Kestrel bound to port 80 | CrashLoopBackOff — permission denied binding to port 80 as non-root | Set ASPNETCORE_HTTP_PORTS=8080 or upgrade to .NET 8+ which defaults to 8080 |
| Data Protection keys lost on restart | Users logged out after pod restart, anti-forgery token validation failures | Persist keys to Azure Blob Storage or a PVC — do not rely on in-memory default |
| EF Core migrations not applied | NpgsqlException: relation "..." does not exist | Run dotnet ef database update as an init container or at startup with Database.Migrate() |
| Image too large (>500MB) | Slow pulls, high ACR storage | Use self-contained + trimmed publish with the runtime-deps Alpine base image |
| HTTPS redirect loop behind gateway | Infinite 307/308 redirects, ERR_TOO_MANY_REDIRECTS | Disable HTTPS redirection in Program.cs when behind a TLS-terminating gateway — configure ForwardedHeaders middleware instead |
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Microsoft
- Publisher
- Microsoft (Official)
- Source
- microsoft/skills · .github/plugins/azure-skills/skills/azure-kubernetes/azure-kubernetes-app-deploy · commit 0696600
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from .github/plugins/azure-skills/LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Also distributed in
- microsoft/azure-skills
AutoGineer is not affiliated with or endorsed by Microsoft.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download azure-kubernetes-app-deploy.zip