Skip to content

Commit bc0b63c

Browse files
Kalyan Reddy DaidaKalyan Reddy Daida
authored andcommitted
Welcome to Stack Simplify
1 parent a4f921e commit bc0b63c

File tree

10 files changed

+149
-59
lines changed

10 files changed

+149
-59
lines changed

06-YAML-Basics/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,55 @@
11
# YAML Basics
22

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+
353
# Kubernetes Editors - Visual Studio Code
454
555
## Step-01: Kubernetes

07-PODs-with-YAML/02-pod-base-template.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

07-PODs-with-YAML/README.md

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,42 @@
11
# PODs with YAML
22

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**
166
```yml
177
apiVersion: v1
188
kind: Pod
199
metadata:
2010
name: myapp-pod
2111
labels:
22-
name: myapp
12+
app: myapp
2313
spec:
2414
containers:
2515
- name: myapp
2616
image: stacksimplify/kubenginx:1.0.0
2717
ports:
2818
- containerPort: 80
2919
```
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**
3921
```
4022
kubectl apply -f pod-definition.yml
41-
```
42-
- Verify pods
43-
```
4423
kubectl get pods
45-
kubectl describe pod <pod-name>
46-
kubectl describe pod myapp-pod
4724
```
48-
- **Observation:** Only container inside pod gets killed and restarts with new container image.
4925

50-
- **pod-definition.yml**
26+
## Step-02: Create a NodePort Service
27+
- **03-pod-nodeport-service.yml**
5128
```yml
5229
apiVersion: v1
53-
kind: Pod
30+
kind: Service
5431
metadata:
55-
name: myapp-pod
56-
labels:
57-
name: myapp
32+
name: myapp-pod-nodeport-service
5833
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
6441
```
42+
File renamed without changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion:
2+
kind:
3+
metadata:
4+
5+
spec:
6+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion:
2+
kind:
3+
metadata:
4+
5+
spec:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion:
2+
kind:
3+
metadata:
4+
5+
spec:
6+

07-PODs-with-YAML/03-pod-definition.yml renamed to 07-PODs-with-YAML/kube-manifests/backup/02-pod-definition.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ metadata:
77
spec:
88
containers:
99
- name: myapp
10-
image: stacksimplify/kubenginx:2.0.0
10+
image: stacksimplify/kubenginx:1.0.0
1111
ports:
1212
- containerPort: 80
File renamed without changes.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
```

0 commit comments

Comments
 (0)