Container Build, CI/CD, and Kubernetes Deploys

Production-ready Dockerfiles, CI/CD pipelines, and Kubernetes manifests with safe rollouts, rollback paths, and hardening built in.

by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“Set up CI/CD for our Node app on Kubernetes.”
Beforegeneric AI agent
Setting up CI/CD for a Node app on Kubernetes involves several components. You'll need to containerize your app with Docker, set up a CI pipeline to build and test on every commit, and then deploy to your Kubernetes cluster. There are various tools you could use like GitHub Actions, GitLab CI, or Jenkins. What's your current infrastructure setup, and do you have a preference on which CI/CD platform to use?
Afterwith Container Build, CI/CD, and Kubernetes Deploys
CI/CD PIPELINE: NODE + K8S

DOCKERFILE
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build

FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s \
  CMD node -e "require('http').get('http://localhost:3000/health', (r) => {if (r.statusCode !== 200) throw new Error(r.statusCode)})"
CMD exec node dist/server.js

Image size: 180MB (multi-stage optimized)
Scan: Trivy for CVEs before push

GITHUB ACTIONS WORKFLOW (.github/workflows/deploy.yml)
Trigger: Push to main branch

Stage 1: BUILD (4 min)
✓ Checkout code
✓ Run npm test (Jest, 12 test suites)
✓ Build Docker image
✓ Push to registry (ghcr.io)
✓ SBOM generation (CycloneDX)

Stage 2: SECURITY SCAN (2 min)
✓ Trivy scan for CVE-high
✓ SAST scan (CodeQL)
✓ DAST: Light smoke test against image
✓ Block deployment if critical vulns found

Stage 3: DEPLOY (3 min)
✓ Update K8s manifests with new image tag
✓ Apply via kubectl apply (GitOps)
✓ Rollout status check (await 5 min timeout)
✓ Post-deploy smoke tests (hit /health endpoint)
✓ Notify Slack on success/failure

Total pipeline time: 9 minutes end-to-end

KUBERNETES MANIFESTS (k8s/)

Deployment (node-app-deploy.yaml)
apiVersion: apps/v1
kind: Deployment
metadata:
  name: node-app
spec:
  replicas: 3
  selector:
    matchLabels:
      app: node-app
  template:
    metadata:
      labels:
        app: node-app
    spec:
      containers:
      - name: app
        image: ghcr.io/myorg/node-app:TAG
        ports:
        - containerPort: 3000
        env:
        - name: NODE_ENV
          value: "production"
        - name: DB_URL
          valueFrom:
            secretKeyRef:
              name: db-secret
              key: url
        livenessProbe:
          httpGet:
            path: /health
            port: 3000
          initialDelaySeconds: 10
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /ready
            port: 3000
          initialDelaySeconds: 5
          periodSeconds: 5
        resources:
          requests:
            memory: "256Mi"
            cpu: "100m"
          limits:
            memory: "512Mi"
            cpu: "500m"

Service (node-app-service.yaml)
apiVersion: v1
kind: Service
metadata:
  name: node-app-svc
spec:
  type: LoadBalancer
  selector:
    app: node-app
  ports:
  - protocol: TCP
    port: 80
    targetPort: 3000

Ingress (node-app-ingress.yaml)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: node-app-ingress
spec:
  rules:
  - host: api.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: node-app-svc
            port:
              number: 80

Rolling Update Strategy:
• Max surge: 1 replica
• Max unavailable: 0 (zero-downtime deployments)
• Rollback: Automatic if readiness probe fails for 2 minutes

MONITORING & OBSERVABILITY
✓ Prometheus scrape config for app metrics
✓ Logging: stdout collected by ELK/Loki
✓ Alerts: Slack notification on deployment failure or pod crash
✓ Dashboard: Grafana for deployment frequency, error rate, latency

INCIDENT RESPONSE RUNBOOK
If deployment fails:
  1. Check pod logs: kubectl logs -f pod/node-app-xxxxx
  2. Inspect last 2 commits for breaking changes
  3. Automatic rollback kicks in if probe fails
  4. Escalation: Slack alert tagged to on-call

DELIVERABLES
✓ Dockerfile (optimized, scanned)
✓ GitHub Actions workflow (ready to copy/paste)
✓ 3 K8s manifests (deployment, service, ingress)
✓ Local testing: docker-compose.yml for dev simulation
✓ Runbook: Troubleshooting guide for common issues

About this skill

Your image is 1.5GB, every commit reinstalls dependencies, and pods drop requests on every deploy. Copy-pasted configs miss the small things that cause outages: a liveness probe that checks the database, a CMD that never passes SIGTERM to the app, and a pipeline that rebuilds the image for prod so prod runs something nobody tested. This skill builds and reviews the whole path from git push to healthy pods, and fixes those failure modes by default.

What it does

  • Writes multi-stage Dockerfiles with cache-correct layer order, a non-root numeric UID, exec-form signal handling, and BuildKit secret mounts instead of ARG/ENV secrets
  • Builds gated CI/CD pipelines that build the image once, tag it with the git SHA, and promote that same digest through each environment, using OIDC cloud auth and actions pinned to commit SHAs
  • Produces Kubernetes manifests with correctly separated readiness, liveness, and startup probes, preStop drain, sizing guidance for requests and limits, PDBs, and a hardened securityContext
  • Wires GitOps so CI commits the image tag and Argo CD or Flux deploys it, which makes rollback a git revert
  • Flags broken premises before you ship: zero-downtime claims on one replica, breaking migrations during rolling deploys, secrets in YAML, mutable tags
  • Reviews pasted configs as severity-ranked findings with exact fixed lines, and writes incident runbooks that start with mitigation

What you get

Working files that match your existing tools, a short note on each non-obvious setting, and the exact rollback step for every change. Reviews come back as findings ranked by blast radius.

Best for

Backend and full-stack engineers who ship their own services to Kubernetes, small teams without a dedicated platform group, and anyone hardening a deploy path that drops traffic or cannot roll back cleanly.

SKILL.md preview

SKILL.md
---
name: container-cicd-kubernetes-deploys
description: Builds and reviews the path from source code to a running Kubernetes service. Covers hardened multi-stage Dockerfiles, gated CI/CD that builds once and promotes one image digest, Kubernetes manifests with correct probes, resources, and graceful shutdown, GitOps wiring, and rollback runbooks. Use when the user says "containerize this app", "write a GitHub Actions pipeline that deploys to k8s", "review my Dockerfile", "my pods keep restarting", "we drop requests on every deploy", "my image is 1.5GB and builds take forever", "set up Argo CD for this service", or "write a rollback runbook".
---

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →