Loading...
Loading...
Use when customizing Kubernetes configurations without templates using Kustomize overlays and patches.
npx skill4agent add thebushidocollective/han kustomize-basicsapp/
├── base/
│ ├── kustomization.yaml
│ ├── deployment.yaml
│ └── service.yaml
└── overlays/
├── development/
│ └── kustomization.yaml
└── production/
└── kustomization.yaml# base/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
commonLabels:
app: myapp
namePrefix: myapp-
images:
- name: myapp
newTag: v1.0.0# overlays/production/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
- ../../base
replicas:
- name: myapp-deployment
count: 5
images:
- name: myapp
newTag: v2.0.0
patches:
- patch: |-
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-deployment
spec:
template:
spec:
containers:
- name: myapp
resources:
limits:
memory: "1Gi"
cpu: "1000m"# Build kustomization
kustomize build base/
# Build overlay
kustomize build overlays/production/
# Apply with kubectl
kubectl apply -k overlays/production/
# Diff before apply
kubectl diff -k overlays/production/commonLabels:
app: myapp
environment: productionnamePrefix: prod-
nameSuffix: -v2namespace: productionconfigMapGenerator:
- name: app-config
files:
- config.properties
literals:
- LOG_LEVEL=infosecretGenerator:
- name: app-secrets
literals:
- password=secret123patches:
- path: patch-deployment.yamlpatchesJson6902:
- target:
group: apps
version: v1
kind: Deployment
name: myapp
patch: |-
- op: replace
path: /spec/replicas
value: 3