skills/kubernetes-deployment-automation/SKILL.md
Automate Kubernetes deployment lifecycle: kubectl rollouts, GitOps sync (ArgoCD/Flux), namespace and secret management, rollout monitoring, and failed deployment troubleshooting. Use when deploying manifests to clusters, debugging stuck rollouts, setting up GitOps pipelines, or managing multi-environment promotion. NOT for: generating K8s manifests (use kubernetes-manifest-generator), blue-green/canary traffic shifting (use blue-green-deployment-orchestrator), cluster provisioning (use terraform-module-builder), CI/CD pipeline config (use github-actions-pipeline-builder).
npx skillsauth add curiositech/windags-skills kubernetes-deployment-automationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Operational expertise for the deployment lifecycle — from kubectl apply to production-verified rollout. Owns Day 2 operations: deploying manifests, monitoring rollouts, troubleshooting failures, managing secrets/namespaces, and GitOps workflows.
Use for:
NOT for:
kubernetes-manifest-generatorblue-green-deployment-orchestratorterraform-module-buildergithub-actions-pipeline-builderflowchart TD
START[Deployment Request] --> ASSESS{What stage?}
ASSESS -->|New deployment| PREFLIGHT[Pre-flight Checks]
ASSESS -->|Stuck rollout| TROUBLESHOOT[Troubleshoot]
ASSESS -->|Setup GitOps| GITOPS[GitOps Setup]
ASSESS -->|Promote env| PROMOTE[Promotion Pipeline]
PREFLIGHT --> NS[Namespace exists?]
NS -->|No| CREATE_NS[Create namespace + RBAC]
NS -->|Yes| SECRETS[Secrets provisioned?]
CREATE_NS --> SECRETS
SECRETS -->|No| PROVISION_SECRETS[Provision secrets]
SECRETS -->|Yes| DEPS[Dependencies ready?]
PROVISION_SECRETS --> DEPS
DEPS -->|No| WAIT_DEPS[Wait / deploy deps first]
DEPS -->|Yes| DEPLOY[Deploy]
DEPLOY --> METHOD{Deployment method?}
METHOD -->|kubectl| KUBECTL[kubectl apply -f / rollout]
METHOD -->|Helm| HELM[helm upgrade --install]
METHOD -->|ArgoCD| ARGOCD[argocd app sync]
METHOD -->|Flux| FLUX[flux reconcile]
KUBECTL --> VERIFY[Verify Rollout]
HELM --> VERIFY
ARGOCD --> VERIFY
FLUX --> VERIFY
VERIFY --> HEALTHY{Healthy?}
HEALTHY -->|Yes| DONE[Deployment Complete]
HEALTHY -->|No| TROUBLESHOOT
TROUBLESHOOT --> TRIAGE{Failure type?}
TRIAGE -->|ImagePullBackOff| IMG[Check image tag, registry auth, pull policy]
TRIAGE -->|CrashLoopBackOff| CRASH[Check logs, resource limits, probes]
TRIAGE -->|Pending| PENDING[Check node resources, PVC, scheduling]
TRIAGE -->|OOMKilled| OOM[Increase memory limits, check for leaks]
TRIAGE -->|Timeout| TIMEOUT[Check readiness probe, startup time]
IMG --> DECIDE_ROLLBACK{Fixable quickly?}
CRASH --> DECIDE_ROLLBACK
PENDING --> DECIDE_ROLLBACK
OOM --> DECIDE_ROLLBACK
TIMEOUT --> DECIDE_ROLLBACK
DECIDE_ROLLBACK -->|Yes| FIX[Fix and redeploy]
DECIDE_ROLLBACK -->|No| ROLLBACK[kubectl rollout undo]
FIX --> DEPLOY
ROLLBACK --> DONE
# Dry-run first — always
kubectl apply -f manifests/ --dry-run=server
# Apply with record for rollback
kubectl apply -f manifests/
# Watch rollout
kubectl rollout status deployment/<name> -n <ns> --timeout=300s
When to use: Simple deployments, scripted pipelines, single-cluster.
# Diff before upgrade (requires helm-diff plugin)
helm diff upgrade <release> <chart> -f values-prod.yaml -n <ns>
# Deploy with atomic (auto-rollback on failure)
helm upgrade --install <release> <chart> \
-f values-prod.yaml \
-n <ns> \
--atomic \
--timeout 5m \
--wait
When to use: Parameterized deployments, multiple environments from one chart.
# Create application
argocd app create <name> \
--repo <git-url> \
--path <manifest-path> \
--dest-server https://kubernetes.default.svc \
--dest-namespace <ns> \
--sync-policy automated \
--auto-prune \
--self-heal
# Sync with prune
argocd app sync <name> --prune
# Check health
argocd app get <name>
When to use: Multi-cluster, audit trail required, team deployments.
# Bootstrap Flux
flux bootstrap github \
--owner=<org> \
--repository=<repo> \
--path=clusters/<cluster> \
--personal
# Create Kustomization
flux create kustomization <name> \
--source=GitRepository/<repo> \
--path=<manifest-path> \
--prune=true \
--interval=5m
# Force reconcile
flux reconcile kustomization <name>
When to use: Lightweight GitOps, multi-tenant clusters, prefer pull-based.
Always verify after deploy. Minimum checks:
# 1. Rollout status
kubectl rollout status deployment/<name> -n <ns> --timeout=300s
# 2. Pod health
kubectl get pods -n <ns> -l app=<name> -o wide
# 3. Recent events (failures surface here)
kubectl events -n <ns> --for deployment/<name> --types=Warning
# 4. Endpoint readiness
kubectl get endpoints <service-name> -n <ns>
# 5. Logs from new pods (spot crashes early)
kubectl logs -n <ns> -l app=<name> --since=2m --tail=50
kubectl apply Without Dry-RunNovice: "Just apply it, YOLO"
Expert: Always --dry-run=server first. Server-side dry-run catches quota violations, admission webhook rejections, and schema errors that client-side misses.
Timeline: 2022: client-side dry-run was common → 2024+: server-side dry-run is standard (catches real admission issues).
--atomicNovice: helm upgrade then manually check and rollback on failure
Expert: --atomic auto-rolls back on any failure. Without it, you get half-deployed states where some resources updated and others didn't, requiring manual cleanup.
Novice: "The manifest generator already set them"
Expert: Verify limits match the target environment. Dev limits in prod cause OOMKills. Run kubectl describe node to check available capacity before deploying resource-heavy workloads.
Novice: Base64-encoded secrets committed to the repo
Expert: Base64 is encoding, not encryption. Use Sealed Secrets, SOPS, External Secrets Operator, or Vault. GitOps repos should contain SealedSecret or ExternalSecret resources, never plain Secret.
Detection: grep -r "kind: Secret" manifests/ | grep -v SealedSecret | grep -v ExternalSecret
flowchart LR
DEV[Dev Cluster] -->|Tests pass| STAGE[Staging Cluster]
STAGE -->|Smoke tests + soak| PROD[Production Cluster]
subgraph "Promotion Gate"
TESTS[Automated tests]
APPROVAL[Manual approval]
METRICS[Metric check]
end
DEV --> TESTS
TESTS --> STAGE
STAGE --> APPROVAL
APPROVAL --> METRICS
METRICS --> PROD
Pattern: Same manifests, different values per environment.
| Approach | How | Best For |
|----------|-----|----------|
| Kustomize overlays | base/ + overlays/{dev,staging,prod} | Simple, native K8s |
| Helm values | values-dev.yaml, values-prod.yaml | Parameterized charts |
| ArgoCD ApplicationSets | Generator matrix across clusters | Multi-cluster GitOps |
| Flux Kustomization | Per-cluster paths in fleet repo | Pull-based multi-cluster |
references/troubleshooting-guide.md — Consult when diagnosing specific K8s failure states (ImagePullBackOff, CrashLoopBackOff, eviction, node pressure)references/gitops-patterns.md — Consult when setting up ArgoCD or Flux from scratch, or designing repo structure for GitOpsreferences/rollback-strategies.md — Consult when deciding between revision rollback, Helm rollback, and GitOps revertdata-ai
license: Apache-2.0 NOT for unrelated tasks outside this domain.
development
Use when designing caching strategies (cache-aside, write-through, write-behind), implementing distributed locks, building rate limiters, leaderboards, real-time streams (XADD/consumer groups), pub/sub, or tuning eviction policies. Triggers: thundering-herd on cache miss, dogpile on key expiry, Redlock vs SET-NX-PX choice, sliding-window rate limiter, hot-key on a single cluster slot, big-key blowup, MULTI/EXEC across slots, KEYS in production. NOT for Redis Cluster operations/admin (different domain), embedded KV (SQLite, leveldb), in-process LRU caches, or Memcached.
tools
Drawing the `'use client'` boundary correctly in React Server Components apps (Next.js App Router, RSC frameworks) — leaf-pushing, slot composition, serialization rules, and environment poisoning prevention. Grounded in react.dev and Next.js 16 docs.
development
Use when designing rate limiting for an API, choosing between token bucket / sliding window / leaky bucket / fixed window, implementing it in Redis, deciding edge (Cloudflare/Upstash) vs origin enforcement, sizing per-user vs per-IP vs per-endpoint quotas, returning the right 429 response with Retry-After, or fixing the boundary-burst bug in fixed-window limiters. Triggers: 429 too many requests, INCR + EXPIRE, ZADD + ZREMRANGEBYSCORE + ZCARD, X-RateLimit-Remaining header, Cloudflare WAF rate limiting rules, Upstash @upstash/ratelimit, leaky bucket shaping vs policing, distributed rate limiter consistency. NOT for DDoS mitigation specifically (different scale), CAPTCHA / bot management, full WAF design, or per-user quota billing.