K8s

From tinh2/skills-hub-registry · View interactive version

K8s is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Generate production-grade Kubernetes manifests — Deployments with probes and security contexts, Services, Ingress with TLS, HPA, PDB, NetworkPolicy, ConfigMaps, Secrets — with optional Helm charts, Kustomize overlays, Istio mesh, and ArgoCD GitOps

How to use this skill

Skill file

You are in AUTONOMOUS MODE. Do NOT ask questions. Do NOT pause for confirmation.

Execute every phase below in sequence, making decisions based on what you find.

============================================================

PHASE 0 — INPUT

============================================================

$ARGUMENTS may contain:

============================================================

PHASE 1 — APPLICATION ANALYSIS

============================================================

Scan the project to determine Kubernetes requirements:

Container image:

Ports and protocols:

Resource requirements — estimate based on stack:

Dependencies:

Health endpoints:

Environment variables:

============================================================

PHASE 2 — GENERATE NAMESPACE AND RBAC

============================================================

Create k8s/namespace.yml with standard Kubernetes labels:

Create k8s/serviceaccount.yml with matching labels.

============================================================

PHASE 3 — GENERATE CORE MANIFESTS

============================================================

Create all manifests in k8s/ directory (or helm/{app-name}/templates/ if --helm).

Deployment (k8s/deployment.yml):

Service (k8s/service.yml):

Ingress (k8s/ingress.yml, if domain provided):

HPA (k8s/hpa.yml):

PodDisruptionBudget (k8s/pdb.yml):

ConfigMap (k8s/configmap.yml):

Secret (k8s/secret.yml):

NetworkPolicy (k8s/networkpolicy.yml):

============================================================

PHASE 4 — HELM CHART (if --helm)

============================================================

Generate Helm chart structure under helm/{app-name}/:

values.yaml — parameterize all environment-specific values:

_helpers.tpl — standard helper templates: fullname, name, chart, labels, selectorLabels

============================================================

PHASE 5 — KUSTOMIZE (if --kustomize)

============================================================

Generate Kustomize structure under k8s/:

============================================================

PHASE 6 — ISTIO / SERVICE MESH (if --istio)

============================================================

============================================================

PHASE 7 — ARGOCD (if --argocd)

============================================================

Generate argocd/application.yml:

============================================================

SELF-HEALING VALIDATION (max 2 iterations)

============================================================

After completing deployment/infrastructure changes, validate:

  1. Verify all generated files are syntactically valid (YAML, JSON, HCL, Dockerfile).
  2. Run validation commands if available (terraform validate, docker build --check, kubectl dry-run).
  3. Verify no secrets, credentials, or sensitive values are hardcoded.
  4. If validation fails, diagnose and fix the specific syntax or config error.
  5. Repeat up to 2 iterations.

IF STILL FAILING after 2 iterations:

============================================================

OUTPUT

============================================================

## Kubernetes Manifests Generated

### Files Created
{list all generated files with one-line descriptions}

### Resource Summary
| Resource | Name | Key Settings |
|----------|------|--------------|
| Namespace | {ns} | -- |
| Deployment | {name} | {replicas} replicas, {memory} memory |
| Service | {name} | ClusterIP, port {port} |
| Ingress | {name} | {domain}, TLS enabled |
| HPA | {name} | {min}-{max} replicas |
| PDB | {name} | minAvailable: 1 |

### Apply Commands
kubectl apply -f k8s/namespace.yml
kubectl apply -f k8s/

### Pre-Apply Checklist
- [ ] Replace placeholder secrets in k8s/secret.yml
- [ ] Verify container image is pushed to registry
- [ ] Ensure namespace exists in target cluster
- [ ] Configure cert-manager ClusterIssuer if using TLS
- [ ] Review resource limits for your workload

============================================================

NEXT STEPS

============================================================

  1. Build and push the container image (run deploy/docker if needed)
  2. Replace placeholder secrets with real values (or use external secrets operator)
  3. Apply manifests to a dev cluster first: kubectl apply -f k8s/ -n {namespace}
  4. Verify pods are running: kubectl get pods -n {namespace}
  5. Check probes: kubectl describe pod -n {namespace}
  6. Consider GitOps with ArgoCD or Flux for automated deployments (use --argocd)

============================================================

SELF-EVOLUTION TELEMETRY

============================================================

After producing output, record execution metadata for the /evolve pipeline.

Check if a project memory directory exists:

Entry format:

### /k8s — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}

Only log if the memory directory exists. Skip silently if not found.

Keep entries concise — /evolve will parse these for skill improvement signals.

============================================================

DO NOT

============================================================

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.