Kustomize Flashcards
What is kustomize?
- kubernetes native tool
- for customizing kubernetes manifest files
- doesnt require complex templating or additional tools
- uses yaml
- built into kubectl
How can you use kustomize?
kubectl apply -k < kustomize-directory >
While having inside a kustomization.yaml
Why is kustomize used?
- helps customizing config files in a template free way
- provides methods and common values like generators to make customization easier#
- common values help making labels, names and annotations consistent
- generators let you define secrets and config files for you pods
- easiliy define changes for different environments
- done by using patching and overlays, that needs a single folder for each environment
- easy to use
What are basic folders used by kustomize and what do they contain?
- base:
- overlay: contains environment specific folders which contain the kustomization.yaml and config.properties
What does the kustomization.yaml file contain?
- resources: which manifest files should be included in kustomization
- common attributes: specify common configurations that you want to be consistent, like labels, annotations and names
- generators: for creating/managing configmaps and kubernetes secrets
Show an example for a kustomization.yaml
resources:
- deployment.yaml
- service.yaml
commonLabels:
app: mykustomapp
commonAnnotations:
app: mykustom-annotations
namePrefix:
kustom-
nameSuffix:
-v1
configMapGenerator:
- name: mykustom-map
env: config.properties
Show an example for an overlay implementation
Via folder structure with patch-files.
Folder structure:
– overlays
|– dev
|– config.properties
|– kustomization.yaml
|– replicas.yaml
kustomization.yaml
namespace: prod
patches:
- replicas.yaml
configMapGenerator:
- name: mykustom-map
env: config.properties
How do you take a loot at the kustomize file that is going to be applied?
‘kubectl kustomize’