kubernetes-patterns
Guidelines for Kubernetes workload configuration including health probes, resource requests and limits, autoscaling, and Pod Disruption Budgets. Use when working with Kubernetes manifests, Helm values, or container runtime availability and scaling decisions.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- kubernetes-patterns
- description
- Guidelines for Kubernetes workload configuration including health probes, resource requests and limits, autoscaling, and Pod Disruption Budgets. Use when working with Kubernetes manifests, Helm values, or container runtime availability and scaling decisions.
02 资源文件 1
- 参考文档agents/openai.yaml112 B
03 SKILL.md 正文
Kubernetes Patterns
Use these guidelines when working with Kubernetes manifests, Helm values, or workload runtime behavior.
Health Probes
Configure all three probe types for production workloads:
| Probe Type | Purpose | Failure Action |
|---|---|---|
| Startup | Wait for app initialization | Block other probes |
| Readiness | Accept traffic when ready | Remove from load balancer |
| Liveness | Detect hung processes | Restart container |
Configuration Example:
startupProbe:
tcpSocket:
port: 8080
failureThreshold: 300
periodSeconds: 1
successThreshold: 1
readinessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 0
periodSeconds: 30
livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 0
periodSeconds: 30
Best Practices:
- Use
startupProbewith highfailureThresholdfor slow-starting apps - Keep
periodSecondsreasonable (30s) to avoid excessive load - Use
tcpSocketfor basic connectivity,httpGetfor deeper health checks - Consider separate
/healthand/readyendpoints
Resource Allocation
Always specify both requests and limits:
resources:
requests:
memory: "1Gi"
cpu: "200m"
limits:
memory: "2Gi"
cpu: "500m"
| Resource | Requests | Limits | Notes |
|---|---|---|---|
| Memory | Baseline usage | Max allowed | Set equal to prevent OOM issues |
| CPU | Guaranteed allocation | Burst capacity | Allow burst for spikes |
Guidelines:
- Requests = guaranteed resources (affects scheduling)
- Limits = maximum allowed (triggers throttling/OOM)
- Memory limits should often equal requests (avoid OOM kills)
- CPU can have higher limits for burst capacity
- Right-size based on actual usage metrics
Autoscaling
autoscaling:
enabled: true
minReplicas: 1
maxReplicas: 5
targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80
Considerations:
- Set
minReplicasbased on availability requirements - Configure
maxReplicasbased on cost and capacity - Use Pod Disruption Budgets for availability during updates
Pod Disruption Budgets (PDB)
Ensure high availability during cluster updates and node maintenance. PDBs limit the number of pods that can be simultaneously unavailable.
Values Configuration (values.yaml):
replicaCount: 2
disruptionBudget:
minAvailable: 1
maxUnavailable: 1
PDB Template (templates/pdb.yaml):
{{- if gt (int .Values.replicaCount) 1 }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "service-name.name" . }}-pdb
spec:
maxUnavailable: {{ .Values.disruptionBudget.maxUnavailable }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "service-name.name" . }}
{{- end }}
Guidelines:
- Only create PDB when
replicaCount > 1(single replicas can't have disruption budgets) - Use
maxUnavailable: 1for most services (allows rolling updates) - Use
minAvailablewhen you need guaranteed minimum capacity - PDBs protect against voluntary disruptions (node drains, cluster upgrades)
- PDBs do NOT protect against involuntary disruptions (hardware failures)
| Setting | Use Case |
|---|---|
maxUnavailable: 1 |
Standard services, allows one pod down during updates |
minAvailable: 1 |
Critical services, ensures at least one pod always running |
minAvailable: 50% |
Large deployments, percentage-based availability |
See Also
- Use
aws-patternsfor AWS service selection, Terraform and broader infrastructure-as-code practices, and AWS monitoring and logging guidance.
04 同仓库更多 Skills
ui-ux-pro-max
UI/UX design intelligence for web and mobile. Local database with 79 searchable styles (88 catalog entries), 192 color palettes, 74 font pairings, 192 product types, 119 UX guidelines, 105 curated icon entries, 17 GSAP motion presets, and 25 chart types across 22 stacks (React, Next.js, Vue, Nuxt, Svelte, Astro, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, Jetpack Compose, Angular, Laravel, JavaFX, WPF, WinUI, Avalonia, Uno Platform, UWP, Three.js, and HTML/CSS). Use when designing, building, or reviewing UI: pages, components, color schemes, typography, layout, accessibility, animation, or data visualization.
figma-mcp
Implement or compare UI against Figma designs using an available Figma MCP integration. Use for Figma-backed implementation, design-token extraction, or visual-parity gap analysis; Figma MCP access is optional and must already be configured by the user.
improve-codebase-architecture
Find evidence-based, active-change architecture improvements using shared design and domain-modeling guidance. Use when a user wants to reduce architectural friction, deepen a module, or make a current change safer, more testable, and easier to navigate.
domain-modeling
Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing GLOSSARY.md or CONTEXT.md, or recording or editing an ADR.
codebase-design
Provide the shared vocabulary and discipline for designing deep modules with clear interfaces and seams. Use when a user wants to design or improve a module, find deepening opportunities, choose a seam, or make code more testable and AI-navigable.
test-coverage-review
MUST invoke to review whether added or updated tests cover code changes in a diff. Checks new logic, branches, error paths, and regression risk, producing a change-to-test matrix. Use requirements-to-tests-traceability for acceptance-criteria mapping and orchestrated-review for bundled reviews.