Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Operating production Kubernetes clusters effectively with resource management, advanced scheduling, networking, storage, security hardening, and autoscaling. Use when deploying workloads to Kubernetes, configuring cluster resources, implementing security policies, or troubleshooting operational issues.
.claude/skills/ancoleman-operating-kubernetes/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 170% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 174% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 332% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 251% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 249% | 0% |
Operating Kubernetes clusters in production requires mastery of resource management, scheduling patterns, networking architecture, storage strategies, security hardening, and autoscaling. This skill provides operations-first frameworks for right-sizing workloads, implementing high-availability patterns, securing clusters with RBAC and Pod Security Standards, and systematically troubleshooting common failures.
Use this skill when deploying applications to Kubernetes, configuring cluster resources, implementing NetworkPolicies for zero-trust security, setting up autoscaling (HPA, VPA, KEDA), managing persistent storage, or diagnosing operational issues like CrashLoopBackOff or resource exhaustion.
Common Triggers:
Operations Covered:
Kubernetes assigns QoS classes based on resource requests and limits:
Guaranteed (Highest Priority):
yamlresources: requests: memory: "512Mi" cpu: "500m" limits: memory: "512Mi" # Same as request cpu: "500m"
Burstable (Medium Priority):
yamlresources: requests: memory: "256Mi" cpu: "250m" limits: memory: "512Mi" # 2x request cpu: "500m"
BestEffort (Lowest Priority):
| Workload Type | QoS Class | Configuration | |---------------|-----------|---------------| | Critical API/Database | Guaranteed | requests == limits | | Web servers, services | Burstable | limits 1.5-2x requests | | Batch jobs | Burstable | Low requests, high limits | | Dev/test environments | BestEffort | No limits |
Enforce multi-tenancy with ResourceQuotas (namespace limits) and LimitRanges (per-container defaults):
yaml# ResourceQuota: Namespace-level limits apiVersion: v1 kind: ResourceQuota metadata: name: team-quota namespace: team-alpha spec: hard: requests.cpu: "10" requests.memory: "20Gi" limits.cpu: "20" limits.memory: "40Gi" pods: "50"
For detailed resource management patterns including Vertical Pod Autoscaler (VPA), see references/resource-management.md.
Control which nodes pods schedule on with required (hard) or preferred (soft) constraints:
yamlaffinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: node.kubernetes.io/instance-type operator: In values: - g4dn.xlarge # GPU instance
Reserve nodes for specific workloads (inverse of affinity):
bash# Taint GPU nodes to prevent non-GPU workloads kubectl taint nodes gpu-node-1 workload=gpu:NoSchedule
yaml# Pod tolerates GPU taint tolerations: - key: "workload" operator: "Equal" value: "gpu" effect: "NoSchedule"
Distribute pods evenly across failure domains (zones, nodes):
yamltopologySpreadConstraints: - maxSkew: 1 # Max difference in pod count topologyKey: topology.kubernetes.io/zone whenUnsatisfiable: DoNotSchedule labelSelector: matchLabels: app: critical-app
For advanced scheduling patterns including pod priority and preemption, see references/scheduling-patterns.md.
Implement default-deny security with NetworkPolicies:
yaml# Default deny all traffic apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: default-deny-all namespace: production spec: podSelector: {} policyTypes: - Ingress - Egress
yaml# Allow specific ingress (frontend → backend) apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: backend-allow-frontend spec: podSelector: matchLabels: app: backend ingress: - from: - podSelector: matchLabels: app: frontend ports: - protocol: TCP port: 8080
Ingress (Legacy):
Gateway API (Modern):
yaml# Gateway API example apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: app-routes spec: parentRefs: - name: production-gateway rules: - matches: - path: type: PathPrefix value: /api backendRefs: - name: backend port: 8080
For detailed networking patterns including service mesh integration, see references/networking.md.
StorageClasses define storage tiers for different workload needs:
yaml# AWS EBS SSD (high performance) apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: fast-ssd provisioner: ebs.csi.aws.com parameters: type: gp3 iopsPerGB: "50" encrypted: "true" volumeBindingMode: WaitForFirstConsumer allowVolumeExpansion: true reclaimPolicy: Delete
| Workload | Performance | Access Mode | Storage Class | |----------|-------------|-------------|---------------| | Database | High | ReadWriteOnce | SSD (gp3/io2) | | Shared files | Medium | ReadWriteMany | NFS/EFS | | Logs (temp) | Low | ReadWriteOnce | Standard HDD | | ML models | High | ReadOnlyMany | Object storage (S3) |
Access Modes:
For detailed storage operations including volume snapshots and CSI drivers, see references/storage.md.
Implement least-privilege access with RBAC:
yaml# Role (namespace-scoped) apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: pod-reader namespace: production rules: - apiGroups: [""] resources: ["pods", "pods/log"] verbs: ["get", "list", "watch"] --- # RoleBinding (assign role to user) apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: read-pods namespace: production subjects: - kind: User name: jane@example.com apiGroup: rbac.authorization.k8s.io roleRef: kind: Role name: pod-reader apiGroup: rbac.authorization.k8s.io
Enforce secure pod configurations at the namespace level:
yaml# Namespace with Restricted PSS (most secure) apiVersion: v1 kind: Namespace metadata: name: production labels: pod-security.kubernetes.io/enforce: restricted pod-security.kubernetes.io/audit: restricted pod-security.kubernetes.io/warn: restricted
Pod Security Levels:
For detailed security patterns including policy enforcement (Kyverno/OPA) and secrets management, see references/security.md.
Scale pod replicas based on CPU, memory, or custom metrics:
yamlapiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: web-app-hpa spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: web-app minReplicas: 2 maxReplicas: 10 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 70 behavior: scaleDown: stabilizationWindowSeconds: 300 # Wait 5min before scaling down
Scale based on events beyond CPU/memory (queues, cron schedules, Prometheus metrics):
yamlapiVersion: keda.sh/v1alpha1 kind: ScaledObject metadata: name: rabbitmq-scaler spec: scaleTargetRef: name: message-processor minReplicaCount: 0 # Scale to zero when queue empty maxReplicaCount: 30 triggers: - type: rabbitmq metadata: queueName: tasks queueLength: "10" # Scale up when >10 messages
| Scenario | Use HPA | Use VPA | Use KEDA | Use Cluster Autoscaler | |----------|---------|---------|----------|------------------------| | Stateless web app with traffic spikes | ✅ | ❌ | ❌ | Maybe | | Single-instance database | ❌ | ✅ | ❌ | Maybe | | Queue processor (event-driven) | ❌ | ❌ | ✅ | Maybe | | Pods pending (insufficient nodes) | ❌ | ❌ | ❌ | ✅ |
For detailed autoscaling patterns including VPA and cluster autoscaler configuration, see references/autoscaling.md.
Pod Stuck in Pending:
bashkubectl describe pod <pod-name> # Common causes: # - Insufficient CPU/memory: Reduce requests or add nodes # - Node selector mismatch: Fix nodeSelector or add labels # - PVC not bound: Create PVC or fix name # - Taint intolerance: Add toleration or remove taint
CrashLoopBackOff:
bashkubectl logs <pod-name> kubectl logs <pod-name> --previous # Check previous crash # Common causes: # - Application crash: Fix code or configuration # - Missing environment variables: Add to deployment # - Liveness probe failing: Increase initialDelaySeconds # - OOMKilled: Increase memory limit or fix leak
ImagePullBackOff:
bashkubectl describe pod <pod-name> # Common causes: # - Image doesn't exist: Fix image name/tag # - Authentication required: Create imagePullSecrets # - Network issues: Check NetworkPolicies, firewall rules
Service Not Accessible:
bashkubectl get endpoints <service-name> # Should list pod IPs # If endpoints empty: # - Service selector doesn't match pod labels # - Pods aren't ready (readiness probe failing) # - Check NetworkPolicies blocking traffic
For systematic troubleshooting playbooks including networking and storage issues, see references/troubleshooting.md.
Resource Management:
Scheduling:
Networking:
Storage:
Security:
Autoscaling:
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-02 | fail→pass | 15,717 | 13,761 | -12% | 1 | 1 | 0% | 2,177 | 5,884 | +170% | 0 | 0 | — |
case-01 | pass→pass | 10,721 | 8,977 | -16% | 1 | 1 | 0% | 1,850 | 5,074 | +174% | 0 | 0 | — |
case-03 | pass→pass | 5,844 | 6,457 | +10% | 1 | 1 | 0% | 1,109 | 4,791 | +332% | 0 | 0 | — |
case-04 | pass→pass | 7,623 | 7,686 | +1% | 1 | 1 | 0% | 1,419 | 4,984 | +251% | 0 | 0 | — |
case-05 | pass→pass | 6,932 | 8,716 | +26% | 1 | 1 | 0% | 1,288 | 4,495 | +249% | 0 | 0 | — |
case-06 | pass→pass | 5,964 | 5,867 | -2% | 1 | 1 | 0% | 985 | 4,667 | +374% | 0 | 0 | — |
case-07 | pass→pass | 10,259 | 8,267 | -19% | 1 | 1 | 0% | 1,742 | 5,167 | +197% | 0 | 0 | — |
case-08 | pass→pass | 4,681 | 5,888 | +26% | 1 | 1 | 0% | 799 | 4,649 | +482% | 0 | 0 | — |
case-09 | pass→pass | 3,424 | 4,416 | +29% | 1 | 1 | 0% | 603 | 4,424 | +634% | 0 | 0 | — |
case-10 | pass→pass | 7,860 | 6,903 | -12% | 1 | 1 | 0% | 1,519 | 4,875 | +221% | 0 | 0 | — |
case-11 | pass→pass | 7,257 | 6,325 | -13% | 1 | 1 | 0% | 1,312 | 4,795 | +265% | 0 | 0 | — |
case-12 | pass→pass | 11,994 | 9,564 | -20% | 1 | 1 | 0% | 2,123 | 5,356 | +152% | 0 | 0 | — |
case-13 | pass→pass | 13,356 | 9,905 | -26% | 1 | 1 | 0% | 2,170 | 5,332 | +146% | 0 | 0 | — |
case-14 | pass→pass | 6,509 | 4,589 | -29% | 1 | 1 | 0% | 1,127 | 4,417 | +292% | 0 | 0 | — |
case-15 | pass→pass | 7,084 | 5,894 | -17% | 1 | 1 | 0% | 1,252 | 4,640 | +271% | 0 | 0 | — |
case-16 | pass→pass | 4,468 | 2,874 | -36% | 1 | 1 | 0% | 703 | 4,145 | +490% | 0 | 0 | — |
case-17 | pass→pass | 2,858 | 2,089 | -27% | 1 | 1 | 0% | 502 | 3,985 | +694% | 0 | 0 | — |
case-18 | pass→pass | 14,132 | 15,143 | +7% | 1 | 1 | 0% | 2,462 | 6,239 | +153% | 0 | 0 | — |
case-19 | pass→pass | 6,563 | 5,391 | -18% | 1 | 1 | 0% | 1,118 | 4,505 | +303% | 0 | 0 | — |
case-20 | pass→pass | 5,736 | 6,158 | +7% | 1 | 1 | 0% | 1,032 | 4,794 | +365% | 0 | 0 | — |
case-21 | pass→pass | 7,621 | 10,654 | +40% | 1 | 1 | 0% | 1,496 | 5,687 | +280% | 0 | 0 | — |
case-22 | pass→pass | 5,902 | 6,820 | +16% | 1 | 1 | 0% | 957 | 4,776 | +399% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +5 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.