Kustomize
This is the first article out of three articles on Kubernetes tool : Kustomize. This article covers the basics.
Kustomize
Kustomize is a CLI for managing K8s style objects with declarative ways
==============================
Edit name attribute by adding prefix/suffix to it
namePrefix: prod-
nameSuffix: "-001"
Edit labels (k,v)
commonLabels:
app: my-wordpress
Edit annotations (k,v)
commonAnnotations:
description: this is test
Edit namespace
namespace: my-namespace
==============================
Edit attribute to Multiple Files.
kustomize edit add resource deployment.yaml
kustomize edit add resource service.yaml
commonLabels:
app: my-wordpress
resources:
- deployment.yaml
- service.yaml
==============================
Edit attribute to Multiple directory.
commonLabels:
app: my-wordpress
bases:
- ./wordpress
- ./mysql
==============================
$ kustomize build $DEV_HOME
Its output is concatenated YAML documents. They can be directed to file or to kubectl
kubectl apply -k $DEV_HOME
kustomize build $DEV_HOME | kubectl apply -f -
kubectl kustomize $DEV_HOME
==============================
Useful Terms
base: A combination of a kustomization and resource(s). Bases can be referred to by other kustomizations.
kustomization: Refers to a kustomization.yaml file, or more generally to a directory containing the kustomization.yaml file and all the relative file paths that the YAML file references.
overlay: A combination of a kustomization that refers to a base, and a patch. An overlay may have multiple bases.
patch: General instructions to modify a resource.
resource: Any valid YAML file that defines an object with a kind and a metadata/name field.
target: The argument to kustomize build. For example, kustomize build $TARGET. A target must be a path or a URL to a kustomization. A target can be a base or an overlay.
variant: The outcome of applying an overlay to a base.
Read More: https://github.com/kubernetes-sigs/kustomize/blob/master/docs/glossary.md
Reference:
https://www.mirantis.com/blog/introduction-to-kustomize-part-1-creating-a-kubernetes-app-out-of-multiple-pieces/
https://www.mirantis.com/blog/introduction-to-kustomize-part-2-overriding-values-with-overlays/
https://github.com/kubernetes-sigs/kustomize
https://kustomize.io/
Other similar tools
https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/declarative-application-management.md
https://docs.google.com/spreadsheets/d/1FCgqz1Ci7_VCz_wdh8vBitZ3giBtac_H8SBw4uxnrsE/edit#gid=0
Kustomize
Kustomize is a CLI for managing K8s style objects with declarative ways
==============================
Edit name attribute by adding prefix/suffix to it
namePrefix: prod-
nameSuffix: "-001"
Edit labels (k,v)
commonLabels:
app: my-wordpress
Edit annotations (k,v)
commonAnnotations:
description: this is test
Edit namespace
namespace: my-namespace
==============================
Edit attribute to Multiple Files.
kustomize edit add resource deployment.yaml
kustomize edit add resource service.yaml
commonLabels:
app: my-wordpress
resources:
- deployment.yaml
- service.yaml
==============================
Edit attribute to Multiple directory.
commonLabels:
app: my-wordpress
bases:
- ./wordpress
- ./mysql
==============================
$ kustomize build $DEV_HOME
Its output is concatenated YAML documents. They can be directed to file or to kubectl
kubectl apply -k $DEV_HOME
kustomize build $DEV_HOME | kubectl apply -f -
kubectl kustomize $DEV_HOME
==============================
Useful Terms
base: A combination of a kustomization and resource(s). Bases can be referred to by other kustomizations.
kustomization: Refers to a kustomization.yaml file, or more generally to a directory containing the kustomization.yaml file and all the relative file paths that the YAML file references.
overlay: A combination of a kustomization that refers to a base, and a patch. An overlay may have multiple bases.
patch: General instructions to modify a resource.
resource: Any valid YAML file that defines an object with a kind and a metadata/name field.
target: The argument to kustomize build. For example, kustomize build $TARGET. A target must be a path or a URL to a kustomization. A target can be a base or an overlay.
variant: The outcome of applying an overlay to a base.
Read More: https://github.com/kubernetes-sigs/kustomize/blob/master/docs/glossary.md
Reference:
https://www.mirantis.com/blog/introduction-to-kustomize-part-1-creating-a-kubernetes-app-out-of-multiple-pieces/
https://www.mirantis.com/blog/introduction-to-kustomize-part-2-overriding-values-with-overlays/
https://github.com/kubernetes-sigs/kustomize
https://kustomize.io/
Other similar tools
https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/declarative-application-management.md
https://docs.google.com/spreadsheets/d/1FCgqz1Ci7_VCz_wdh8vBitZ3giBtac_H8SBw4uxnrsE/edit#gid=0
0 comments:
Post a Comment