File tree Expand file tree Collapse file tree 10 files changed +149
-59
lines changed Expand file tree Collapse file tree 10 files changed +149
-59
lines changed Original file line number Diff line number Diff line change 1
1
# YAML Basics
2
2
3
+ ## Step-01:
4
+ ### Key Value Pairs
5
+ - Space after colon is mandatory to differentiate key and value
6
+ ``` yml
7
+ Name : Kalyan
8
+ City : New Jersey
9
+ ` ` `
10
+ ### Array / Lists
11
+ - Dash indicates an element of an array
12
+ ` ` ` yml
13
+ Employees :
14
+ - Kalyan
15
+ - John
16
+ - David
17
+
18
+ Departments :
19
+ - HR
20
+ - Training
21
+ - Development
22
+ - Infrastructure
23
+ ` ` `
24
+ ### Dictionary / Map
25
+ - Set of properties grouped together after an item
26
+ - Equal amount of blank space required for all the items under a dictionary
27
+ ` ` ` yml
28
+ Employee :
29
+ name : Kalyan
30
+ city : Hyderabad
31
+ email : dkalyanreddy@gmail.com
32
+ department : HR
33
+ ` ` `
34
+
35
+ ### Spaces in YAML
36
+
37
+
38
+
39
+ ### Key Value / Dictionary / Lists
40
+
41
+
42
+ ### Dictionary with in another Dictionary
43
+
44
+
45
+ ### Dictionary vs List vs List of Dictionaries
46
+
47
+
48
+ ### Dictionary is Unordered, List is Ordered
49
+
50
+ ### Comments lines start with HASH
51
+
52
+
3
53
# Kubernetes Editors - Visual Studio Code
4
54
5
55
## Step-01: Kubernetes
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
# PODs with YAML
2
2
3
- ## Step-01: Create Pod
4
- - We are going to create a very basic pod definition.
5
- #### Imperative Style
6
- ```
7
- kubectl create -f pod-definition.yml
8
- kubectl get pods
9
- ```
10
- #### Declarative Style
11
- ```
12
- kubectl apply -f pod-definition.yml
13
- kubectl get pods
14
- ```
15
- - ** pod-definition.yml**
3
+ ## Step-01: Create Simple Pod Definition using YAML
4
+ - We are going to create a very basic pod definition
5
+ - ** 02-pod-definition.yml**
16
6
``` yml
17
7
apiVersion : v1
18
8
kind : Pod
19
9
metadata :
20
10
name : myapp-pod
21
11
labels :
22
- name : myapp
12
+ app : myapp
23
13
spec :
24
14
containers :
25
15
- name : myapp
26
16
image : stacksimplify/kubenginx:1.0.0
27
17
ports :
28
18
- containerPort : 80
29
19
` ` `
30
-
31
- ## Step-02: Change Image Version
32
- - Change image version from 1.0.0 to 2.0.0
33
- ### Imperative Style
34
- ` ` `
35
- kubectl replace -f pod-definition.yml
36
- kubectl get pods
37
- ```
38
- ### Declarative Style
20
+ - **Create Pod**
39
21
` ` `
40
22
kubectl apply -f pod-definition.yml
41
- ```
42
- - Verify pods
43
- ```
44
23
kubectl get pods
45
- kubectl describe pod <pod-name>
46
- kubectl describe pod myapp-pod
47
24
```
48
- - ** Observation:** Only container inside pod gets killed and restarts with new container image.
49
25
50
- - ** pod-definition.yml**
26
+ ## Step-02: Create a NodePort Service
27
+ - ** 03-pod-nodeport-service.yml**
51
28
``` yml
52
29
apiVersion : v1
53
- kind : Pod
30
+ kind : Service
54
31
metadata :
55
- name : myapp-pod
56
- labels :
57
- name : myapp
32
+ name : myapp-pod-nodeport-service
58
33
spec :
59
- containers :
60
- - name : myapp
61
- image : stacksimplify/kubenginx:2.0.0
62
- ports :
63
- - containerPort : 80
34
+ type : NodePort
35
+ selector :
36
+ app : myapp
37
+ ports :
38
+ - port : 80
39
+ targetPort : 80
40
+ nodePort : 31231
64
41
` ` `
42
+
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ apiVersion :
2
+ kind :
3
+ metadata :
4
+
5
+ spec :
6
+
Original file line number Diff line number Diff line change
1
+ apiVersion :
2
+ kind :
3
+ metadata :
4
+
5
+ spec:
Original file line number Diff line number Diff line change
1
+ apiVersion :
2
+ kind :
3
+ metadata :
4
+
5
+ spec :
6
+
Original file line number Diff line number Diff line change @@ -7,6 +7,6 @@ metadata:
7
7
spec :
8
8
containers :
9
9
- name : myapp
10
- image : stacksimplify/kubenginx:2 .0.0
10
+ image : stacksimplify/kubenginx:1 .0.0
11
11
ports :
12
12
- containerPort : 80
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ # PODs with YAML
2
+
3
+ ## Step-01: Create Pod
4
+ - We are going to create a very basic pod definition.
5
+ #### Imperative Style
6
+ ```
7
+ kubectl create -f pod-definition.yml
8
+ kubectl get pods
9
+ ```
10
+ #### Declarative Style
11
+ ```
12
+ kubectl apply -f pod-definition.yml
13
+ kubectl get pods
14
+ ```
15
+ - ** pod-definition.yml**
16
+ ``` yml
17
+ apiVersion : v1
18
+ kind : Pod
19
+ metadata :
20
+ name : myapp-pod
21
+ labels :
22
+ app : myapp
23
+ spec :
24
+ containers :
25
+ - name : myapp
26
+ image : stacksimplify/kubenginx:1.0.0
27
+ ports :
28
+ - containerPort : 80
29
+ ` ` `
30
+
31
+ ## Step-02: Change Image Version
32
+ - Change image version from 1.0.0 to 2.0.0
33
+ ### Imperative Style
34
+ ` ` `
35
+ kubectl replace -f pod-definition.yml
36
+ kubectl get pods
37
+ ```
38
+ ### Declarative Style
39
+ ```
40
+ kubectl apply -f pod-definition.yml
41
+ ```
42
+ - Verify pods
43
+ ```
44
+ kubectl get pods
45
+ kubectl describe pod <pod-name>
46
+ kubectl describe pod myapp-pod
47
+ ```
48
+ - ** Observation:** Only container inside pod gets killed and restarts with new container image.
49
+
50
+ - ** pod-definition.yml**
51
+ ``` yml
52
+ apiVersion : v1
53
+ kind : Pod
54
+ metadata :
55
+ name : myapp-pod
56
+ labels :
57
+ name : myapp
58
+ spec :
59
+ containers :
60
+ - name : myapp
61
+ image : stacksimplify/kubenginx:2.0.0
62
+ ports :
63
+ - containerPort : 80
64
+ ` ` `
You can’t perform that action at this time.
0 commit comments