apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
- ingress.yamlKustomize customizes Kubernetes objects through a kustomization file and is supported by kubectl.
Kustomize overlays, patches, generators, and CRD/CR authoring patterns.
Declarative YAML customization without templates.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
- ingress.yamlKustomize customizes Kubernetes objects through a kustomization file and is supported by kubectl.
kubectl apply -k overlays/prodkubectl kustomize overlays/prodApply shared metadata to all resources.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: prod
commonLabels:
app.kubernetes.io/part-of: storefrontimages:
- name: ghcr.io/example/api
newTag: 2.1.0Overlay environment-specific changes.
patches:
- target:
kind: Deployment
name: api
patch: |
- op: replace
path: /spec/replicas
value: 5Create config objects as part of the build.
configMapGenerator:
- name: app-config
literals:
- APP_ENV=production
- LOG_LEVEL=infosecretGenerator:
- name: app-secrets
literals:
- API_KEY=replace-meDefine your own APIs and manifest shapes.
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: widgets.example.com
spec:
group: example.com
names:
plural: widgets
singular: widget
kind: Widget
shortNames: ["wdg"]
scope: Namespaced
versions:
- name: v1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
size:
type: stringCRDs let you extend the Kubernetes API with your own resource types and versions.
apiVersion: example.com/v1
kind: Widget
metadata:
name: blue-widget
spec:
size: largekubectl explain widgets.spec --api-version=example.com/v1