本文へ移動
cccskills
無料GitHub で公開

kubernetes

Deploy, manage, and debug Kubernetes in production — Deployments, Services, Gateway API, Service Mesh (Istio/Linkerd/Cilium), eBPF observability (Cilium Hubble), security hardening (Pod Security Standards, OPA/Kyverno, seccomp, runtime security with Falco/Tetragon), Helm, HPA, PDB, topology spread, and debugging. Use when user asks to write K8s manifests, deploy to a cluster, debug pods, set up Gateway API, configure autoscaling, or harden cluster security. Do NOT use for Dockerfiles (use docker), CI/CD pipeline design (use ci-cd), or Terraform infrastructure (use terraform).

インストール方法を見る

含まれるファイル(6)

  • SKILL.md12.9 KB
  • assets/deployment-template.yaml10.4 KB
  • references/gateway-api.md12.3 KB
  • references/service-mesh.md12.3 KB
  • scripts/debug-pod.sh5.9 KB
  • scripts/generate-manifest.sh5.7 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Kubernetes Architect

Production-grade Kubernetes: deployments, Gateway API, zero-trust networking, service mesh, eBPF observability, and debugging. Follows NSA/CISA hardening guidelines.

Decision Framework

Before deploying to Kubernetes, answer:

  • Does the app need horizontal scaling (3+ replicas)? → Kubernetes
  • Is it a single-instance app with simple needs? → Docker Compose or VPS
  • Is the team already familiar with Kubernetes? → Proceed. If not, consider managed (EKS, GKE, AKS)
  • Does the app need advanced networking (service mesh, ingress routing)? → Kubernetes + Gateway API
  • Is the infrastructure budget tight? → Single-node k3s or Docker Compose for dev
  • Multiple services with different scaling profiles? → Kubernetes (HPA per service)

Workflow

Step 1: Determine deployment type

TypeKindUse case
StatelessDeploymentWeb APIs, workers
StatefulStatefulSetDatabases, queues (use with caution)
BatchJob/CronJobMigrations, periodic tasks
DaemonDaemonSetLogging, monitoring agents

If uncertain, start with a Deployment. See assets/deployment-template.yaml for the full production template.

Step 2: Generate manifest

Use the scaffold script:

scripts/generate-manifest.sh -n api -i myregistry.com/api:1.0.0 -p 3000 -r 3 -o manifests/

This creates: deployment.yaml, service.yaml, hpa.yaml, pdb.yaml with all security contexts, probes, resource requests/limits, and topology spread constraints pre-configured.

If the service expects HTTP traffic, also create a Gateway API HTTPRoute.

Template alternatives: Helm and Kustomize

The scaffold script above generates raw manifests. For more complex deployments, consider:

ToolBest forPattern
Helm (helm create)Packaging reusable apps, versioned releases, templatingvalues.yaml → Go templates → rendered manifests. Use helm lint and helm template for validation.
Kustomize (kubectl kustomize)Environment-specific overlays, patching base manifestsbase/ + overlays/{dev,staging,prod}/ with strategic merge patches. Native in kubectl.
Raw manifestsSimple services, fast iteration, no templating overheadPlain YAML in manifests/. Use with the scaffold script.

Use Helm for distributing apps (charts), Kustomize for environment variants (overlays), and raw manifests for speed. The scaffold script handles the raw manifest path — for Helm/Kustomize, create the chart or overlay manually following the same security constraints.

Step 3: Configure networking

Gateway API (replaces Ingress)

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: api-gateway
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
  gatewayClassName: istio
  listeners:
    - name: https
      protocol: HTTPS
      port: 443
      hostname: api.example.com
      tls:
        mode: Terminate
        certificateRefs: [{ name: api-tls }]
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: api-route
spec:
  parentRefs: [{ name: api-gateway }]
  hostnames: ["api.example.com"]
  rules:
    - matches:
        - path: { type: PathPrefix, value: /api }
      backendRefs:
        - name: api
          port: 80

See references/gateway-api.md for HTTPRoute, GRPCRoute, TLSRoute, and cross-namespace patterns.

Zero-trust networking

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: { name: default-deny-all }
spec:
  podSelector: {}
  policyTypes: [Ingress, Egress]
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: { name: allow-api-ingress }
spec:
  podSelector: { matchLabels: { app: api } }
  ingress:
    - from:
        - namespaceSelector: { matchLabels: { name: gateway-system } }
      ports: [{ port: 3000 }]

Always start with a default-deny policy. Then add explicit allow rules.

Step 4: Add service mesh (if needed)

See references/service-mesh.md for the complete comparison and setup guide.

Decision matrix:

NeedRecommendation
mTLS + observabilityIstio (full-featured)
Simple mTLS + lightweightLinkerd (low resource overhead)
eBPF-native networking + securityCilium (no sidecar needed)

Step 5: Configure autoscaling and resilience

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata: { name: api-hpa }
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: api
  minReplicas: 3
  maxReplicas: 20
  metrics:
    - type: Resource
      resource:
        name: cpu
        target: { type: Utilization, averageUtilization: 70 }
    - type: Resource
      resource:
        name: memory
        target: { type: Utilization, averageUtilization: 80 }
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata: { name: api-pdb }
spec:
  minAvailable: 2
  selector:
    matchLabels: { app: api }

Step 6: Debug issues

See the debugging script:

scripts/debug-pod.sh api-7d8f9c-abc  # describes pod, shows logs, checks events, diagnoses

Common diagnoses the script detects:

SymptomLikely cause
CrashLoopBackOff with OOMKillOut of memory — increase resources.limits.memory
CrashLoopBackOff with ImagePullBackOffWrong image name, tag, or registry credentials
Pending with no nodeInsufficient resources or PVC pending
ImagePullBackOffImage tag doesn't exist, registry unreachable, or imagePullSecrets missing
CreateContainerConfigErrorConfigMap or Secret referenced but not mounted
Running but not readyReadiness probe failing — check /ready endpoint

Error Handling

ScenarioDiagnosisFix
Pod stuck in Pendingkubectl describe pod → eventsCheck node resources, PVC status
Pod crash loopingkubectl logs --previousCheck app errors, OOMKill status
Service unreachablekubectl port-forward svc/api 8080:80Check selector matches pod labels
DNS not resolvingkubectl exec -it dnsutils -- nslookup apiCheck CoreDNS pods and Service entries
TLS cert invalidkubectl describe certificateCheck cert-manager issuer and DNS
PVC stuck in Pendingkubectl describe pvc → no matching PV, storage class wrongCheck StorageClass exists. Verify PV capacity >= PVC request. Check volumeMode matches.
ConfigMap not mountedkubectl describe pod → "MountVolume.SetUp failed"Verify ConfigMap name matches. Use subPath for single-file mounts. Check namespace — ConfigMaps are namespace-scoped.
RBAC deniedkubectl auth can-i <verb> <resource> --as <user> returns noCheck Role/RoleBinding or ClusterRole/ClusterRoleBinding. Verify subjects match service account. Use kubectl auth reconcile -f rbac.yaml to sync.

Production Checklist

  • Resource requests + limits on every container
  • Liveness + readiness probes
  • Pod Security Standards: restricted enforced
  • NetworkPolicy: default-deny + explicit allow
  • Containers run as non-root
  • Read-only root filesystem
  • Secrets via external provider (Vault, External Secrets, CSI)
  • HPA with CPU + memory metrics
  • PDB >= 1 for critical services
  • Image pinned by digest (not tag)
  • PodDisruptionBudget for HA
  • mTLS between all services
  • Audit logging shipped
  • RBAC: least privilege, no cluster-admin
  • Falco or Tetragon for runtime security
  • Gateway API (not legacy Ingress)

Anti-Patterns

Anti-patternFix
imagePullPolicy: AlwaysPin digest, use IfNotPresent
No resource limitsAlways set requests + limits
Running as rootsecurityContext.runAsNonRoot: true
latest tagPin by digest
Single replicaAlways >= 2 for HA
No probesLiveness + readiness mandatory
Hardcoded config in imageConfigMap + Secret
No NetworkPolicyDefault-deny per namespace
Legacy Ingress resourceMigrate to Gateway API

Review Format (Required)

When reviewing Kubernetes manifests, use Before | After | Why format:

BeforeAfterWhy
image: myapp:latestimage: myapp@sha256:abc...latest is a floating tag. Digest pinning ensures the same image every deploy.
No resources blockresources: { requests: { cpu: "100m", memory: "128Mi" }, limits: { cpu: "500m", memory: "256Mi" } }Without requests, the scheduler can't place pods. Without limits, one pod can starve others.
imagePullPolicy: AlwaysimagePullPolicy: IfNotPresent (with digest tag) or Always (with floating tag only if intentional)Always forces a registry pull on every start, adding latency. Use with digest tags only for rolling updates.
Legacy IngressGateway API Gateway + HTTPRouteIngress is deprecated. Gateway API supports traffic splitting, header matching, and multi-tenancy.

Helm Charts

# Create chart
helm create myapp
# Chart structure: Chart.yaml, values.yaml, templates/deployment.yaml, templates/service.yaml, templates/hpa.yaml

# Install
helm install myapp ./myapp -f values-prod.yaml --namespace production

# Template values: {{ .Values.replicaCount }}, {{ .Values.image.tag }}
# Conditional blocks: {{- if .Values.ingress.enabled }}
# Loops: {{- range .Values.env }}

Kustomize Overlays

# base/kustomization.yaml
resources: [deployment.yaml, service.yaml]

# overlays/prod/kustomization.yaml
bases: [../../base]
patchesStrategicMerge: [replicas-patch.yaml]
images: [{ name: myapp, newTag: "v1.2.3" }]

Apply: kubectl apply -k overlays/prod/

Pod Hardening (NSA/CISA)

securityContext:
  runAsNonRoot: true
  runAsUser: 1000
  fsGroup: 1000
containers:
- name: app
  securityContext:
    allowPrivilegeEscalation: false
    readOnlyRootFilesystem: true
    capabilities: { drop: [ALL] }
    seccompProfile: { type: RuntimeDefault }

Rule: every production pod must pass all 6 checks above.

Sources

  • Kubernetes docs (kubernetes.io/docs)
  • Gateway API (gateway-api.sigs.k8s.io)
  • Istio (istio.io), Linkerd (linkerd.io), Cilium (docs.cilium.io)
  • Helm (helm.sh)
  • NSA/CISA Kubernetes Hardening Guide
  • OWASP Kubernetes Security

Hardening Checklist

Before deploying to production:

  • All containers run as non-root (securityContext: { runAsNonRoot: true, readOnlyRootFilesystem: true })
  • Pod Security Standard restricted applied to all namespaces
  • NetworkPolicy default-deny-all with explicit allow rules for each service
  • Image pinned by digest, not tag (image: myapp@sha256:...)
  • Resource requests AND limits set on every container
  • readinessProbe AND livenessProbe configured with different thresholds
  • PodDisruptionBudget set with minAvailable: 1 (or higher for multi-replica services)
  • Secrets stored in external manager (Vault, Sealed Secrets, External Secrets), not plain K8s secrets
  • automountServiceAccountToken: false unless the pod genuinely needs API access
  • allowPrivilegeEscalation: false on all containers
  • TLS enabled on ingress with cert-manager auto-renewal
  • Audit logging enabled on API server and critical namespaces

Checklist

  • Skill loads without errors in the AI agent
  • YAML frontmatter is valid (description, compatibility, audience)
  • Workflow section provides clear step-by-step instructions
  • Error handling section covers common failure modes
  • All referenced files (references/, scripts/, assets/) exist
  • Skill triggers correctly for intended use cases
  • No broken links or missing resources

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Apply professional, premium UI/UX design standards when building or styling web interfaces. Use this skill when the user asks to create a website, landing page, web app, dashboard, UI component, or any visual interface — or when they ask to make something look better, more professional, or more beautiful. Covers visual hierarchy, typography, color systems, layout, spacing, motion, dark mode, responsive design, and conversion patterns. Activate even when the user doesn't say "design" — if they're building a web frontend, these standards apply.

日本語の概要は準備中です。原文の説明を表示しています。

EliasOulkadi/shokunin1142026年10月5日 更新

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

日本語の概要は準備中です。原文の説明を表示しています。

EliasOulkadi/shokunin1142026年10月5日 更新

Run 150+ AI apps via inference.sh CLI - image generation, video creation, LLMs, search, 3D, Twitter automation. Models: FLUX, Veo, Gemini, Grok, Claude, Seedance, OmniHuman, Tavily, Exa, OpenRouter, and many more. Use when running AI apps, generating images/videos, calling LLMs, web search, or automating Twitter. Triggers: inference.sh, infsh, ai model, run ai, serverless ai, ai api, flux, veo, claude api, image generation, video generation, openrouter, tavily, exa search, twitter api, grok

日本語の概要は準備中です。原文の説明を表示しています。

EliasOulkadi/shokunin1142026年10月5日 更新

api-forge

無料

Design REST/GraphQL APIs with OpenAPI 3.1, error handling, pagination, rate limiting, webhooks, and idempotency. Use when user asks to design an API, create endpoints, define REST/GraphQL schema, or generate OpenAPI spec. Do NOT use for database schema design, frontend API integration, or non-HTTP protocols (gRPC, WebSocket, MQTT).

日本語の概要は準備中です。原文の説明を表示しています。

EliasOulkadi/shokunin1142026年10月5日 更新

Implement authentication and authorization with OWASP Top 10 standards, OAuth 2.0 + OIDC, WebAuthn/Passkeys, session management, and RBAC/ABAC. Use when user asks to implement login, signup, authentication, authorization, JWT, OAuth, SSO, passkeys, MFA, or role-based access. Do NOT use for API key management (use api-forge), encryption at rest, or network-level security (firewalls, WAF).

日本語の概要は準備中です。原文の説明を表示しています。

EliasOulkadi/shokunin1142026年10月5日 更新

Generate brand guidelines, design systems with design tokens (W3C format), creative direction (SCAMPER, Design Thinking, TRIZ), and design briefs with scope and success criteria.

日本語の概要は準備中です。原文の説明を表示しています。

EliasOulkadi/shokunin1142026年10月5日 更新

EliasOulkadi のスキルをすべて見る

このスキルの問題を報告する