Generated banner for Azure Kubernetes App Deploy
Generated logo for Azure Kubernetes App Deploy

Azure Kubernetes App Deploy

MicrosoftOfficialCreated by Microsoft

  • Skill
  • Tool integration
  • Cloud and DevOps
  • MIT
  • Low risk

From the author

Use when deploying an existing web application or API to an already-running Azure Kubernetes Service cluster. Detects the framework, generates a Dockerfile and Kubernetes manifests, validates against AKS Deployment Safeguards, and deploys with verification. WHEN: deploy app to AKS, deploy to existing AKS cluster, containerize app for Kubernetes, generate K8s manifests for Azure, set up CI/CD for AKS, my AKS deployment is failing safeguard checks, I have a Django/Express/Spring Boot app to run on AKS. DO NOT USE FOR: creating or provisioning an AKS cluster (use azure-kubernetes), assessing migration to AKS Automatic (use azure-kubernetes-automatic-readiness), or deploying to non-AKS targets like Web Apps, Container Apps, or Functions.
— the description by Microsoft

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

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/microsoft/azure-kubernetes-app-deploy/download
  2. Unzip 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

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

knowledge-packs/frameworks/nextjs.md

Next.js Knowledge Pack

Applies to: Projects detected with package.json containing next as a dependency

Quick Reference

PropertyValue
Signal filespackage.json containing next
Default port3000
Health path/api/health
Base templatetemplates/dockerfiles/node.Dockerfile (+ references/base-images.md)

Standalone Output (Required)

Next.js standalone output mode is critical for containerized deployments — it reduces the image from ~1GB to ~100MB by bundling only the files needed to run the server. Without it, the build copies all of node_modules into the image.

Enable it in next.config.js (or next.config.mjs / next.config.ts):

/** @type {import('next').NextConfig} */
const nextConfig = {
  output: 'standalone',
};

module.exports = nextConfig;

The build then produces .next/standalone/server.js, a self-contained HTTP server that does not require the next CLI at runtime.

Three required COPY targets

The Dockerfile runtime stage needs exactly three items from the build stage:

  1. public/ — static assets served directly

  2. .next/standalone/ — the standalone server and its bundled dependencies

  3. .next/static/ — client-side JS/CSS bundles (must be copied into .next/static inside the standalone directory, not alongside it)

Hostname binding

Set HOSTNAME="0.0.0.0" as a runtime environment variable (required for Next.js 14+). The standalone server.js reads this variable on startup to listen on all interfaces. Without it, the server binds to 127.0.0.1 and Kubernetes probes fail.

Set NEXT_TELEMETRY_DISABLED=1 in both the build stage and the runtime stage to prevent outbound telemetry calls to telemetry.nextjs.org from the container.


Health Endpoints

Next.js does not provide health endpoints out of the box. Add a custom API route — the implementation depends on whether the project uses App Router or Pages Router.

App Router (Next.js 13.4+)

Create app/api/health/route.ts:

import { NextResponse } from 'next/server';

export async function GET() {
  return NextResponse.json({ status: 'UP' });
}

export const dynamic = 'force-dynamic';

The force-dynamic export prevents Next.js from statically caching the health response at build time.

Pages Router

Create pages/api/health.ts:

import type { NextApiRequest, NextApiResponse } from 'next';

export default function handler(req: NextApiRequest, res: NextApiResponse) {
  res.status(200).json({ status: 'UP' });
}
Probe configuration in Deployment manifest
livenessProbe:
  httpGet:
    path: /api/health
    port: 3000
  initialDelaySeconds: 10
  periodSeconds: 15
  timeoutSeconds: 3
  failureThreshold: 3
readinessProbe:
  httpGet:
    path: /api/health
    port: 3000
  initialDelaySeconds: 10
  periodSeconds: 10
  timeoutSeconds: 3
  failureThreshold: 3

Note: Next.js standalone server starts in 1–3 seconds, but initialDelaySeconds: 10 provides a safe margin for cold starts and environment variable resolution. No startupProbe is needed unless the app performs heavy server-side initialization.


Database Profiles

Next.js apps commonly use Prisma, Drizzle, or pg (node-postgres) for database access. All follow the DATABASE_URL connection string pattern:

LibraryConnection PatternConfig Property
Prismadatasource db { url = env("DATABASE_URL") } in schema.prismaDATABASE_URL
Drizzlepostgres(process.env.DATABASE_URL!) or drizzle(process.env.DATABASE_URL!)DATABASE_URL
pg (node-postgres)new Pool({ connectionString: 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, Next.js needs two writable paths:

  • /tmp — general-purpose temporary file storage

  • /app/.next/cache — ISR (Incremental Static Regeneration) page cache and next/image optimization cache; without this, ISR and image optimization fail with EROFS: read-only file system errors

Required volume mounts
volumes:
  - name: tmp
    emptyDir: {}
  - name: next-cache
    emptyDir: {}
containers:
  - name: app
    volumeMounts:
      - name: tmp
        mountPath: /tmp
      - name: next-cache
        mountPath: /app/.next/cache

Both mounts are required. Missing the cache mount is the most common cause of ISR failures on AKS.


Resource Sizing

Next.js SSR needs more memory than a plain API due to React rendering. Static-only exports can use lower limits.

ResourceRequestLimit
CPU200m1000m
Memory256Mi512Mi

Port Configuration

  • Default port: 3000

  • Env var override: PORT=3000

  • Hostname binding: HOSTNAME="0.0.0.0" (Next.js 14+)

The standalone server.js reads the PORT and HOSTNAME environment variables automatically. No code changes are needed to customize the port.


Build Commands

ScenarioBuild CommandOutputEntrypoint
Standalone build (required)npm run build with output: 'standalone'.next/standalone/server.jsnode server.js
Standard build (not for containers)npm run build.next/ (full)next start

Always use the standalone build for container deployments. The standard build requires the full node_modules directory at runtime, resulting in images 5–10x larger.

sharp for next/image

If the app uses next/image, install sharp explicitly in the runtime stage. Without it, Next.js falls back to the slower squoosh library and image optimization may fail under load.


Common Issues on AKS

IssueSymptomFix
Image too large without standaloneImage > 1GB, slow pulls from ACRSet output: 'standalone' in next.config.js — reduces image to ~100MB
Static assets 404CSS/JS files return 404 after deploymentEnsure .next/static is copied to .next/static in the runtime stage (not into standalone/.next/static)
ISR fails with read-only filesystemEROFS: read-only file system when revalidating pagesMount emptyDir volume at /app/.next/cache — ISR writes regenerated pages to the cache directory
next/image optimization failsImages return 500 or timeout under loadInstall sharp explicitly; the standalone build may not include it automatically
Env vars undefined (NEXT_PUBLIC_ prefix)Client-side code sees undefined for environment variablesNEXT_PUBLIC_ vars are inlined at build time, not runtime; set them as build args in the Dockerfile or use runtime config via publicRuntimeConfig
Telemetry calls from containerUnexpected outbound network requests to telemetry.nextjs.orgSet NEXT_TELEMETRY_DISABLED=1 in both the build stage and runtime stage of the Dockerfile

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