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/nestjs.md
NestJS Knowledge Pack
Applies to: Projects detected with
package.jsoncontaining@nestjs/coreas a dependency
Quick Reference
| Property | Value |
|---|---|
| Signal files | package.json containing @nestjs/core |
| Default port | 3000 |
| Health path | /health |
| Base template | templates/dockerfiles/node.Dockerfile (+ references/base-images.md) |
Signal Handling
NestJS lifecycle events (OnModuleDestroy, BeforeApplicationShutdown) fire only when shutdown hooks are enabled. Call app.enableShutdownHooks() in main.ts so SIGTERM from Kubernetes triggers graceful teardown of HTTP connections, database pools, and message queue consumers:
const app = await NestFactory.create(AppModule);
app.enableShutdownHooks();
await app.listen(process.env.PORT || 3000);The base template uses dumb-init as the entrypoint to forward SIGTERM to the Node process when running as PID 1. Both are required: dumb-init routes the signal, enableShutdownHooks() handles it.
Health Endpoints
NestJS provides health checks via the @nestjs/terminus package.
Installation
npm install @nestjs/terminusHealthModule
import { Module } from '@nestjs/common';
import { TerminusModule } from '@nestjs/terminus';
import { HealthController } from './health.controller';
@Module({
imports: [TerminusModule],
controllers: [HealthController],
})
export class HealthModule {}Register HealthModule in AppModule imports.
HealthController with database check
import { Controller, Get } from '@nestjs/common';
import { HealthCheck, HealthCheckService, TypeOrmHealthIndicator } from '@nestjs/terminus';
@Controller('health')
export class HealthController {
constructor(private health: HealthCheckService, private db: TypeOrmHealthIndicator) {}
@Get()
@HealthCheck()
check() {
return this.health.check([() => this.db.pingCheck('database')]);
}
}For Prisma, use PrismaHealthIndicator; for MikroORM, use MikroOrmHealthIndicator. If no database is used, omit the indicator and return a simple status check.
Probe configuration in Deployment manifest
livenessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 5
periodSeconds: 15
timeoutSeconds: 3
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 3000
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3Note: NestJS apps start quickly (typically under 2 seconds), so initialDelaySeconds: 5 is sufficient. If the app performs heavy initialization (e.g., loading large config, running migrations), increase to 10–15s or add a startupProbe.
Database Profiles
NestJS supports multiple ORM libraries. The standard pattern is a connection string or individual env vars injected via environment variables:
| ORM | Connection Pattern | Config Property |
|---|---|---|
| TypeORM | TypeOrmModule.forRoot({ url: process.env.DATABASE_URL }) | DATABASE_URL |
| Prisma | datasource db { url = env("DATABASE_URL") } in schema.prisma | DATABASE_URL |
| MikroORM | MikroOrmModule.forRoot({ clientUrl: process.env.DATABASE_URL }) | DATABASE_URL |
| Sequelize | SequelizeModule.forRoot({ uri: process.env.DATABASE_URL }) | DATABASE_URL |
Environment variables for PostgreSQL on AKS
env:
- name: DATABASE_URL
value: "postgresql://{{IDENTITY_NAME}}@{{PG_SERVER_NAME}}.postgres.database.azure.com:5432/{{DB_NAME}}?sslmode=require"For Workload Identity, see references/workload-identity.md.
Writable Paths (DS012 Compliance)
When readOnlyRootFilesystem: true is set, NestJS apps need only /tmp writable:
Multipart uploads (e.g.,
@nestjs/platform-expresswithmulter) stage files to/tmpLogging libraries that buffer to disk use
/tmpnode_modulesanddist/are read-only at runtime
Required volume mount
volumes:
- name: tmp
emptyDir: {}
containers:
- name: app
volumeMounts:
- name: tmp
mountPath: /tmpResource Sizing
NestJS is Node.js-based and single-threaded. Similar to Express/Fastify.
| Resource | Request | Limit |
|---|---|---|
| CPU | 100m | 500m |
| Memory | 128Mi | 256Mi |
Port Configuration
Default port: 3000
Env var override:
PORT=3000Code pattern:
await app.listen(process.env.PORT || 3000)inmain.ts
NestJS (via Express adapter) binds to 0.0.0.0 by default. For Fastify adapter, pass '0.0.0.0' explicitly: await app.listen(process.env.PORT || 3000, '0.0.0.0').
Build Commands
| Scenario | Build Command | Output | Entrypoint |
|---|---|---|---|
| Standard | npm run build (invokes nest build) | dist/ | node dist/main.js |
| Monorepo | npx nest build <app-name> | dist/apps/<app-name>/ | node dist/apps/<app-name>/main.js |
| SWC compiler | nest build --builder swc | dist/ | node dist/main.js |
The SWC compiler is ~20x faster than the default TypeScript compiler for large projects. Enable it by installing @swc/cli @swc/core and passing --builder swc or setting "builder": "swc" in nest-cli.json. SWC does not perform type checking — run tsc --noEmit separately in CI if type safety is required.
Common Issues on AKS
| Issue | Symptom | Fix |
|---|---|---|
| SIGTERM not handled | Pod takes 30s to terminate (killed by SIGKILL after grace period) | Call app.enableShutdownHooks() in main.ts so NestJS lifecycle events (OnModuleDestroy, BeforeApplicationShutdown) fire on SIGTERM; also use dumb-init as the container entrypoint |
| TypeORM connection pool exhaustion | Error: Connection pool exhausted or ETIMEDOUT under load | Set extra: { max: 10 } in TypeORM config to limit pool size; Azure PG Flexible Server has a connection limit based on SKU — monitor with pg_stat_activity |
| Circular dependency | Error: Nest cannot create the ... instance at startup | Use forwardRef(() => Module) in module imports; refactor shared logic into a dedicated module to break the cycle |
| dist/ not included in image | Error: Cannot find module '/app/dist/main.js' at container start | Ensure COPY --from=build /app/dist ./dist is present in the Dockerfile runtime stage; verify nest build runs successfully in the build stage |
| Global prefix breaks probes | Health probes return 404 after setting app.setGlobalPrefix('api') | The health endpoint moves to /api/health — update probe paths in the Deployment manifest, or exclude the health controller from the global prefix using app.setGlobalPrefix('api', { exclude: ['health'] }) |
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