Memory

Kubernetes

Try it

WHAT: Kubernetes manifest generation - Deployments, StatefulSets, CronJobs, Services, Ingresses, ConfigMaps, Secrets, and PVCs with production-grade security and health checks. WHEN: User needs to create K8s manifests, deploy containers, configure Services/Ingress, manage ConfigMaps/Secrets, set up persistent storage, or organize multi-environment configs. KEYWORDS: kubernetes, k8s, manifest, deployment, statefulset, cronjob, service, ingress, configmap, secret, pvc, pod, container, yaml, kustomize, helm, namespace, probe, security context

What it does

Production-ready Kubernetes manifest generation covering Deployments, StatefulSets, CronJobs, Services, Ingresses, ConfigMaps, Secrets, and PVCs with security contexts, health checks, and resource management.

The skill document

Kubernetes

Production-ready Kubernetes manifest generation covering Deployments, StatefulSets, CronJobs, Services, Ingresses, ConfigMaps, Secrets, and PVCs with security contexts, health checks, and resource management.

Installation

OpenClaw / Moltbot / Clawbot

npx clawhub@latest install kubernetes

When to Use

ScenarioExample
Create deployment manifestsNew microservice needing Deployment + Service
Define networking resourcesClusterIP, LoadBalancer, Ingress with TLS
Manage configurationConfigMaps for app config, Secrets for credentials
Stateful workloadsDatabases with StatefulSets + PVCs
Scheduled jobsCronJobs for batch processing
Multi-environment setupKustomize overlays for dev/staging/prod

Workload Selection

Workload TypeResourceWhen to Use
Stateless appDeploymentWeb servers, APIs, microservices
Stateful appStatefulSetDatabases, message queues, caches
One-off taskJobMigrations, data imports
Scheduled taskCronJobBackups, reports, cleanup
Per-node agentDaemonSetLog collectors, monitoring agents

Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
  namespace: production
  labels:
    app.kubernetes.io/name: my-app
    app.kubernetes.io/version: "1.0.0"
    app.kubernetes.io/component: backend
spec:
  replicas: 3
  selector:
    matchLabels:
      app.kubernetes.io/name: my-app
  template:
    metadata:
      labels:
        app.kubernetes.io/name: my-app
        app.kubernetes.io/version: "1.0.0"
    spec:
      securityContext:
        runAsNonRoot: true
        runAsUser: 1000
        fsGroup: 1000
        seccompProfile:
          type: RuntimeDefault
      containers:
        - name: my-app
          image: registry.example.com/my-app:1.0.0
          ports:
            - containerPort: 8080
              name: http
          resources:
            requests:
              cpu: 250m
              memory: 256Mi
            limits:
              cpu: 500m
              memory: 512Mi
          securityContext:
            allowPrivilegeEscalation: false
            readOnlyRootFilesystem: true
            capabilities:
              drop: [ALL]
          livenessProbe:
            httpGet:
              path: /health
              port: http
            initialDelaySeconds: 30
            periodSeconds: 10
          readinessProbe:
            httpGet:
              path: /ready
              port: http
            initialDelaySeconds: 5
            periodSeconds: 5
          env:
            - name: LOG_LEVEL
              valueFrom:
                configMapKeyRef:
                  name: my-app-config
                  key: LOG_LEVEL
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: my-app-secret
                  key: DATABASE_PASSWORD

Services

ClusterIP (Internal)

apiVersion: v1
kind: Service
metadata:
  name: my-app
  namespace: production
spec:
  type: ClusterIP
  selector:
    app.kubernetes.io/name: my-app
  ports:
    - name: http
      port: 80
      targetPort: 8080
      protocol: TCP

LoadBalancer (External)

apiVersion: v1
kind: Service
metadata:
  name: my-app-lb
  namespace: production
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
spec:
  type: LoadBalancer
  selector:
    app.kubernetes.io/name: my-app
  ports:
    - name: http
      port: 80
      targetPort: 8080

Service Type Quick Reference

TypeScopeUse Case
ClusterIPCluster-internalInter-service communication
NodePortExternal via node IPDev/testing, on-prem
LoadBalancerExternal via cloud LBProduction external access
ExternalNameDNS aliasMapping to external services

Ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-app
  namespace: production
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
    nginx.ingress.kubernetes.io/rate-limit: "100"
spec:
  ingressClassName: nginx
  tls:
    - hosts: [app.example.com]
      secretName: app-tls
  rules:
    - host: app.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: my-app
                port:
                  number: 80

ConfigMap & Secret

ConfigMap

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-app-config
  namespace: production
data:
  LOG_LEVEL: info
  APP_MODE: production
  DATABASE_HOST: db.internal.svc.cluster.local
  app.properties: |
    server.port=8080
    server.host=0.0.0.0

Secret

apiVersion: v1
kind: Secret
metadata:
  name: my-app-secret
  namespace: production
type: Opaque
stringData:
  DATABASE_PASSWORD: "changeme"
  API_KEY: "secret-api-key"

Important: Never commit plaintext Secrets to Git. Use Sealed Secrets, External Secrets Operator, or Vault for production.

Persistent Storage

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-app-data
  namespace: production
spec:
  accessModes: [ReadWriteOnce]
  storageClassName: gp3
  resources:
    requests:
      storage: 10Gi

Mount in a container:

containers:
  - name: app
    volumeMounts:
      - name: data
        mountPath: /var/lib/app
volumes:
  - name: data
    persistentVolumeClaim:
      claimName: my-app-data
Access ModeAbbreviationUse Case
ReadWriteOnceRWOSingle-pod databases
ReadOnlyManyROXShared config/static assets
ReadWriteManyRWXMulti-pod shared storage

Security Context

Pod-Level

spec:
  securityContext:
    runAsNonRoot: true
    runAsUser: 1000
    fsGroup: 1000
    seccompProfile:
      type: RuntimeDefault

Container-Level

securityContext:
  allowPrivilegeEscalation: false
  readOnlyRootFilesystem: true
  capabilities:
    drop: [ALL]

Security Checklist

CheckStatus
runAsNonRoot: trueRequired
allowPrivilegeEscalation: falseRequired
readOnlyRootFilesystem: trueRecommended
capabilities.drop: [ALL]Required
seccompProfile: RuntimeDefaultRecommended
Specific image tags (never :latest)Required
Resource requests and limits setRequired

Standard Labels

metadata:
  labels:
    app.kubernetes.io/name: my-app
    app.kubernetes.io/instance: my-app-prod
    app.kubernetes.io/version: "1.0.0"
    app.kubernetes.io/component: backend
    app.kubernetes.io/part-of: my-system
    app.kubernetes.io/managed-by: kubectl

Manifest Organization

Option 1 — Separate Files

manifests/
├── configmap.yaml
├── secret.yaml
├── deployment.yaml
├── service.yaml
└── pvc.yaml

Option 2 — Kustomize

base/
├── kustomization.yaml
├── deployment.yaml
├── service.yaml
└── configmap.yaml
overlays/
├── dev/
│   └── kustomization.yaml
└── prod/
    ├── kustomization.yaml
    └── resource-patch.yaml

Validation

# Client-side dry run
kubectl apply -f manifest.yaml --dry-run=client

# Server-side validation
kubectl apply -f manifest.yaml --dry-run=server

# Lint with kube-score
kube-score score manifest.yaml

# Lint with kube-linter
kube-linter lint manifest.yaml

Troubleshooting Quick Reference

ProblemDiagnosisFix
Pod stuck Pendingkubectl describe pod — check eventsFix resource requests, node capacity, PVC binding
ImagePullBackOffWrong image name/tag or missing pull secretVerify image exists, add imagePullSecrets
CrashLoopBackOffApp crashes on startCheck logs: kubectl logs --previous
Service not reachableSelector mismatchVerify kubectl get endpoints is non-empty
ConfigMap not loadingName mismatch or wrong namespaceCheck names match and namespace is correct
Readiness probe failingWrong path or portVerify health endpoint works inside container
OOMKilledMemory limit too lowIncrease resources.limits.memory

NEVER Do

Anti-PatternWhyDo Instead
Use :latest image tagNon-reproducible deploymentsPin exact version: image:1.2.3
Skip resource limitsPods can starve the nodeAlways set requests and limits
Run as rootContainer escape = full host accessSet runAsNonRoot: true + USER
Commit plaintext SecretsCredentials in Git history foreverUse Sealed Secrets / External Secrets / Vault
Skip health checksK8s can't detect unhealthy podsAlways configure liveness + readiness probes
Omit labelsCannot filter, select, or organizeUse standard app.kubernetes.io/* labels
Single replica for productionZero availability during updatesUse replicas: 3 minimum for HA
Hardcode config in containersRequires rebuild for config changesUse ConfigMaps and Secrets

Assets & References

Assets (Templates)

TemplateDescription
assets/deployment-template.yamlProduction Deployment with security + probes
assets/service-template.yamlClusterIP, LoadBalancer, NodePort examples
assets/configmap-template.yamlConfigMap with data types
assets/statefulset-template.yamlStatefulSet with headless Service + PVC
assets/cronjob-template.yamlCronJob with concurrency + history
assets/ingress-template.yamlIngress with TLS, rate limiting, CORS

References

ReferenceDescription
references/deployment-spec.mdDetailed Deployment specification
references/service-spec.mdService types and networking details

Related skills

Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.

by Iván555 installs18 stars

Trade crypto, manage a multi-chain wallet, and query an AI analyst from one CLI.

by lowesyang162 installs109 stars

imagegen

Official

Generate or edit raster images with a built-in tool, falling back to a CLI only when explicitly requested.

by OpenAI27.5k stars

More from wpank

Browse all skills

Systematic code review patterns covering security, performance, maintainability, correctness, and testing — with severity levels, structured feedback guidance, review process, and anti-patterns to avoid. Use when reviewing PRs, establishing review standards, or improving review quality.

by wpank554 installs20 stars

Pragmatic coding standards for writing clean, maintainable code — naming, functions, structure, anti-patterns, and pre-edit safety checks. Use when writing new code, refactoring existing code, reviewing code quality, or establishing coding standards.

by wpank198 installs6 stars

Build reliable, fast E2E test suites with Playwright and Cypress. Critical user journey coverage, flaky test elimination, CI/CD integration.

by wpank336 installs6 stars

Build scalable, themable Tailwind CSS component libraries using CVA for variants, compound components, design tokens, dark mode, and responsive grids.

by wpank217 installs9 stars

Create software diagrams using Mermaid syntax. Use when users need to create, visualize, or document software through diagrams including class diagrams, sequence diagrams, flowcharts, ERDs, C4 architecture diagrams, state diagrams, git graphs, and other diagram types. Triggers include requests to diagram, visualize, model, map out, or show the flow of a system.

by wpank250 installs5 stars

Provides backend architecture patterns (Clean Architecture, Hexagonal, DDD) for building maintainable, testable, and scalable systems with clear layering and...

by wpank152 installs7 stars