/kubernetes-platform-skills:kustomize-overlay-managementfrom kubernetes-platform-skills
Guides structuring Kustomize bases and overlays, writing strategic-merge/JSON6902 patches, using generators (ConfigMap/Secret with hash suffixes, image/replica transformers), and deciding Kustomize vs. Helm.
Ships in kubernetes-platform-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Kustomize solves the "same app, different environment" problem without a
templating language: a base holds the common, plain-YAML manifests, and
per-environment overlays apply structural patches (not string
substitution) on top. Done well, this eliminates copy-pasted,
drift-prone per-environment YAML trees. Done poorly — patches that
target the wrong resource, generators whose hash suffixes break
references, bases that aren't actually environment-agnostic — it
produces the same drift problem it was meant to solve, just spread
across more files. This skill covers structuring bases/overlays
correctly and knowing when Kustomize is the right tool versus Helm.
base/ manifests are shared and
overlays/{dev,staging,prod}/ hold only the environment-specific
differences.images: transformer) without touching the base Deployment YAML.kubectl apply -k output that doesn't match what was
expected from the overlay.kubectl (kubectl kustomize / kubectl apply -k)
since kubectl 1.14, but the bundled version often lags the standalone
kustomize CLI — for current features (e.g. replacements,
components), install the standalone binary (kustomize ≥ 5.0) and
use kustomize build | kubectl apply -f - in CI rather than relying on
kubectl's embedded version.kustomize edit subcommands (kustomize edit set image, kustomize edit set replicas) for scripting overlay changes without hand-editing
YAML — useful in CI to set an image tag from a build pipeline.base/ +
overlays/<env>/ is the most common; components/ for optional,
mixable feature patches introduced in Kustomize v3+).Structure the repo with a clear base/overlay split:
k8s/
├── base/
│ ├── kustomization.yaml
│ ├── deployment.yaml
│ ├── service.yaml
│ └── configmap.yaml
└── overlays/
├── dev/
│ ├── kustomization.yaml
│ └── patch-replicas.yaml
├── staging/
│ └── kustomization.yaml
└── prod/
├── kustomization.yaml
├── patch-resources.yaml
└── patch-replicas.yaml
Write the base as a fully valid, environment-agnostic manifest set — it should be deployable on its own with sane (usually minimal/dev- like) defaults:
# base/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
- configmap.yaml
commonLabels:
app.kubernetes.io/name: payments-api
Reference the base from each overlay and layer patches/generators on top:
# overlays/prod/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: payments-prod
resources:
- ../../base
patches:
- path: patch-replicas.yaml
target: { kind: Deployment, name: payments-api }
- path: patch-resources.yaml
target: { kind: Deployment, name: payments-api }
images:
- name: ghcr.io/example/payments-api
newTag: "1.4.2"
Prefer strategic-merge patches for structural changes, JSON6902 for precise/positional changes (e.g. removing an array element or patching a field strategic-merge can't target unambiguously):
# overlays/prod/patch-replicas.yaml (strategic merge)
apiVersion: apps/v1
kind: Deployment
metadata:
name: payments-api
spec:
replicas: 6
# JSON6902 example: remove a debug env var only in prod
- op: remove
path: /spec/template/spec/containers/0/env/2
JSON6902 patches are positional — a base change that reorders the
env array silently breaks the patch without an error. Prefer
strategic-merge or named-key patches wherever the field allows it.
Use generators instead of hand-maintained ConfigMaps/Secrets so content changes automatically produce a new resource name (forcing a pod roll) rather than silently patching a Secret in place:
configMapGenerator:
- name: payments-api-config
literals:
- LOG_LEVEL=info
files:
- config/app.yaml
Kustomize appends a content hash to the generated name
(payments-api-config-8f7d6c4b2a) and automatically updates every
reference to that ConfigMap in the rendered output — do not hardcode
the generated name elsewhere.
Use components/ for optional, mixable capability (e.g. a
"debug logging" or "canary" component an overlay can opt into)
instead of duplicating an entire overlay for one toggle:
# components/debug-logging/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
patches:
- path: patch-loglevel.yaml
# overlays/staging/kustomization.yaml
components:
- ../../components/debug-logging
Render and diff before applying:
kustomize build overlays/prod > /tmp/rendered-prod.yaml
kubectl diff -k overlays/prod
kubectl apply -k overlays/prod
kubectl diff against the live cluster is the single most valuable
step before applying to a shared environment — it surfaces drift
introduced by manual kubectl edits as well as overlay mistakes.
Decide Kustomize vs. Helm vs. both:
helm install), when non-YAML-shaped parameterization is
needed (loops, conditionals across many values), or when a
version/release model (helm history, helm rollback) is wanted.
See helm-chart-authoring.helm template to render a vendor chart, then feed the
output through Kustomize as a resource to apply organization-
specific patches the chart's values don't expose:
# overlays/prod/kustomization.yaml
resources:
- rendered-chart.yaml # output of: helm template ... > rendered-chart.yaml
patches:
- path: patch-extra-annotation.yaml
Kustomize's native helmCharts: field can also invoke helm template inline during kustomize build, avoiding a separate
render step, at the cost of requiring helm on the build machine
and --enable-helm on older Kustomize versions.kustomize build base | kubectl apply --dry-run=server -f -); if it
only works after an overlay patch, it isn't a real base.namePrefix/nameSuffix or namespace at the overlay level, not
the base, so the base stays reusable across namespaces/clusters.kustomize build for at least the prod
overlay in CI as a diffable artifact/PR comment — reviewers approving
a patch YAML rarely trace through what it produces by eye.commonLabels/commonAnnotations changes as blast-radius-wide —
they rewrite every matching resource's labels, which can break
selectors on Services/NetworkPolicies if applied inconsistently across
base and overlay.Symptom: kustomize build succeeds, but the applied Service no
longer selects any Pods after adding a commonLabels entry to an
overlay.
Fix: commonLabels rewrites both the resource's labels and
matching spec.selector fields where Kustomize recognizes the
reference (e.g. Deployment matchLabels), but hand-written Service
selector blocks written as fixed maps rather than templated may not
get the same rewrite in every Kustomize version — inspect the
rendered output (kustomize build) and confirm selectors match labels
exactly rather than trusting it silently worked.
Symptom: A ConfigMap/Secret generated via configMapGenerator
still references its content by a name that no longer exists after a
config change ("configmap not found").
Fix: Something outside the Kustomize-managed resource tree
(a manually written manifest, a script, or a Helm chart in a both
setup) is referencing the ConfigMap by its unsuffixed base name
instead of going through Kustomize's reference rewriting. Only
resources listed in the same kustomization.yaml tree get their
references automatically updated to the hashed name.
Symptom: A JSON6902 patch that removed an env var worked last
release but now errors with "index out of range" or silently patches
the wrong element.
Fix: JSON6902 array operations are positional. A base-level change
that added/reordered/removed an earlier array element shifts every
later index. Switch to a strategic-merge patch keyed by name for
named array elements (env vars, containers, volumes) instead of a
positional path wherever the resource kind supports it.
Symptom: kubectl apply -k behaves differently in CI than on a
developer's laptop for the same overlay.
Fix: kubectl's embedded Kustomize version is pinned to that
kubectl release and commonly lags the standalone kustomize CLI by
several minor versions, so newer fields (replacements, components)
silently no-op or error under the old built-in version. Standardize on
a pinned standalone kustomize binary version in both CI and local
tooling (kustomize build | kubectl apply -f -) rather than kubectl apply -k.
Scenario: payments-api needs three environments differing only in
replica count, resource limits, image tag, and (in prod only) an
Ingress host — everything else is identical.
k8s/
├── base/
│ ├── kustomization.yaml
│ ├── deployment.yaml
│ └── service.yaml
└── overlays/
├── dev/kustomization.yaml
├── staging/kustomization.yaml
└── prod/
├── kustomization.yaml
├── patch-replicas.yaml
├── patch-resources.yaml
└── ingress.yaml
# overlays/prod/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: payments-prod
resources:
- ../../base
- ingress.yaml
patches:
- path: patch-replicas.yaml
target: { kind: Deployment, name: payments-api }
- path: patch-resources.yaml
target: { kind: Deployment, name: payments-api }
images:
- name: ghcr.io/example/payments-api
newTag: "1.4.2"
configMapGenerator:
- name: payments-api-config
behavior: merge
literals:
- LOG_LEVEL=warn
kustomize build overlays/prod | kubectl apply --dry-run=server -f -
kubectl diff -k overlays/prod
kubectl apply -k overlays/prod
The rendered output shows the base Deployment with replicas: 6,
prod-sized resource limits, the pinned image tag, a merged (not
replaced) generated ConfigMap, and the prod-only Ingress — all without a
single duplicated line of the base manifest.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin kubernetes-platform-skills35 skills in this plugin
/cert-manager-tls-automationGuides installing and configuring cert-manager for automated TLS certificate issuance and renewal — Issuers vs. ClusterIssuers, ACME/ Let's Encrypt HTTP-01 and DNS-01 challenges, private-CA issuance, and integration with Ingress-nginx and Istio gateways. Use when a user asks to "automate TLS certificates on Kubernetes," "set up cert-manager with Let's Encrypt," "fix a stuck Certificate that won't become Ready," "use DNS-01 for a wildcard cert," "rotate mTLS certs automatically," or "issue certs from an internal CA."
/cni-networking-calico-flannelGuides choosing and installing a Kubernetes CNI plugin — Calico vs. Flannel — including NetworkPolicy enforcement capability differences, BGP vs. VXLAN/overlay data paths, and IP address management (IPAM) tradeoffs. Use when a user asks to "choose a CNI plugin for Kubernetes," "enable NetworkPolicy enforcement," "set up Calico with BGP peering," "install Flannel," "debug pod-to-pod connectivity across nodes," or "migrate from Flannel to Calico."
/complete-kubernetes-deployment-on-aks-from-scratchSequences a complete, end-to-end AKS deployment from a bare Azure subscription to a production-ready cluster serving a first workload — Azure landing zone prerequisites, AKS cluster and node pool provisioning, Azure CNI (with the Calico/Cilium alternative noted), ingress (Application Gateway Ingress Controller vs. ingress-nginx), cert-manager with Azure DNS, conformance validation, a Helm-deployed workload, and a node/cluster health baseline. This is an integration/orchestration skill that sequences several existing tool-specific skills in the correct order and flags the handoff points between them — it does not restate their internals. Use when a user asks to "deploy a Kubernetes cluster on AKS from scratch," "set up a new AKS environment end to end," "build a production AKS cluster from a fresh Azure subscription," or "give me the full sequence to go from nothing to a working AKS cluster."
/complete-kubernetes-deployment-on-eks-from-scratchSequences a complete, end-to-end EKS deployment from a bare AWS account to a production-ready cluster serving a first workload — landing zone/IAM prerequisites, EKS cluster and node group provisioning, VPC CNI (with the Calico/Cilium alternative noted), ingress (ALB vs. ingress-nginx), cert- manager with Route 53 DNS-01, conformance validation, a Helm-deployed workload, and a node/cluster health baseline. This is an integration/ orchestration skill that sequences several existing tool-specific skills in the correct order and flags the handoff points between them — it does not restate their internals. Use when a user asks to "deploy a Kubernetes cluster on EKS from scratch," "stand up a new EKS environment end to end," "build a production EKS cluster from a fresh AWS account," or "give me the full sequence to go from nothing to a working EKS cluster."
/complete-kubernetes-deployment-on-gke-from-scratchSequences a complete, end-to-end GKE deployment from a bare GCP project to a production-ready cluster serving a first workload — GCP landing zone prerequisites, GKE cluster and node pool provisioning, VPC-native/ Dataplane V2 CNI (with the Calico alternative noted), ingress (GKE Ingress/Gateway API vs. ingress-nginx), cert-manager with Cloud DNS, conformance validation, a Helm-deployed workload, and a node/cluster health baseline. This is an integration/orchestration skill that sequences several existing tool-specific skills in the correct order and flags the handoff points between them — it does not restate their internals. Use when a user asks to "deploy a Kubernetes cluster on GKE from scratch," "set up a new GKE environment end to end," "build a production GKE cluster from a fresh GCP project," or "give me the full sequence to go from nothing to a working GKE cluster."
/complete-kubernetes-deployment-on-oke-oci-from-scratchSequences a complete, end-to-end OKE (Oracle Container Engine for Kubernetes) deployment from a bare OCI tenancy to a production-ready cluster serving a first workload — OCI landing zone prerequisites (Compartments, Dynamic Groups), OKE Enhanced cluster and node pool provisioning, VCN-Native pod networking (with the Calico NetworkPolicy add-on noted), ingress (Native Ingress Controller vs. ingress-nginx), cert-manager with OCI DNS via a community webhook solver, conformance validation, a Helm-deployed workload, and a node/cluster health baseline. This is an integration/orchestration skill sequencing several existing tool-specific skills in the correct order and flagging the handoff points between them — it does not restate their internals. Use when a user asks to "deploy a Kubernetes cluster on OKE from scratch," "set up OKE on OCI end to end," "build a production OKE cluster from a fresh OCI tenancy," or "give me the full sequence to go from nothing to a working OKE cluster."
Other plugins' skills for the same job