-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDeploy-Labs.txt
125 lines (86 loc) · 2.3 KB
/
Deploy-Labs.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
Lab 1
vi nginx-rc.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx
spec:
replicas: 3
selector:
app: nginx
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.12.2
ports:
- containerPort: 80
kubectl create -f nginx-rc.yaml
kubectl get pods
kubectl rolling-update nginx --image=nginx
kubectl get pods
kubectl delete pods <pod_name>
kubectl get pods
kubectl edit rc nginx
kubectl get pods
kubectl delete -f nginx-rc.yaml
Lab 2.
kubectl create deployment nginx --image=nginx:1.15 --replicas=5
kubectl get deployment/nginx
Kubectl edit deploy nginx
kubectl describe deployment/nginx
kubectl rollout history deployment/nginx
kubectl set image deployment/nginx nginx=nginx:1.16
kubectl rollout history deployment/nginx
kubectl rollout undo deployment/nginx
kubectl rollout undo deployment/nginx --to-revision=2
kubectl scale --replicas=50 deployment/nginx
kubectl rollout pause deployment/nginx
kubectl rollout status deployment/nginx
kubectl rollout resume deployment/nginx
Lab 3.
vi hpa-deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx-deployment
template:
metadata:
labels:
app: nginx-deployment
spec:
containers:
- image: nginx
name: nginx
resources:
limits:
cpu: 200m
memory: 100Mi
requests:
cpu: 100m
memory: 50Mi
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
kubectl create -f hpa-deploy.yaml
kubectl get deployments
kubectl top pods
kubectl autoscale deployment nginx-deployment --min=3 --max=6 --cpu-percent=50
kubectl get hpa
kubectl describe hpa nginx-deployment
kubectl exec -it <pod_name> bash
# while true; do true; done
kubectl get hpa nginx-deployment
kubectl get deployments nginx-deployment
kubectl describe hpa nginx-deployment
kubectl delete hpa nginx-deployment
kubectl delete deployments nginx-deployment