Advertisement
sandervanvugt

ckad march 23 day2

Mar 8th, 2023
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.44 KB | None | 0 0
  1. student@student-virtual-machine:~/ckad$ history
  2. 1 history
  3. 2 minikube start --vm-driver=docker --cni=calico
  4. 3 kubectl get all
  5. 4 history
  6. 5 minikube status
  7. 6 minikube ssh
  8. 7 kubectl get all
  9. 8 minikube --help | less
  10. 9 minikube dashboard
  11. 10 kubectl get all
  12. 11 kubectl create deploy firstnginx --image=nginx --replicas=3
  13. 12 kubectl get all
  14. 13 history
  15. 14 kubectl -h | less
  16. 15 kubectl completion -h | less
  17. 16 source <(kubectl completion bash)
  18. 17 vim ~/.kube/config
  19. 18 kubectl get pods
  20. 19 kubectl get ns
  21. 20 kubectl config view
  22. 21 kubectl config set-context minikube --namespace=kube-system
  23. 22 kubectl get pods
  24. 23 kubectl config set-context --current --namespace=default
  25. 24 ls *file
  26. 25 cd dockerfile/
  27. 26 vim Dockerfile
  28. 27 docker build -t centmap .
  29. 28 docker images
  30. 29 docker save --help
  31. 30 docker save centmap
  32. 31 docker save centmap -o centmap.tar
  33. 32 ls -l centmap.tar
  34. 33 history
  35. 34 kubectl get pods
  36. 35 kubectl delete pod dontuseme-5dc7b7f996-dph5m
  37. 36 kubectl get pods
  38. 37 kubectl run -h | less
  39. 38 kubectl run nginxxxx --image=nginx
  40. 39 kubectl get pods
  41. 40 history
  42. 41 kubectl get pods
  43. 42 kubectl delete pod nginxxxx
  44. 43 kubectl get pods
  45. 44 kubectl explain pods
  46. 45 kubectl explain pods.spec | less
  47. 46 history
  48. 47 kubectl get pods
  49. 48 kubectl get pods firstnginx-5444786b89-m48zg -o yaml | less
  50. 49 kubectl describe pod firstnginx-5444786b89-wh24c | less
  51. 50 vim ex1.txt
  52. 51 history
  53. 52 kubectl describe pod firstnginx-5444786b89-wh24c | less
  54. 53 kubectl get pods -o wide
  55. 54 cd
  56. 55 kubectl run nginxxxx --image=nginx --dry-run=client -o yaml
  57. 56 kubectl run nginxxxx --image=nginx --dry-run=client -o yaml > nginxxxx.yaml
  58. 57 vim nginxxxx.yaml
  59. 58 kubectl apply -f nginxxxx.yaml
  60. 59 vim nginxxxx.yaml
  61. 60 kubectl apply -f nginxxxx.yaml
  62. 61 vim nginxxxx.yaml
  63. 62 kubectl apply -f nginxxxx.yaml
  64. 63 history
  65. 64 vim nginxxxx.yaml
  66. 65 kubectl delete -f nginxxxx.yaml
  67. 66 kubectl apply -f nginxxxx.yaml
  68. 67 vim nginxxxx.yaml
  69. 68 kubectl apply -f nginxxxx.yaml
  70. 69 cd ckad/
  71. 70 vim sidecar.yaml
  72. 71 kubectl apply -f sidecar.yaml
  73. 72 kubectl get pods
  74. 73 kubectl exec -it sidecar-pod -c sidecar -- /bin/bash
  75. 74 kubectl apply -f sidecar.yaml
  76. 75 vim sidecar.yaml
  77. 76 vim morevolumes.yaml
  78. 77 vim init-example1.yaml
  79. 78 kubectl create -f init-example1.yaml
  80. 79 kubectl get pods
  81. 80 vim init-example2.yaml
  82. 81 kubectl apply -f init-example2.yaml
  83. 82 kubectl get pods
  84. 83 kubectl get ns
  85. 84 kubectl get pods -n kube-system
  86. 85 kubectl get pods -n kubernetes-dashboard
  87. 86 kubectl describe ns default
  88. 87 kubectl get pods
  89. 88 kubectl get pods -A
  90. 89 kubectl create ns secret
  91. 90 kubectl config set-context --current --namespace=secret
  92. 91 kubectl get pods
  93. 92 kubectl run busybox --image=busybox -n secret
  94. 93 kubectl get pods
  95. 94 vim busybox-ns.yaml
  96. 95 kubectl create -f busybox-ns.yaml
  97. 96 kubectl get pods
  98. 97 kubectl describe pod busybox
  99. 98 kubectl delete pod busybox
  100. 99 kubectl run busybox --image=busybox -n secret -- sleep 3600
  101. 100 kubectl get pods
  102. 101 kubectl config set-context --current --namespace=default
  103. 102 kubectl run nginx-lab --image=nginx
  104. 103 kubectl get pods
  105. 104 k get pods
  106. 105 ./countdown 12
  107. 106 kubectl run faildb --image=mariadb
  108. 107 kubectl get pods
  109. 108 kubectl describe pod init-demo2
  110. 109 kubectl describe pod faildb
  111. 110 kubectl logs faildb
  112. 111 kubectl delete pod faildb
  113. 112 kubectl run -h | less
  114. 113 kubectl run mydb --image=mariadb --env=MARIADB_ROOT_PASSWORD=password
  115. 114 kubectl get pods
  116. 115 kubectl exec mydb -- set
  117. 116 kubectl exec mydb -- env
  118. 117 kubectl run busybox
  119. 118 kubectl run busybox --image=busbox
  120. 119 kubectl get pods
  121. 120 kubectl describe pod busybox
  122. 121 kubectl get pods
  123. 122 kubectl delete pod busybox
  124. 123 kubectl run busybox --image=busybox
  125. 124 kubectl get pods
  126. 125 kubectl describe pod busybox
  127. 126 minikube ssh
  128. 127 kubectl get pods
  129. 128 kubectl delete pod busybox
  130. 129 history
  131. 130 kubectl explain pod.spec | less
  132. 131 kubectl explain pod.spec.securityContext | less
  133. 132 vim securitycontextdemo2.yaml
  134. 133 kubectl apply -f securitycontextdemo2.yaml
  135. 134 kubectl exec -it security-context-demo -- sh
  136. 135 vim securitycontextdemo.yaml
  137. 136 kubectl create -f securitycontextdemo.yaml
  138. 137 kubectl get pods
  139. 138 kubectl describe pod nginxsecure
  140. 139 kubectl delete -f securitycontextdemo.yaml
  141. 140 kubectl create job -h | less
  142. 141 kubectl create job onejob --image=busybox -- date
  143. 142 kubectl get pods,jobs
  144. 143 kubectl get jobs onejob -o yaml | less
  145. 144 kubectl get pods,jobs
  146. 145 kubectl delete job onejob
  147. 146 kubectl get pods,jobs
  148. 147 kubectl create job mynewjob --image=busybox --dry-run=client -o yaml -- sleep 5 > mynewjob.yaml
  149. 148 vim mynewjob.yaml
  150. 149 kubectl create -f mynewjob.yaml
  151. 150 vim mynewjob.yaml
  152. 151 kubectl create -f mynewjob.yaml
  153. 152 kubectl get pods,jobs
  154. 153 history
  155. 154 kubectl create cronjob
  156. 155 kubectl create cronjob -h | less
  157. 156 kubectl create cronjob runme --image=busybox --schedule="* * * * *" -- echo greetings from the cluster
  158. 157 kubectl get cronjobs,jobs,pods
  159. 158 kubectl logs runme-27971466-wnnj8
  160. 159 kubectl get cronjobs,jobs,pods
  161. 160 kubectl create job --from=cronjob runme
  162. 161 kubectl create job myjob --from=cronjob runme
  163. 162 kubectl create job -h
  164. 163 kubectl create job myjob --from=cronjob/runme
  165. 164 kubectl get cronjobs,jobs,pods
  166. 165 kubectl create cronjob -h | less
  167. 166 create create quota -h | less
  168. 167 kubectl create quota -h | less
  169. 168 kubectl create deploy myapp --image=nginx
  170. 169 kubectl set resources -h | less
  171. 170 kubectl set resources deploy myapp --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi
  172. 171 kubectl get deploy myapp -o yaml
  173. 172 vim frontend-resources.yaml
  174. 173 kubectl apply -f frontend-resources.yaml
  175. 174 kubectl get pods
  176. 175 kubectl describe pod frontend
  177. 176 sudo reboot
  178. 177 cd ckad/
  179. 178 ./countdown 2
  180. 179 ./countdown 12
  181. 180 cat dockerfile/ex1.txt
  182. 181 ./countdown 15
  183. 182 sudo apt install vim git -y
  184. 183 free -m
  185. 184 lscpu | less
  186. 185 df -h
  187. 186 git clone https://github.com/sandervanvugt/ckad
  188. 187 cd ckad
  189. 188 ls
  190. 189 ./minikube-docker-setup.sh
  191. 190 cd ckad/
  192. 191 ./countdown 3
  193. 192 kubectl explain pod.spec | less
  194. 193 cd dockerfile/
  195. 194 vim ex2.txt
  196. 195 kubectl explain pod.spec | less
  197. 196 minikube start
  198. 197 df -h
  199. 198 sudo lsblk
  200. 199 sudo poweroff
  201. 200 df -h
  202. 201 sudo gdisk /dev/sda
  203. 202 sudo reboot
  204. 203 df -h
  205. 204 mount | grep sda3
  206. 205 sudo resize2fs /dev/sda3
  207. 206 df -h
  208. 207 history
  209. 208 minikube start
  210. 209 kubectl get pods
  211. 210 minikube ssh
  212. 211 kubectl get pods
  213. 212 kubectl describe pods frontend
  214. 213 kubectl get pods
  215. 214 kubectl describe pod frontend | less
  216. 215 cd ckad
  217. 216 kubectl delete -f frontend.yaml
  218. 217 kubectl delete -f frontend-resources.yaml
  219. 218 vim frontend-resources.yaml
  220. 219 kubectl apply -f frontend-resources.yaml
  221. 220 kubectl get pods
  222. 221 source <(kubectl completion bash)
  223. 222 kubectl describe pod frontend
  224. 223 vim frontend-resources.yaml
  225. 224 kubectl delete pod frontend
  226. 225 kubectl apply -f frontend-resources.yaml
  227. 226 kubectl get pods
  228. 227 kubectl delete pods frontend
  229. 228 history
  230. 229 minikube ssh
  231. 230 vim zs.yaml
  232. 231 kubectl apply -f zs.yaml
  233. 232 kubectl get pods
  234. 233 kubectl describe pod my-webserver-pod
  235. 234 minikube ssh
  236. 235 kubectl get pods
  237. 236 minikube ssh
  238. 237 kubectl run sanderdb --image=mariadb
  239. 238 minikube ssh
  240. 239 kubectl get pods
  241. 240 minikube ssh
  242. 241 kubectl delete pod sanderdb
  243. 242 sudo -i
  244. 243 minikube ssh
  245. 244 ./countdown 7
  246. 245 kubectl get pods
  247. 246 kubectl run sanderpod --image=mariadb
  248. 247 kubectl logs sanderpod
  249. 248 minikube ssh
  250. 249 kubectl delete pod sanderpod
  251. 250 minikube ssh
  252. 251 vim busybox-ready.yaml
  253. 252 kubectl create -f busybox-ready.yaml
  254. 253 kubectl get pods
  255. 254 kubectl describe pod busybox-ready
  256. 255 kubectl edit pod busybox-ready
  257. 256 kubectl exec -it busybox-ready -- sh
  258. 257 kubectl get pods
  259. 258 kubectl get deploy,jobs,pods
  260. 259 for i in $(kubectl get deploy,jobs,pods); do kubectl delete $i; done
  261. 260 for i in $(kubectl get deploy,jobs,pods | awk '{ print $1 }'); do kubectl delete $i; done
  262. 261 kubectl get pods
  263. 262 vim nginx-probes.yaml
  264. 263 kubectl create -f nginx-probes.yaml
  265. 264 kubectl get pods
  266. 265 kubectl create deploy myweb --image=nginx --replicas=3
  267. 266 kubectl describe deployments.apps myweb | less
  268. 267 kubectl get all
  269. 268 kubectl delete cronjob runme
  270. 269 kubectl get all
  271. 270 kubectl get all --selector app=myweb
  272. 271 kubectl delete pod myweb-5b7f574f7f-vs788
  273. 272 kubectl get all --selector app=myweb
  274. 273 vim redis-deploy.yaml
  275. 274 kubectl apply -f redis-deploy.yaml
  276. 275 vim redis-deploy.yaml
  277. 276 kubectl api-versions | less
  278. 277 kubectl api-resources
  279. 278 kubectl api-resources | less
  280. 279 kubectl api-versions
  281. 280 vim redis-deploy.yaml
  282. 281 kubectl apply -f redis-deploy.yaml
  283. 282 kubectl edit deployments.apps redis
  284. 283 kubectl get all
  285. 284 kubectl edit replicasets.apps redis-6dc855767d
  286. 285 kubectl get all
  287. 286 kubectl delete rs redis-6dc855767d
  288. 287 kubectl get all
  289. 288 kubectl scale deployment redis --replicas=0
  290. 289 kubectl get all
  291. 290 kubectl create deploy nginx-lab7 --replicas=3 --image=nginx
  292. 291 kubectl get all
  293. 292 kubectl api-resources | less
  294. 293 kubectl create deploy nginxup --image=nginx:1.14
  295. 294 kubectl scale deployment nginxup --replicas=4
  296. 295 kubectl get all --selector app=nginxup
  297. 296 kubectl set image deploy nginxup nginx=nginx:1.17
  298. 297 kubectl get all --selector app=nginxup
  299. 298 kubectl get deployments.apps nginxup -o yaml | less
  300. 299 kubectl create deploy example -h | less
  301. 300 kubectl create deploy example --image=nginx -o yaml --dry-run=client > example.yaml
  302. 301 vim example.yaml
  303. 302 kubectl apply -f example.yaml
  304. 303 kubectl get all --selector app=example
  305. 304 kubectl set image deploy example bob=nginx:1.17
  306. 305 kubectl get all --selector app=example
  307. 306 history
  308. 307 kubectl get all
  309. 308 kubectl get deployments.apps redis -o yaml | less
  310. 309 kubectl create deploy bluelabel --image=nginx
  311. 310 kubectl label deploy bluelabel state=demo
  312. 311 kubectl get deploy --show-labels
  313. 312 kubectl get all --selector state=demo
  314. 313 kubectl get all --selector app=bluelabel
  315. 314 kubectl describe deploy bluelabel | less
  316. 315 kubectl get all | grep b lue
  317. 316 kubectl get all | grep blue
  318. 317 kubectl get all
  319. 318 kubectl delete deploy example nginxup nginx-lab7 redis myweb
  320. 319 kubectl get all
  321. 320 kubectl scale deployment bluelabel --replicas 3
  322. 321 kubectl get all
  323. 322 kubectl label pod bluelabel-5cdb7645b5-pjvf8 app-
  324. 323 kubectl get all
  325. 324 kubectl get pods --show-labels
  326. 325 kubectl run testpod --image=busybox -- sleep infinity
  327. 326 kubectl get pods --show-labels
  328. 327 kubectl get pods --show-labels | grep run
  329. 328 kubectl get deploy bluelabel -o yaml
  330. 329 kubectl get all
  331. 330 kubectl scale deployment bluelabel --replicas 4
  332. 331 kubectl get all
  333. 332 kubectl set env deploy bluelabel type=blended
  334. 333 kubectl get all
  335. 334 kubectl delete pod bluelabel-5cdb7645b5-pjvf8
  336. 335 kubectl get all
  337. 336 kubectl get deployments.apps bluelabel -o yaml | less
  338. 337 vim rolling.yaml
  339. 338 kubectl apply -f rolling.yaml
  340. 339 kubectl rollout history deployment
  341. 340 kubectl edit deployments.apps rolling-nginx
  342. 341 kubectl rollout history deployment
  343. 342 kubectl rollout history deployment rolling-nginx --revision=2
  344. 343 kubectl rollout history deployment rolling-nginx --revision=1
  345. 344 kubectl rollout undo deployment rolling-nginx --to-revision=1
  346. 345 kubectl rollout history deployment
  347. 346 kubectl get all
  348. 347 ./countdown 12
  349. 348 kubectl create deployment nginxsvc --image=nginx --replicas=3
  350. 349 kubectl get all --selector app=nginxsvc
  351. 350 kubectl get all --selector app=nginxsvc -o wide
  352. 351 kubectl expose deployment nginxsvc --port=80
  353. 352 kubectl get all --selector app=nginxsvc -o wide
  354. 353 kubectl describe svc nginxsvc
  355. 354 kubectl get endpoints
  356. 355 kubectl get svc
  357. 356 curl 10.106.84.96
  358. 357 minikube ssh
  359. 358 kubectl edit svc nginxsvc
  360. 359 kubectl get svc
  361. 360 minikube ip
  362. 361 curl 192.168.49.2:30089
  363. 362 kubectl describe svc nginxsvc
  364. 363 kubectl edit svc nginxsvc
  365. 364 kubectl get svc
  366. 365 kubectl get endpoints
  367. 366 kubectl edit svc nginxsvc
  368. 367 kubectl get endpoints
  369. 368 kubectl get all
  370. 369 kubectl run testpod --image=busybox -- sleep infinity
  371. 370 kubectl get testpod
  372. 371 kubectl get pods
  373. 372 kubectl get svc
  374. 373 kubectl exec -it testpod -- cat /etc/resolv.conf
  375. 374 kubectl exec -it testpod -- nslookup nginxsvc
  376. 375 kubectl get ns
  377. 376 kubectl get pods -n secret
  378. 377 kubectl run secretweb --image=nginx -n secret
  379. 378 kubectl expose -n secret pod secretweb
  380. 379 kubectl expose -n secret pod secretweb --port=80
  381. 380 kubectl exec -it testpod -- nslookup secretweb
  382. 381 kubectl exec -it testpod -- nslookup secretweb.secret.svc.cluster.local
  383. 382 kubectl exec -it testpod -- cat /etc/resolv.conf
  384. 383 vim nwpolicy-complete-example.yaml
  385. 384 kubectl apply -f nwpolicy-complete-example.yaml
  386. 385 kubectl expose pod nginx --port=80
  387. 386 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  388. 387 kubectl label pod busybox access=true
  389. 388 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  390. 389 vim nwpolicy-complete-example.yaml
  391. 390 kubectl describe networkpolicy access-nginx
  392. 391 kubectl get pods --show-label
  393. 392 kubectl get pods --show-labels
  394. 393 kubectl create -h | less
  395. 394 kubectl autoscale -h | less
  396. 395 minikube addons lists
  397. 396 minikube addons list
  398. 397 minikube addons enable metrics-server
  399. 398 kubectl top pods
  400. 399 history
  401.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement