File tree Expand file tree Collapse file tree 1 file changed +79
-0
lines changed
Kubernetes/Kubernetes Demo Files Expand file tree Collapse file tree 1 file changed +79
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ *******************************************************************
3
+ .
4
+ . Demo: ReplicaSet | youtube.com/SrinathChalla
5
+ .
6
+
7
+ *******************************************************************
8
+ ReplicaSet YAML file
9
+
10
+ # nginx-rs.yaml
11
+ apiVersion: apps/v1
12
+ kind: ReplicaSet
13
+ metadata:
14
+ name: nginx-rs
15
+ spec:
16
+ replicas: 3
17
+ template:
18
+ metadata:
19
+ name: nginx-pod
20
+ labels:
21
+ app: nginx-app
22
+ tier: frontend
23
+ spec:
24
+ containers:
25
+ - name: nginx-container
26
+ image: nginx
27
+ ports:
28
+ - containerPort: 80
29
+ selector:
30
+ matchLabels:
31
+ app: nginx-app
32
+ matchExpressions:
33
+ - {key: tier, operator: In, values: [frontend]}
34
+
35
+
36
+ *******************************************************************
37
+ # 2. Create and display replicaset
38
+
39
+ kubectl create -f nginx-rs.yaml
40
+ kubectl get po -o wide
41
+ kubectl get po -l app=nginx-app
42
+ kubectl get rs nginx-rs -o wide
43
+ kubectl describe rs nginx-rs
44
+
45
+ *******************************************************************
46
+ # 3. Automatic Pod Reschedule
47
+
48
+ kubectl get po -o wide --watch
49
+ kubectl get po -o wide
50
+ kubectl get nodes
51
+
52
+ *******************************************************************
53
+ # 4. Scale up pods
54
+
55
+ kubectl scale rs nginx-rs --replicas=5
56
+ kubectl get rs nginx-rs -o wide
57
+ kubectl get po -o wide
58
+
59
+ *******************************************************************
60
+ # 5. Scale down pods
61
+
62
+ kubectl scale rs nginx-rs --replicas=3
63
+ kubectl get rs nginx-rs -o wide
64
+ kubectl get po -o wide
65
+
66
+ *******************************************************************
67
+ # 6. Cleanup
68
+
69
+ kubectl delete -f nginx-rs.yaml
70
+ kubectl get rs
71
+ kubectl get po -l app=nginx-app
72
+
73
+ *******************************************************************
74
+
75
+
76
+
77
+
78
+
79
+
You can’t perform that action at this time.
0 commit comments