Skip to content

Instantly share code, notes, and snippets.

@lalyos
Last active November 28, 2019 22:37
Show Gist options
  • Save lalyos/e01f70a8c8e5f854e849474290aa9715 to your computer and use it in GitHub Desktop.
Save lalyos/e01f70a8c8e5f854e849474290aa9715 to your computer and use it in GitHub Desktop.
Kustomize illustrated

Kustomize illustrated

Its much easier to understand how kustomize work if you see some pictures ...

```
+----------------------------------------------------------------------+
├── base |BASE |
│ ├── kustomization.yaml |+--------------------------+ +--------------------+ +----------------+|
│ ├── deploy.yaml ||# base/kustomization.yaml | |# base/deploy.yaml | |# base/svc.yaml ||
│ └── svc.yaml |+--------------------------+ +--------------------+ +----------------+|
├── prod ||resources: | |apiVersion: apps/v1 | |apiVersion: v1 ||
│ └── kustomization.yaml || - deploy.yaml | |kind: Deployment | |kind: Service ||
└── qa || - svc.yaml | |metadata: | |metadata: ||
└── kustomization.yaml |+--------------------------+ | labels: | | labels: ||
| | app: nginx | | app: nginx ||
| | name: nginx | | name: nginx || -
| |spec: | |spec: ||
| | selector: | | selector: ||
| | matchLabels: | | app: nginx ||
| | app: nginx | +----------------+|
| | template: | |
| | metadata: | |
| | labels: | |
| | app: nginx | |
| +--------------------+ |
+----------------------------------------------------------------------+
+-----------------------------+
|PROD - shared ns |
|+---------------------------+|
|| # prod/kustomization.yaml ||
|+---------------------------+|
|| commonLabels: ||
|| env: prod ||
|| namePrefix: prod- ||
|| bases: ||
|| - ../base ||
|+---------------------------+|
+-----------------------------+
+----------------------------------------------------------------------------------------------+
|GENERATED |
|+--------------------+ +-------------------+ +--------------------+ +--------------------+ |
||# deploy.yaml | |# svc.yaml | |# deploy.yaml | |# svc.yaml | |
|+--------------------+ +-------------------+ +--------------------+ +--------------------+ |
||apiVersion: apps/v1 | |apiVersion: v1 | |apiVersion: apps/v1 | |apiVersion: v1 | |
||kind: Deployment | |kind: Service | |kind: Deployment | |kind: Service | |
||metadata: | |metadata: | |metadata: | |metadata: | |
|| annotations: | | annotations: | | annotations: | | annotations: | |
|| labels: | | labels: | | labels: | | labels: | |
|| app: nginx | | app: nginx | | app: nginx | | app: nginx | |
|| env: prod | | env: prod | | env: qa | | env: qa | |
|| name: prod-nginx | | name: prod-nginx | | name: qa-nginx | | name: qa-nginx | |
|| namespace: kustom | | namespace: kustom| | namespace: kustom | | namespace: kustom | |
||spec: | |spec: | |spec: | |spec: | |
|| selector: | | selector: | | selector: | | selector: | |
|| matchLabels: | | app: nginx | | matchLabels: | | app: nginx | |
|| app: nginx | | env: prod | | app: nginx | | env: qa | |
|| env: prod | +-------------------+ | env: qa | +--------------------+ |
|| template: | | template: | |
|| metadata: | | metadata: | |
|| labels: | | labels: | |
|| app: nginx | | app: nginx | |
|| env: prod | | env: qa | |
|| | +--------------------+ |
|+--------------------+ |
+----------------------------------------------------------------------------------------------+
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment