forked from sandervanvugt/cka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjan20-live-class-student-history.txt
254 lines (253 loc) · 7.49 KB
/
jan20-live-class-student-history.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
# this is an unedited copy of the student history file used in the
# live class I've done on Jan. 16/17 2020. Use at your own risk
mkdir -p .kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
exit
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
cd .kube/
ls -l
cat config
kubectl get all
kubectl get nodes
cd
kubectl get pods -n kube-system
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
kubectl get pods -n kube-system
sysctl -a | grep bridge-nf-call-iptables
exit
kubectl get nodes
ssh root@worker2
ssh root@worker3
kubectl get nodes
exit
cat /etc/hosts
su -
kubectl api-resources
kubectl api-resources | less
kubectl get ns
kubectl create namespace mynamespace
kubectl create -h | less
kubectl create namespace -h
kubect get ns
kubectl get ns
kubectl explain pod
kubectl explain pod.metadata
git clone https://github.com/sandervanvugt/cka
cd cka
ls
vim ex1.yaml
kubectl create -f ex1.yaml
kubectl get pods
kubectl get pods -n mynamespace
kubectl get pods --all-namespaces
kubectl completion bash > ~/.kube/completion.bash.inc
history
cat ex1.yaml
kubectl create deployment --image=busybox
kubectl create deployment failin --image=busybox
kubectl get pods
vim exam.txt
./counter.sh 10
vim ex4.yaml
kubectl create -f ex4.yaml
vim ex4.yaml
kubectl create -f ex4.yaml
vim ex4.yaml
kubectl create -f ex4.yaml
cat ex4.yaml
vim ex4.yaml
kubectl get pods
kubectl describe pods myapp-pod
cp ex4.yaml ex4b.yaml
vim ex4b.yaml
kubectl create -f ex4b.yaml; kubectl get pods
kubectl get pods
ls
cat ex1.yaml
kubectl create deploy nginx-ex5 --image=nginx --replicas=5
kubectl run deploy nginx-ex5 --image=nginx --replicas=5
kubectl create deploy nginx-ex5b --image=nginx
kubectl edit deploy nginx-ex5b
kubectl get pods
kubectl scale deployment nginx-ex5b --replicas=5
kubectl run mydeploy --image busybox --command sleep 10000 --replicas 3 --dry-run -o yaml > mydep.yaml
vim mydep.yaml
kubectl create -f mydep.yaml
vim mydep.yaml
kubectl get all --selector run=mydeploy
kubectl delete deployment mydeploy
history
kubectl get nodes
kubectl explain pod.spec | less
kubectl explain pod.spec.volumes | less
cd cka/
ls
cd ..
git clone https://github.com/sandervanvugt/ckad
cd ckad/
ls
vim pv.yaml
kubectl create -f pv.yaml
kubectl get pv
vim pvc.yaml
kubectl create -f pvc.yaml
kubectl get pvc
kubectl get pv
vim pv-pod.yaml
kubectl explain pv.spec
kubectl explain pv.spec.emptydir
kubectl explain pod.spec.volumes.emptydir
kubectl explain pod.spec.volumes.emptyDir
kubectl explain pv.spec.emptyDir
vim pv.yaml
kubectl create -f pv.yaml
vim pv.yaml
kubectl get pv
kubectl get pv pv-volume -o yaml > ex7.yaml
vim ex7.yaml
kubectl create -f ex7.yaml
kubectl get pv emtpy-volume -o yaml
kubectl explain persistentvolume.spec.persistentvolumereclaimpolicy
kubectl explain persistentvolume.spec.persistentVolumeReclaimPolicy
vim pv-pod.yaml
kubectl create secret generic ex8-secret --from-literal=userpw=s3crt3tPW
kubectl get secret ex8-secret -o yaml
cd ../cka
ls
cd ../ckad/
ls
cd ../cka
vim ex8-pod.yaml
kubectl get pv
kubectl get secret
vim ex8-pod.yaml
kubectl create -f ex8-pod.yaml
vim ex8-pod.yaml
kubectl create -f ex8-pod.yaml
kubectl get pods
kubectl exec -it secret-test-pod -- /bin/bash
kubectl get secret
kubectl get secret ex8-secret -o yaml
./counter.sh 10
kubectl get pods -n kube-system
sudo docker ps
sudo ps aux | grep etcd
sudo find / -name "etcdctl"
sudo etcdctl
sudo yum provides etcdctl
ping 8.8.8.8
sudo -i
source <(kubectl completion bash)
kubectl -h | less
kubectl cordon -h | less
kubectl drain -h | less
sudo yum install -y bash-completion
source <(kubectl completion bash)
kubectl get nodes
kubectl cordon worker2.example.com
kubectl get nodes
kubectl uncordon worker2.example.com
kubectl get nodes
kubectl drain worker2.example.com
exit
source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> > ~/.bashrc
echo "source <(kubectl completion bash)" >> ~/.bashrc
exit
cd ckad/
./countdown 20
grep busybox2 *
vim busybox.yaml
kubectl create -f busybox.yaml
exit
kubectl get pods
kubectl get svc
kubectl exec -it busybox2 -- nslookup kubernetes
cd cka
ls
vim pod-and-service-dns.yaml
kubectl create -f pod-and-service-dns.yaml
kubectl exec -it busybox22 -- nslookup default-subdomain
kubectl exec -it busybox22 -- nslookup busybox-1
kubectl get pods -n kube-system
kubectl get service -n kube-system
kubectl exec -it busybox22 -- cat /etc/resolv.conf
kubectl -n kube-system describe pods coredns-6955765f44-4mg22
for p in $(kubectl get pods -n kube-system -l k8s-app=kube-dns -o name); do kubectl logs -n kube-system $p; done
kubectl get svc -n kube-system
kubectl get ep kube-dns -n kube-system
kubectl get pods --show-labels --all-namespaces
kubectl run busy22 --image busybox --restart Never; kubectl expose pod busy22 --name mysvc --port 80 --type ClusterIP; kubectl exec busy22 -- sh -c "mkdir -p /var/exam && nslookup busy22 > /var/exam/dnsnames.txt"
kubectl exec busy22 -- sh -c "mkdir -p /var/exam && nslookup busy22 > /var/exam/dnsnames.txt"
kubectl -it exec busy22 -- sh -c "mkdir -p /var/exam && nslookup busy22 > /var/exam/dnsnames.txt"
kubectl get svc
kubectl get pods
kubectl -it exec busybox22 -- sh -c "mkdir -p /var/exam && nslookup busy22 > /var/exam/dnsnames.txt"
kubectl -it exec busybox22 -- sh -c "mkdir -p /var/exam && nslookup busybox22 > /var/exam/dnsnames.txt"
kubectl -it exec busybox22 -- nslookup busybox22
kubectl get
kubectl -it exec busybox22 -- nslookup myapp-pod
kubectl get sv
kubectl -it exec busybox22 -- nslookup mysvc
iptables -L
sudo iptables -L
ssh root@worker1
kubectl get pods -n kube-system
ssh root@worker3
kubectl get pods -o wide
./counter.sh 10
git clone https://github.com/kubernetes-incubator/metrics-server.git
kubectl create -f metrics-server/deploy/1.8+/
kubectl get all -n kube-system
kubectl top pods
kubectl top pods --all-namespaces
kubectl -n kube-system edit deployment metrics-server
kubectl -n kube-system logs metric-server
kubectl -n kube-system logs metrics-server-d98f494df-jhdht
kubectl top pods --all-namespaces
ssh worker3
kubectl get pods --all-namespaces
kubectl top pods --all-namespaces
kubectl delete pod/busy22
kubectl top pods --all-namespaces
cd
vim .kube/config
sudo vim /etc/kubernetes/admin.conf
kubectl get pods -n kube-system
su -i
su -
kubectl get pods -n kube-system
kubectl -n kube-system delete pod metrics-server-d98f494df-jhdht
kubectl top pods --all-namespaces
kubectl create deployment mydaemonset --image nginx -o yaml --dry-run > ds.yaml
vim ds.yaml
kubectl api-resources | grep -i daemon
vim ds.yaml
kubectl create -f ds.yaml
cd cka
ls
vim daemonset-fluentd.yaml
kubectl explain DaemonSet
kubectl explain DaemonSet | less
vim daemonset-fluentd.yaml
kubectl create -f daemonset-fluentd.yaml
kubectl get daemonset.apps/fluentd-elasticsearch
kubectl get daemonset
vim daemonset-fluentd.yaml
kubectl -n kube-system get daemonset fluentd-elasticsearch -o yaml | less
history | grep edit
kubectl -n kube-system edit deployment metrics-server
history | grep delete
kubectl -n kube-system delete pod metrics-server-5d7898476-nhlq7
kubectl top pods --all-namespaces
kubectl -n kube-system edit deployment metrics-server
kubectl top pods --all-namespaces
kubectl top pods
kubectl -n kube-system edit deployment metrics-server
kubectl get pods -n kube-system
kubectl -n kube-system exec -it metrics-server-5d7898476-465j7 -- /bin/sh
kubectl -n kube-system exec -it metrics-server-5d7898476-465j7 -- /bin/bash
kubectl -n kube-system exec -it metrics-server-5d7898476-465j7 -- bash
history
exit