Kubernetes Deployment Specification Reference
Comprehensive reference for Kubernetes Deployment resources, covering all key fields, best practices, and common patterns.
Overview
A Deployment provides declarative updates for Pods and ReplicaSets. It manages the desired state of your application, handling rollouts, rollbacks, and scaling operations.
When to use this skill
- Authoring or reviewing a Kubernetes
Deployment manifest.
- Pinning down which Deployment fields are mandatory vs recommended.
- Picking an update strategy (
RollingUpdate vs Recreate) and its parameters.
- Choosing replica count, surge/unavailable budgets, and
revisionHistoryLimit.
- Setting probes (startup / liveness / readiness), security context, and resource requests/limits.
- Picking a deployment pattern: high-availability, sidecar, init container.
- Diagnosing common Deployment failure modes (
ImagePullBackOff, CrashLoopBackOff, stuck rollouts).
Reference map
The detailed reference material lives behind pointers so an invocation loads only what it needs.
| When |
Read |
You need a complete annotated Deployment manifest (all fields in one place) |
references/complete-spec.md |
| You need detail on a specific field group |
references/field-reference.md |
| You're picking a deployment pattern (HA, sidecar, init container) |
references/patterns.md |
| A Deployment is misbehaving |
references/troubleshooting.md |
Field reference index
| Group |
Covers |
See |
| Metadata fields |
required (name, labels selector parity) + recommended labels/annotations (app.kubernetes.io/*) |
field-reference.md |
| Replica management |
replicas, revisionHistoryLimit, selectors |
field-reference.md |
| Update strategy |
RollingUpdate vs Recreate, maxSurge, maxUnavailable, minReadySeconds, progressDeadlineSeconds |
field-reference.md |
| Pod template |
template.metadata, labels parity with selector |
field-reference.md |
| Container configuration |
image, ports, env, envFrom, command/args |
field-reference.md |
| Resource management |
resources.requests + resources.limits for cpu/memory; QoS tiers |
field-reference.md |
| Health checks |
startupProbe, livenessProbe, readinessProbe; HTTP / TCP / exec / gRPC |
field-reference.md |
| Security context |
non-root, read-only filesystem, drop capabilities, seccomp |
field-reference.md |
| Volumes |
configMap, secret, emptyDir, persistentVolumeClaim, projected |
field-reference.md |
| Scheduling |
nodeSelector, node affinity, pod (anti-)affinity, tolerations, topology-spread |
field-reference.md |
Common patterns (one-line summaries)
- High availability —
replicas: 3+, maxUnavailable: 0, pod anti-affinity by hostname.
- Sidecar container — primary app + sidecar container in the same pod (logging, proxy, secrets refresh) with shared
emptyDir volume.
- Init container — run setup or dependency-wait steps before main containers start (DB migrations, fetching config).
Full YAML for each pattern: references/patterns.md.
Production checklist
Performance tuning
Fast startup:
spec:
minReadySeconds: 5
strategy:
rollingUpdate:
maxSurge: 2
maxUnavailable: 1
Zero-downtime updates:
spec:
minReadySeconds: 10
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
Graceful shutdown:
spec:
template:
spec:
terminationGracePeriodSeconds: 60
containers:
- name: app
lifecycle:
preStop:
exec:
command: ["/bin/sh", "-c", "sleep 15 && kill -SIGTERM 1"]
Troubleshooting
Common failure modes — load the full catalog in references/troubleshooting.md when diagnosing:
- Pods not starting —
kubectl describe deployment <name>, then drill into the failing pod (get pods -l app=<app>, describe pod, logs).
ImagePullBackOff — wrong image name/tag, missing imagePullSecrets, registry credentials.
CrashLoopBackOff — application crashes, overly aggressive liveness probe, resource limits, missing dependencies.
- Rollout stuck in progress —
progressDeadlineSeconds exceeded, readiness probe never succeeds, cluster resource pressure.
Related resources
Source: kmshihab7878/claude-code-setup — distributed by TomeVault.
1---2name: kubernetes-deployment-specification3description: Reference for Kubernetes Deployment fields, patterns, and troubleshooting. Use when this capability is needed.4---56# Kubernetes Deployment Specification Reference78Comprehensive reference for Kubernetes Deployment resources, covering all key fields, best practices, and common patterns.910## Overview1112A Deployment provides declarative updates for Pods and ReplicaSets. It manages the desired state of your application, handling rollouts, rollbacks, and scaling operations.1314## When to use this skill1516- Authoring or reviewing a Kubernetes `Deployment` manifest.17- Pinning down which Deployment fields are mandatory vs recommended.18- Picking an update strategy (`RollingUpdate` vs `Recreate`) and its parameters.19- Choosing replica count, surge/unavailable budgets, and `revisionHistoryLimit`.20- Setting probes (startup / liveness / readiness), security context, and resource requests/limits.21- Picking a deployment pattern: high-availability, sidecar, init container.22- Diagnosing common Deployment failure modes (`ImagePullBackOff`, `CrashLoopBackOff`, stuck rollouts).2324## Reference map2526The detailed reference material lives behind pointers so an invocation loads only what it needs.2728| When | Read |29|---|---|30| You need a complete annotated `Deployment` manifest (all fields in one place) | [`references/complete-spec.md`](references/complete-spec.md) |31| You need detail on a specific field group | [`references/field-reference.md`](references/field-reference.md) |32| You're picking a deployment pattern (HA, sidecar, init container) | [`references/patterns.md`](references/patterns.md) |33| A Deployment is misbehaving | [`references/troubleshooting.md`](references/troubleshooting.md) |3435## Field reference index3637| Group | Covers | See |38|---|---|---|39| Metadata fields | required (`name`, `labels` selector parity) + recommended labels/annotations (`app.kubernetes.io/*`) | [`field-reference.md`](references/field-reference.md#metadata-fields) |40| Replica management | `replicas`, `revisionHistoryLimit`, selectors | [`field-reference.md`](references/field-reference.md#replica-management) |41| Update strategy | `RollingUpdate` vs `Recreate`, `maxSurge`, `maxUnavailable`, `minReadySeconds`, `progressDeadlineSeconds` | [`field-reference.md`](references/field-reference.md#update-strategy) |42| Pod template | `template.metadata`, labels parity with selector | [`field-reference.md`](references/field-reference.md#pod-template) |43| Container configuration | image, ports, env, `envFrom`, command/args | [`field-reference.md`](references/field-reference.md#container-configuration) |44| Resource management | `resources.requests` + `resources.limits` for cpu/memory; QoS tiers | [`field-reference.md`](references/field-reference.md#resource-management) |45| Health checks | `startupProbe`, `livenessProbe`, `readinessProbe`; HTTP / TCP / exec / gRPC | [`field-reference.md`](references/field-reference.md#health-checks) |46| Security context | non-root, read-only filesystem, drop capabilities, seccomp | [`field-reference.md`](references/field-reference.md#security-context) |47| Volumes | `configMap`, `secret`, `emptyDir`, `persistentVolumeClaim`, `projected` | [`field-reference.md`](references/field-reference.md#volumes) |48| Scheduling | `nodeSelector`, node affinity, pod (anti-)affinity, tolerations, topology-spread | [`field-reference.md`](references/field-reference.md#scheduling) |4950## Common patterns (one-line summaries)5152- **High availability** — `replicas: 3+`, `maxUnavailable: 0`, pod anti-affinity by hostname.53- **Sidecar container** — primary app + sidecar container in the same pod (logging, proxy, secrets refresh) with shared `emptyDir` volume.54- **Init container** — run setup or dependency-wait steps before main containers start (DB migrations, fetching config).5556Full YAML for each pattern: [`references/patterns.md`](references/patterns.md).5758## Production checklist5960- [ ] Set resource requests and limits.61- [ ] Implement all three probe types (startup, liveness, readiness).62- [ ] Use specific image tags (not `:latest`).63- [ ] Configure security context (non-root, read-only filesystem).64- [ ] Set replica count `>= 3` for HA.65- [ ] Configure pod anti-affinity for spread.66- [ ] Set appropriate update strategy (`maxUnavailable: 0` for zero-downtime).67- [ ] Use ConfigMaps and Secrets for configuration.68- [ ] Add standard labels and annotations.69- [ ] Configure graceful shutdown (`preStop` hook, `terminationGracePeriodSeconds`).70- [ ] Set `revisionHistoryLimit` for rollback capability.71- [ ] Use ServiceAccount with minimal RBAC permissions.7273## Performance tuning7475**Fast startup:**7677```yaml78spec:79 minReadySeconds: 580 strategy:81 rollingUpdate:82 maxSurge: 283 maxUnavailable: 184```8586**Zero-downtime updates:**8788```yaml89spec:90 minReadySeconds: 1091 strategy:92 rollingUpdate:93 maxSurge: 194 maxUnavailable: 095```9697**Graceful shutdown:**9899```yaml100spec:101 template:102 spec:103 terminationGracePeriodSeconds: 60104 containers:105 - name: app106 lifecycle:107 preStop:108 exec:109 command: ["/bin/sh", "-c", "sleep 15 && kill -SIGTERM 1"]110```111112## Troubleshooting113114Common failure modes — load the full catalog in [`references/troubleshooting.md`](references/troubleshooting.md) when diagnosing:115116- **Pods not starting** — `kubectl describe deployment <name>`, then drill into the failing pod (`get pods -l app=<app>`, `describe pod`, `logs`).117- **`ImagePullBackOff`** — wrong image name/tag, missing `imagePullSecrets`, registry credentials.118- **`CrashLoopBackOff`** — application crashes, overly aggressive liveness probe, resource limits, missing dependencies.119- **Rollout stuck in progress** — `progressDeadlineSeconds` exceeded, readiness probe never succeeds, cluster resource pressure.120121## Related resources122123- [Kubernetes Deployment API Reference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#deployment-v1-apps)124- [Pod Security Standards](https://kubernetes.io/docs/concepts/security/pod-security-standards/)125- [Resource Management](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/)126127---128> Source: [kmshihab7878/claude-code-setup](https://github.com/kmshihab7878/claude-code-setup) — distributed by [TomeVault](https://tomevault.io).129<!-- tomevault:4.0:skill_md:2026-05-22 -->