Skip to content

Commit 4b34ff3

Browse files
authored
Merge pull request #5132 from samstride/issue/5127
Update README.md
2 parents 654d795 + 9107854 commit 4b34ff3

File tree

3 files changed

+69
-15
lines changed

3 files changed

+69
-15
lines changed

README.md

Lines changed: 69 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,16 @@ be updated on a regular basis going forward, and such updates
3636
will be reflected in the Kubernetes release notes.
3737

3838
| Kubectl version | Kustomize version |
39-
| --- | --- |
40-
| < v1.14 | n/a |
41-
| v1.14-v1.20 | v2.0.3 |
42-
| v1.21 | v4.0.5 |
43-
| v1.22 | v4.2.0 |
39+
| --------------- | ----------------- |
40+
| < v1.14 | n/a |
41+
| v1.14-v1.20 | v2.0.3 |
42+
| v1.21 | v4.0.5 |
43+
| v1.22 | v4.2.0 |
44+
| v1.23 | v4.4.1 |
45+
| v1.24 | v4.5.4 |
46+
| v1.25 | v4.5.7 |
47+
| v1.26 | v4.5.7 |
48+
| v1.27 | v5.0.1 |
4449

4550
[v2.0.3]: https://github.com/kubernetes-sigs/kustomize/releases/tag/v2.0.3
4651
[#2506]: https://github.com/kubernetes-sigs/kustomize/issues/2506
@@ -63,7 +68,37 @@ This file should declare those resources, and any
6368
customization to apply to them, e.g. _add a common
6469
label_.
6570

66-
![base image][imageBase]
71+
```
72+
73+
base: kustomization + resources
74+
75+
kustomization.yaml deployment.yaml service.yaml
76+
+---------------------------------------------+ +-------------------------------------------------------+ +-----------------------------------+
77+
| apiVersion: kustomize.config.k8s.io/v1beta1 | | apiVersion: apps/v1 | | apiVersion: v1 |
78+
| kind: Kustomization | | kind: Deployment | | kind: Service |
79+
|.commonLabels: | | metadata: | | metadata: |
80+
| app: myapp | | name: myapp | | name: myapp |
81+
| resources: | | spec: | | spec: |
82+
| - deployment.yaml | | selector: | | selector: |
83+
| - service.yaml | | matchLabels: | | app: myapp |
84+
| configMapGenerator: | | app: myapp | | ports: |
85+
| - name: myapp-map | | template: | | - port: 6060 |
86+
| literals: | | metadata: | | targetPort: 6060 |
87+
| - KEY=value | | labels: | +-----------------------------------+
88+
+---------------------------------------------+ | app: myapp |
89+
| spec: |
90+
| containers: |
91+
| - name: myapp |
92+
| image: myapp |
93+
| resources: |
94+
| limits: |
95+
| memory: "128Mi" |
96+
| cpu: "500m" |
97+
| ports: |
98+
| - containerPort: 6060 |
99+
+-------------------------------------------------------+
100+
101+
```
67102

68103
File structure:
69104

@@ -99,20 +134,41 @@ Manage traditional [variants] of a configuration - like
99134
_development_, _staging_ and _production_ - using
100135
[overlays] that modify a common [base].
101136
102-
![overlay image][imageOverlay]
137+
```
138+
139+
overlay: kustomization + patches
140+
141+
kustomization.yaml replica_count.yaml cpu_count.yaml
142+
+-----------------------------------------------+ +-------------------------------+ +------------------------------------------+
143+
| apiVersion: kustomize.config.k8s.io/v1beta1 | | apiVersion: apps/v1 | | apiVersion: apps/v1 |
144+
| kind: Kustomization | | kind: Deployment | | kind: Deployment |
145+
| commonLabels: | | metadata: | | metadata: |
146+
| variant: prod | | name: myapp | | name: myapp |
147+
| resources: | | spec: | | spec: |
148+
| - ../../base | | replicas: 80 | | template: |
149+
| patches: | +-------------------------------+ | spec: |
150+
| - path: replica_count.yaml | | containers: |
151+
| - path: cpu_count.yaml | | - name: myapp |
152+
+-----------------------------------------------+ | resources: |
153+
| limits: |
154+
| memory: "128Mi" |
155+
| cpu: "7000m" |
156+
+------------------------------------------+
157+
```
158+
103159
104160
File structure:
105161
> ```
106162
> ~/someApp
107163
> ├── base
108-
> │   ├── deployment.yaml
109-
> │   ├── kustomization.yaml
110-
> │   └── service.yaml
164+
> │ ├── deployment.yaml
165+
> │ ├── kustomization.yaml
166+
> │ └── service.yaml
111167
> └── overlays
112168
> ├── development
113-
> │   ├── cpu_count.yaml
114-
> │   ├── kustomization.yaml
115-
> │   └── replica_count.yaml
169+
> │ ├── cpu_count.yaml
170+
> │ ├── kustomization.yaml
171+
> │ └── replica_count.yaml
116172
> └── production
117173
> ├── cpu_count.yaml
118174
> ├── kustomization.yaml
@@ -166,8 +222,6 @@ is governed by the [Kubernetes Code of Conduct].
166222
[applied]: https://kubectl.docs.kubernetes.io/references/kustomize/glossary/#apply
167223
[base]: https://kubectl.docs.kubernetes.io/references/kustomize/glossary/#base
168224
[declarative configuration]: https://kubectl.docs.kubernetes.io/references/kustomize/glossary/#declarative-application-management
169-
[imageBase]: images/base.jpg
170-
[imageOverlay]: images/overlay.jpg
171225
[kubectl announcement]: https://kubernetes.io/blog/2019/03/25/kubernetes-1-14-release-announcement
172226
[kubernetes documentation]: https://kubernetes.io/docs/tasks/manage-kubernetes-objects/kustomization/
173227
[kubernetes style]: https://kubectl.docs.kubernetes.io/references/kustomize/glossary/#kubernetes-style-object

images/base.jpg

-39.5 KB
Binary file not shown.

images/overlay.jpg

-73 KB
Binary file not shown.

0 commit comments

Comments
 (0)