Skip to content

Commit 4f141c9

Browse files
committed
Update Konfig Quick Start guide
Signed-off-by: Mikhail Zholobov <legal90@gmail.com>
1 parent 40a6c74 commit 4f141c9

File tree

1 file changed

+61
-60
lines changed

1 file changed

+61
-60
lines changed

docs/user_docs/guides/working-with-konfig/3-quick-start.md

Lines changed: 61 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The programming language of the project is KCL, not JSON/YAML which Kubernetes r
4141
Enter stack dir `examples/appops/nginx-example/dev` and compile:
4242

4343
```bash
44-
cd examples/appops/nginx-example/dev && kcl run -D env=dev
44+
cd examples/appops/nginx-example/dev && kcl run -D appenv=dev
4545
```
4646

4747
The output YAML is:
@@ -50,71 +50,71 @@ The output YAML is:
5050
apiVersion: apps/v1
5151
kind: Deployment
5252
metadata:
53-
name: sampleappdev
54-
namespace: sampleapp
53+
name: sampleapp-dev
54+
namespace: sampleappns-dev
5555
spec:
5656
replicas: 1
5757
selector:
5858
matchLabels:
5959
app.kubernetes.io/name: sampleapp
6060
app.kubernetes.io/env: dev
6161
app.kubernetes.io/instance: sampleapp-dev
62-
app.k8s.io/component: sampleappdev
62+
app.k8s.io/component: sampleapp-dev
6363
template:
6464
metadata:
6565
labels:
6666
app.kubernetes.io/name: sampleapp
6767
app.kubernetes.io/env: dev
6868
app.kubernetes.io/instance: sampleapp-dev
69-
app.k8s.io/component: sampleappdev
69+
app.k8s.io/component: sampleapp-dev
7070
spec:
7171
containers:
72-
- env:
73-
- name: MY_ENV
74-
value: MY_VALUE
75-
image: nginx:1.7.8
76-
name: main
77-
ports:
78-
- containerPort: 80
79-
protocol: TCP
80-
resources:
81-
limits:
82-
cpu: "100m"
83-
memory: "100Mi"
84-
ephemeral-storage: "1Gi"
85-
requests:
86-
cpu: "100m"
87-
memory: "100Mi"
88-
ephemeral-storage: "1Gi"
89-
volumeMounts: []
72+
- env:
73+
- name: MY_ENV
74+
value: MY_VALUE
75+
image: nginx:1.7.8
76+
name: main
77+
ports:
78+
- containerPort: 80
79+
protocol: TCP
80+
resources:
81+
limits:
82+
cpu: '100m'
83+
memory: '100Mi'
84+
ephemeral-storage: '1Gi'
85+
requests:
86+
cpu: '100m'
87+
memory: '100Mi'
88+
ephemeral-storage: '1Gi'
89+
volumeMounts: []
9090
---
9191
apiVersion: v1
9292
kind: Namespace
9393
metadata:
94-
name: sampleapp
94+
name: sampleappns-dev
9595
---
9696
apiVersion: v1
9797
kind: Service
9898
metadata:
9999
name: nginx
100-
namespace: sampleapp
100+
namespace: sampleappns-dev
101101
spec:
102102
ports:
103-
- nodePort: 30201
104-
port: 80
105-
targetPort: 80
103+
- nodePort: 30201
104+
port: 80
105+
targetPort: 80
106106
selector:
107107
app.kubernetes.io/name: sampleapp
108108
app.kubernetes.io/env: dev
109109
app.kubernetes.io/instance: sampleapp-dev
110-
app.k8s.io/component: sampleappdev
110+
app.k8s.io/component: sampleapp-dev
111111
type: NodePort
112112
```
113113
114114
After compiling, we can see three resources:
115115
116-
- A `Deployment` with the name `sampleappprod`
117-
- A `Namespace` with the name `sampleapp`
116+
- A `Deployment` with the name `sampleapp-dev`
117+
- A `Namespace` with the name `sampleappns-dev`
118118
- A `Service` with the name `nginx`
119119

120120
### 2. Modification
@@ -131,71 +131,72 @@ The `image` attribute in the `Server` model is used to declare the application's
131131
Recompile the configuration code to obtain the modified YAML output:
132132

133133
```shell
134-
kcl run
134+
kcl run -D appenv=dev
135135
```
136136

137137
```yaml
138138
apiVersion: apps/v1
139139
kind: Deployment
140140
metadata:
141-
name: sampleappdev
142-
namespace: sampleapp
141+
name: sampleapp-dev
142+
namespace: sampleappns-dev
143143
spec:
144144
replicas: 1
145145
selector:
146146
matchLabels:
147147
app.kubernetes.io/name: sampleapp
148148
app.kubernetes.io/env: dev
149149
app.kubernetes.io/instance: sampleapp-dev
150-
app.k8s.io/component: sampleappdev
150+
app.k8s.io/component: sampleapp-dev
151151
template:
152152
metadata:
153153
labels:
154154
app.kubernetes.io/name: sampleapp
155155
app.kubernetes.io/env: dev
156156
app.kubernetes.io/instance: sampleapp-dev
157-
app.k8s.io/component: sampleappdev
157+
app.k8s.io/component: sampleapp-dev
158158
spec:
159159
containers:
160-
- env:
161-
- name: MY_ENV
162-
value: MY_VALUE
163-
image: nginx:latest
164-
name: main
165-
ports:
166-
- containerPort: 80
167-
protocol: TCP
168-
resources:
169-
limits:
170-
cpu: "100m"
171-
memory: "100Mi"
172-
ephemeral-storage: "1Gi"
173-
requests:
174-
cpu: "100m"
175-
memory: "100Mi"
176-
ephemeral-storage: "1Gi"
177-
volumeMounts: []
160+
- env:
161+
- name: MY_ENV
162+
value: MY_VALUE
163+
image: nginx:1.7.8
164+
name: main
165+
ports:
166+
- containerPort: 80
167+
protocol: TCP
168+
resources:
169+
limits:
170+
cpu: '100m'
171+
memory: '100Mi'
172+
ephemeral-storage: '1Gi'
173+
requests:
174+
cpu: '100m'
175+
memory: '100Mi'
176+
ephemeral-storage: '1Gi'
177+
volumeMounts: []
178178
---
179179
apiVersion: v1
180180
kind: Namespace
181181
metadata:
182-
name: sampleapp
182+
name: sampleappns-dev
183183
---
184184
apiVersion: v1
185185
kind: Service
186186
metadata:
187187
name: nginx
188-
namespace: sampleapp
188+
namespace: sampleappns-dev
189189
spec:
190190
ports:
191-
- nodePort: 30201
192-
port: 80
193-
targetPort: 80
191+
- nodePort: 30201
192+
port: 80
193+
targetPort: 80
194194
selector:
195195
app.kubernetes.io/name: sampleapp
196196
app.kubernetes.io/env: dev
197197
app.kubernetes.io/instance: sampleapp-dev
198-
app.k8s.io/component: sampleappdev
198+
app.k8s.io/component: sampleapp-dev
199+
type: NodePort
199200
```
200201

201202
## Resources

0 commit comments

Comments
 (0)