sandervanvugt

Untitled

Sep 17th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.99 KB | None | 0 0
  1. ROOT COMMANDS
  2. [root@control etcd]# history
  3. 1 cd cka
  4. 2 ./counter.sh 14
  5. 3 vim exercise3.yaml
  6. 4 kubectl create -f exercise3.yaml
  7. 5 exit
  8. 6 tail -n 1 /etc/passwd
  9. 7 cd /home/anna
  10. 8 openssl genrsa -out anna.key 2048
  11. 9 ls
  12. 10 openssl req -new -key anna.key -out anna.csr -subj "/CN=anna"
  13. 11 openssl x509 -req -in anna.csr -CA /etc/kubernetes/pki/ca.crt -CAkey /etc/kubernetes/pki/ca.key -CAcreateserial -out anna.crt -days 600
  14. 12 ls
  15. 13 mkdir .certs
  16. 14 mv anna.crt anna.key .certs/
  17. 15 ls .certs/
  18. 16 exit
  19. 17 cd /home/anna/
  20. 18 mkdir .kube
  21. 19 pwd
  22. 20 cp /etc/kubernetes/admin.conf /home/anna/.kube/config
  23. 21 vim .kube/config
  24. 22 chown -R anna /home/anna
  25. 23 ls -a
  26. 24 ls -al
  27. 25 chown -R anna:anna /home/anna
  28. 26 cd .certs
  29. 27 ls -l
  30. 28 chmod 400 anna.key
  31. 29 exit
  32. 30 vim /etc/hosts
  33. 31 history
  34. 32 ip a
  35. 33 vim /etc/hosts
  36. 34 yum install vim git bash-completion
  37. 35 git clone https://github.com/sandervanvugt/cka
  38. 36 cd cka
  39. 37 ls
  40. 38 vim setup-docker.sh
  41. 39 ./setup-docker.sh
  42. 40 vim setup-kubetools.sh
  43. 41 ./setup-kubetools.sh
  44. 42 ls
  45. 43 ./counter.sh 14
  46. 44 kubeadm init
  47. 45 vim /etc/hosts
  48. 46 kubeadm reset
  49. 47 kubeadm init
  50. 48 vim /tmp/todo.txt
  51. 49 su - student
  52. 50 history
  53. 51 su - student
  54. 52 su - anna
  55. 53 exit
  56. 54 etcdctl --help | less
  57. 55 ETCDCTL_API=3 etcdctl --help | less
  58. 56 ps aux | grep etcd
  59. 57 ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 snapshot save snapshotdb
  60. 58 ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert /etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/etcd/server.crt --key /etc/kubernetes/pki/etcd/server.key snapshot save snapshotdb
  61. 59 ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert /etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/etcd/server.crt --key /etc/kubernetes/pki/etcd/server.key get /
  62. 60 ETCDCTL_API=3 etcdctl --endpoints=https://127.0.0.1:2379 --cacert /etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/etcd/server.crt --key /etc/kubernetes/pki/etcd/server.key get / --prefix --keys-only
  63. 61 cd /etc/kubernetes/pki/etcd/
  64. 62 ls
  65. 63 history
  66.  
  67. USER COMMANDS
  68. OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"curl\": executable file not found in $PATH": unknown
  69. command terminated with exit code 126
  70. [student@control ckad]$ history
  71. 1 mkdir .kube
  72. 2 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  73. 3 sudo chown $(id -u):$(id -g) $HOME/.kube/config
  74. 4 vim .kube/config
  75. 5 kubectl get all
  76. 6 kubectl get all --all-namespaces
  77. 7 kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
  78. 8 kubectl get all --all-namespaces
  79. 9 kubectl get pods --all-namespaces
  80. 10 vim /tmp/todo.txt
  81. 11 ssh root@worker1
  82. 12 ssh root@worker2
  83. 13 kubectl get nodes
  84. 14 history
  85. 15 exit
  86. 16 history
  87. 17 vim exercise2.yaml
  88. 18 kubectl -h
  89. 19 kubectl completion -h
  90. 20 source <(kubectl completion bash)
  91. 21 kubectl create namespace -h
  92. 22 kubectl create namespace mynamespace
  93. 23 vim exercise2.yaml
  94. 24 kubectl create -f exercise2.yaml
  95. 25 kubectl run alpine2 --image=alpine --command sleep 3600 -n mynamespace --dry-run=client -o yaml > rtex2.yaml
  96. 26 vim rtex2.yaml
  97. 27 kubectl explain pods.spec
  98. 28 vim rtex2.yaml
  99. 29 kubectl get pods --namespace=mynamespace
  100. 30 kubectl describe pods alpine --namespace=mynamespace
  101. 31 kubectl get pods alpine --namespace=mynamespace -o yaml | less
  102. 32 cd cka
  103. 33 su -
  104. 34 vim exercise3.yaml
  105. 35 kubectl create -f exercise3.yaml
  106. 36 kubectl explain pods
  107. 37 vim exercise3.yaml
  108. 38 kubectl create -f exercise3.yaml
  109. 39 kubectl run --image=nginx mynginx --dry-run=client -o yaml | less
  110. 40 vim exercise3.yaml
  111. 41 kubectl create -f exercise3.yaml
  112. 42 kubectl get pods
  113. 43 watch -n1 kubectl get pods
  114. 44 kubectl describe pods multi-containers
  115. 45 kubectl delete pods multi-containers
  116. 46 vim exercise3.yaml
  117. 47 kubectl apply -f exercise3.yaml
  118. 48 kubectl get pods
  119. 49 kubectl delete --grace-period=0 --force pods multi-containers
  120. 50 kubectl get nodes
  121. 51 vim exercise4b.txt
  122. 52 kubectl taint nodes master key:NoSchedule-
  123. 53 kubectl taint node master key:NoSchedule-
  124. 54 kubectl get nodes
  125. 55 kubectl taint node control.example.com key:NoSchedule-
  126. 56 kubectl taint nodes --all node-role.kubernetes.io/master-
  127. 57 git clone https://github.com/sandervanvugt/cka
  128. 58 cd cka
  129. 59 kubectl label nodes worker2.example.com disktype=ssd
  130. 60 kubectl get nodes --show-labels
  131. 61 vim selector-pod.yaml
  132. 62 kubectl apply -f selector-pod.yaml
  133. 63 kubectl get pods -o wide
  134. 64 kubectl run nginx1 --image=nginx
  135. 65 kubectl run nginx2 --image=nginx
  136. 66 kubectl run nginx3 --image=nginx
  137. 67 kubectl get pods -o wide
  138. 68 kubectl get nodes -o wide
  139. 69 kubectl describe nodes control.example.com
  140. 70 kubectl tain nodes worker1.example.com example-key=value1:NoSchedule
  141. 71 kubectl taint nodes worker1.example.com example-key=value1:NoSchedule
  142. 72 kubectl run nginx4 --image=nginx
  143. 73 kubectl run nginx5 --image=nginx
  144. 74 kubectl run nginx6 --image=nginx
  145. 75 kubectl get pods -o wide
  146. 76 kubectl describe nodes worker1.example.com | less
  147. 77 kubectl create deployment nginx-taint --image=nginx
  148. 78 kubectl scale deployment nginx-taint --replicas=3
  149. 79 kubectl get pods -o yaml
  150. 80 kubectl get pods -o wide
  151. 81 vim taint-toleration.yaml
  152. 82 kubectl create -f taint-toleration.yaml
  153. 83 kubectl get pods -o wide
  154. 84 vim taint-toleration.yaml
  155. 85 history | grep git
  156. 86 kubectl get daemonsets.apps --namespace kube-system
  157. 87 kubectl get daemonsets.apps --namespace kube-system --show-labels
  158. 88 kubectl get all --namespace=kube-system --selector name=weave-net
  159. 89 kubectl get all --namespace=kube-system --selector name=weave-net -o wide
  160. 90 ./counter.sh 13
  161. 91 vim ex251.yaml
  162. 92 kubectl explain --recursive pods
  163. 93 history
  164. 94 kubectl create deployment nginx-ex5 --image=nginx --replicas=5
  165. 95 kubectl get all --selector app=nginx-ex5
  166. 96 kubectl get all
  167. 97 kubectl get all --selector app=nginx-ex5
  168. 98 ./counter.sh 5
  169. 99 vim ws4.yaml
  170. 100 kubectl create -f ws4.yaml ; watch -n1 kubectl get pods
  171. 101 kubectl describe pods myapp-pod
  172. 102 ./counter.sh 4
  173. 103 vim ex15.yaml
  174. 104 kubectl apply -f ex15.yaml
  175. 105 vim ex15.yaml
  176. 106 kubectl get all --selector name=nginx-ds
  177. 107 kubectl get daemonsets
  178. 108 kubectl get all --selector name=nginx-ds -o wide
  179. 109 remove noschedule
  180. 110 kubectl taint node worker1.example.com
  181. 111 kubectl describe nodes worker1.example.com | less
  182. 112 kubectl taint node worker1.example.com example-key=value1:NoSchedule-
  183. 113 kubectl explain pods.spec.containers.spec
  184. 114 kubectl explain pods.spec.containers
  185. 115 kubectl explain pods.spec.containers | less
  186. 116 kubectl explain pods.spec.containers --recursive | less
  187. 117 history
  188. 118 ip a
  189. 119 ./counter.sh 4
  190. 120 kubectl create deployment mynginx --image=nginx:1.14
  191. 121 kubectl get all --selector app=mynginx
  192. 122 kubectl scale deployment mynginx --replicas=5
  193. 123 kubectl get all --selector app=mynginx
  194. 124 kubectl edit deployments.apps mynginx
  195. 125 kubectl get all --selector app=mynginx
  196. 126 kubectl get deployments.apps mynginx -o yaml | less
  197. 127 kubectl explain deployment.spec.strategy
  198. 128 kubectl edit -h
  199. 129 kubectl edit --record=true deployments.apps mynginx
  200. 130 kubectl rollout history deployment mynginx
  201. 131 kubectl create deployment -h | less
  202. 132 sudo useradd anna && sudo cd /home/anna
  203. 133 pwd
  204. 134 sudo -i
  205. 135 kubectl config set-credentials anna --client-certificate=/home/anna/.certs/anna.crt --client-key=/home/anna/.certs/anna.key
  206. 136 kubectl config set-context anna-context --cluster=kubernetes --user=anna
  207. 137 pwd
  208. 138 su -
  209. 139 vim podacessrole.yaml
  210. 140 kubectl create -f podacessrole.yaml
  211. 141 vim rolebinding.yaml
  212. 142 kubectl create -f rolebinding.yaml
  213. 143 kubectl run rolepod --image=nginx
  214. 144 su - anna
  215. 145 exit
  216. 146 cd cka
  217. 147 vim rolebinding.yaml
  218. 148 kubectl config view
  219. 149 sudo su - anna
  220. 150 kubectl cordon worker1
  221. 151 kubectl cordon worker1.example.com
  222. 152 kubectl completion -h
  223. 153 source <(kubectl completion bash)
  224. 154 history
  225. 155 kubectl auth can-i get pods --as anna
  226. 156 ./counter.sh 15
  227. 157 kubectl top -h
  228. 158 kubectl top pod
  229. 159 git clone https://github.com/kubernetes-sigs/metrics-server
  230. 160 ls
  231. 161 cd metrics-server/
  232. 162 ls
  233. 163 cd manifests/
  234. 164 ls
  235. 165 cd ../..
  236. 166 kubectl create -f metrics-server/manifests/base/
  237. 167 vim metrics-server/manifests/base/kustomization.yaml
  238. 168 kubectl api-versions | less
  239. 169 kubectl get pods
  240. 170 kubectl get pods -o kube-system
  241. 171 kubectl get pods --name-space kube-system
  242. 172 kubectl get pods --namespace kube-system
  243. 173 kubectl apply -k metrics-server/manifests/base/
  244. 174 vim metrics-server/manifests/base/kustomization.yaml
  245. 175 kubectl apply -k metrics-server/manifests/base/
  246. 176 kubectl delete -f metrics-server/manifests/base/
  247. 177 kubectl apply -k metrics-server/manifests/base/
  248. 178 vim metrics-server/manifests/base/kustomization.yaml
  249. 179 kubectl kubectl get deployments --namespace kube-system
  250. 180 kubectl get deployments --namespace kube-system
  251. 181 kubectl get pods --namespace kube-system
  252. 182 kubectl -n kube-system edit deployments.apps metrics-server
  253. 183 kubectl -n kube-system logs metrics-server-755b999b8-swzqk
  254. 184 history
  255. 185 kubectl get pods --namespace kube-system
  256. 186 kubectl top
  257. 187 kubectl top pod
  258. 188 kubectl top pod -h
  259. 189 kubectl top pod --sort-by=cpu
  260. 190 ./counter.sh 5
  261. 191 vim ww.yaml
  262. 192 cat ww.yaml
  263. 193 kubectl run busybox22 --image=busybox:1.28 -- sleep 3600
  264. 194 kubectl get pods busybox22 -o yaml | less
  265. 195 cat ww.yaml
  266. 196 kubectl expose pod busybox22 --port 80 --name=mysvc --type=ClusterIP
  267. 197 kubectl exec -it busybox22 -- nslookup mysvc
  268. 198 kubectl exec -it busybox22 -- nslookup busybox22
  269. 199 kubectl get pods
  270. 200 kubectl get pods -n kube-system
  271. 201 kubectl get svc -n kube-system
  272. 202 kubectl exec -it busybox22 -- cat /etc/resolv.conf
  273. 203 kubectl -n kube-system describe pods coredns-f9fd979d6-qhdt7
  274. 204 kubectl logs -n kube-system coredns-f9fd979d6-qhdt7
  275. 205 kubectl get ep
  276. 206 kubectl get svc -n kube-system kube-dns -o yaml | less
  277. 207 kubectl describe svc -n kube-system kube-dns
  278. 208 kubectl get pods -o wide
  279. 209 sudo iptables -L
  280. 210 ssh root@worker1
  281. 211 ./counter.sh 14
  282. 212 ssh root@worker2
  283. 213 kubectl get pods
  284. 214 ssh root@worker2
  285. 215 kubectl get pods
  286. 216 ssh root@worker2
  287. 217 ls
  288. 218 vim setup-lb.sh
  289. 219 ./counter.sh
  290. 220 ./counter.sh 15
  291. 221 etcdctl --help
  292. 222 sudo yum search etcdctl
  293. 223 sudo yum provides */etcdctl
  294. 224 ping nu.nl
  295. 225 sudo yum install etcd
  296. 226 sudo -i
  297. 227 kubectl create deployment nginxsvc --image=nginx
  298. 228 kubectl scale deployment nginxsvc --replicas=3
  299. 229 kubectl expose deployment nginxsvc --port=80
  300. 230 kubectl get svc
  301. 231 kubectl get endpoints
  302. 232 curl http://10.106.68.11
  303. 233 kubectl edit svc nginxsvc
  304. 234 kubectl get svc
  305. 235 curl http://192.168.4.81:32000
  306. 236 curl http://192.168.4.82:32000
  307. 237 curl http://192.168.4.80:32000
  308. 238 cd ..
  309. 239 ls
  310. 240 git clone https://github.com/sandervanvugt/ckad
  311. 241 cd ckad
  312. 242 vim nginxsvc-ingress.yaml
  313. 243 kubectl create -f nginxsvc-ingress.yaml
  314. 244 kubectl exec -it busybox22 -- curl nginxsvc.info
  315. 245 history
Add Comment
Please, Sign In to add comment