forked from Edu-CKA-Jan06/Training_Documents
-
Notifications
You must be signed in to change notification settings - Fork 0
/
5.+Replication+Controller.txt
58 lines (45 loc) · 1.3 KB
/
5.+Replication+Controller.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
*******************************************************************
1. Replication Controller YAML file
# nginx-rc.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx-rc
spec:
replicas: 3
template:
metadata:
name: nginx-pod
labels:
app: nginx-app
spec:
containers:
- name: nginx-container
image: nginx
ports:
- containerPort: 80
selector:
app: nginx-app
*******************************************************************
# 2. Create and display
kubectl create -f nginx-rc.yaml
kubectl get po -o wide
kubectl get po -l app=nginx-app
kubectl get rc nginx-rc
kubectl describe rc nginx-rc
*******************************************************************
# 4. Scaling up cluster
kubectl scale rc nginx-rc --replicas=5
kubectl get rc nginx-rc
kubectl get po -o wide
*******************************************************************
# 5. Scalling down
kubectl scale rc nginx-rc --replicas=3
kubectl get rc nginx-rc
kubectl get po -o wide
*******************************************************************
# 6. Cleanup
kubectl delete -f nginx-rc.yaml
kubectl get rc
kubectl get po -l app=nginx-app
*******************************************************************