sandervanvugt

CKAD day3 march 22

Mar 25th, 2022
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.13 KB | None | 0 0
  1. 1 minikube start --vm-driver=docker
  2. 2 minikube status
  3. 3 history
  4. 4 ls
  5. 5 minikube status
  6. 6 kubectl get all
  7. 7 docker ps
  8. 8 minikube ssh
  9. 9 minikube dashboard
  10. 10 ls
  11. 11 ./countdown 15
  12. 12 ls minikube-docker-setup.sh
  13. 13 minikube-docker-setup.sh
  14. 14 ./minikube-docker-setup
  15. 15 kubectl get all
  16. 16 curl 10.105.247.30
  17. 17 docker ps
  18. 18 kubectl --help
  19. 19 kubectl --help | less
  20. 20 kubectl create --help | less
  21. 21 kubectl create deployment --help | less
  22. 22 kubectl completion --help | less
  23. 23 source <(kubectl completion bash)
  24. 24 kubectl config view
  25. 25 kubectl run --help | less
  26. 26 kubectl run nginx --image=nginx
  27. 27 kubectl get all
  28. 28 kubectl delete pod myfirstapp-5848c75dc8-92mhb
  29. 29 kubectl get all
  30. 30 kubectl delete pod nginx
  31. 31 kubectl get all
  32. 32 history
  33. 33 sleep 120; ./countdown 10
  34. 34 kubectl get all
  35. 35 kubectl completion -h | less
  36. 36 kubectl get nodes,pods
  37. 37 kubectl describe pods myfirstapp-5848c75dc8-8ppfp | less
  38. 38 kubectl get pods myfirstapp-5848c75dc8-8ppfp -o yaml | less
  39. 39 kubectl explain pod
  40. 40 kubectl explain pod.spec | less
  41. 41 kubectl describe pods myfirstapp-5848c75dc8-8ppfp | less
  42. 42 kubectl explain pod.spec | less
  43. 43 kubectl get pods myfirstapp-5848c75dc8-8ppfp -o yaml | less
  44. 44 kubectl api-resources | less
  45. 45 kubectl api-versions | less
  46. 46 kubectl run mynginx --image=nginx --dry-run -o yaml
  47. 47 kubectl run mynginx --image=nginx --dry-run=client -o yaml
  48. 48 kubectl run mynginx --image=nginx --dry-run=client -o yaml > mynginx.yaml
  49. 49 vim mynginx.yaml
  50. 50 vim lab1.txt
  51. 51 ./countdown 13
  52. 52 pwd
  53. 53 vim sidecar.yaml
  54. 54 kubectl create -f sidecar.yaml
  55. 55 kubectl get pods
  56. 56 kubectl exec -it sidecar-pod -c sidecar -- /bin/bash
  57. 57 vim init-example1.yaml
  58. 58 kubectl create -f init-example1.yaml
  59. 59 kubectl get pods
  60. 60 kubectl describe pod init-demo1 | less
  61. 61 vim init-example2.yaml
  62. 62 kubectl create -f init-example2.yaml
  63. 63 kubectl get pdos
  64. 64 kubectl get pods
  65. 65 kubectl get pods -A
  66. 66 kubectl get all
  67. 67 kubectl get all -A
  68. 68 kubectl get pods -A
  69. 69 kubectl create ns secret
  70. 70 kubect get ns
  71. 71 kubectl get ns
  72. 72 vim busybox-ns.yaml
  73. 73 kubectl explain pod.metadata
  74. 74 vim busybox-ns.yaml
  75. 75 kubectl apply -f busybox-ns.yaml
  76. 76 kubectl get all
  77. 77 kubectl get all -n secret
  78. 78 kubectl run secretginx --image=nginx -n secret
  79. 79 kubectl get all -n secret
  80. 80 kubectl get pods
  81. 81 kubectl exec -it myfirstapp-5848c75dc8-8ppfp sh
  82. 82 history
  83. 83 minikube status
  84. 84 kubectl get all
  85. 85 kubectl run --help | less
  86. 86 kubectl run faildb --image=mariadb
  87. 87 kubectl get pods
  88. 88 kubectl describe pod faildb | less
  89. 89 kubectl logs faildb
  90. 90 kubectl delete pod faildb
  91. 91 kubectl run --help | less
  92. 92 kubectl run nofaildb --image=mariadb --env=MARIABD_ROOT_PASSWORD=password
  93. 93 kubectl get pods
  94. 94 kubectl run --help | less
  95. 95 kubectl delete pod nofaildb
  96. 96 kubectl run nofaildb --image=mariadb --env=MARIADB_ROOT_PASSWORD=password
  97. 97 kubectl get pods
  98. 98 kubectl logs sidecar-pod
  99. 99 kubectl logs sidecar-pod app
  100. 100 kubectl logs sidecar-pod sidecar
  101. 101 kubectl run busy --image=busybox
  102. 102 kubectl get pods
  103. 103 kubectl describe pods busy
  104. 104 kubectl describe pods busy | less
  105. 105 kubectl delete pods busy
  106. 106 kubectl run busy --image=busybox -- sleep 3600
  107. 107 kubectl get pods
  108. 108 kubectl explain pods --recursive
  109. 109 kubectl explain pods --recursive | less
  110. 110 ls
  111. 111 vim securitycontextdemo2.yaml
  112. 112 kubectl create -f securitycontextdemo2.yaml
  113. 113 kubectl get pods
  114. 114 kubectl exec -it security-context-demo -- sh
  115. 115 vim securitycontextdemo2.yaml
  116. 116 vim securitycontextdemo.yaml
  117. 117 kubectl create -f securitycontextdemo.yaml
  118. 118 kubectl get pods
  119. 119 kubectl describe pods nginxsecure
  120. 120 kubectl create job --help
  121. 121 kubectl create job --help | less
  122. 122 kubectl create job onejob --image=busybox -- date
  123. 123 kubectl get jobs
  124. 124 kubectl get pods
  125. 125 kubectl get jobs onejob -o yaml | less
  126. 126 kubectl delete job onejob
  127. 127 kubectl get pods
  128. 128 kubectl create job mynewjob --image=busybox --dry-run=client -o yaml -- sleep 5 > mynewjob.yaml
  129. 129 vim mynewjob.yaml
  130. 130 kubectl create -f mynewjob.yaml
  131. 131 kubectl get all
  132. 132 kubectl run failybox --image=busybox
  133. 133 kubectl get pods
  134. 134 kubectl create cronjob -h | less
  135. 135 kubectl create cronjob runme --image=busybox --schedule="*/1 * * * *" -- echo greetings from your cluster
  136. 136 kubectl create cronjob runme --image=busybox --schedule="0 4 25 12 5" -- echo greetings from your cluster
  137. 137 kubectl get cronjobs,jobs,pods
  138. 138 kubectl logs runme-274687
  139. 139 kubectl logs runme-27468779-7hz5z
  140. 140 kubectl delete cronjob runme
  141. 141 kubectl explain jobs.spec
  142. 142 kubectl explain jobs.spec | less
  143. 143 ./countdown 14
  144. 144 vim frontend-resources.yaml
  145. 145 kubectl create -f frontend-resources.yaml
  146. 146 kubectl get pods
  147. 147 kubectl describe pod frontend
  148. 148 kubectl delete -f frontend-resources.yaml
  149. 149 vim frontend-resources.yaml
  150. 150 kubectl create -f frontend-resources.yaml
  151. 151 kubectl get all
  152. 152 kubectl delete pods failybox
  153. 153 kubectl delete pods nginxsecure
  154. 154 kubectl delete pods sidecar-pod
  155. 155 kubectl create deployment --help | less
  156. 156 kubectl create deployment myweb --image=nginx --replicas=3
  157. 157 kubectl describe deployments.apps myweb | less
  158. 158 kubectl get deployments.apps myweb -o yaml | less
  159. 159 kubectl get all
  160. 160 kubectl delete pod myweb-8764bf4c8-6kbc7
  161. 161 kubectl get all
  162. 162 kubectl delete pod nofaildb
  163. 163 kubectl get all
  164. 164 kubectl delete deployments.apps myfirstapp
  165. 165 kubectl get deploy
  166. 166 kubectl scale deploy myweb --replicas=4
  167. 167 kubectl get all
  168. 168 kubectl get all --show-labels
  169. 169 kubectl get all --selector app=myd
  170. 170 kubectl get all --show-labels
  171. 171 kubectl get all --selector app=myweb
  172. 172 vim redis-deploy.yaml
  173. 173 kubectl create -f redis-deploy.yaml
  174. 174 vim redis-deploy.yaml
  175. 175 kubectl api-versions
  176. 176 kubectl create -f redis-deploy.yaml
  177. 177 vim redis-deploy.yaml
  178. 178 kubectl create -f redis-deploy.yaml
  179. 179 kubect get all
  180. 180 kubectl get all
  181. 181 kubectl edit deployments.apps redis
  182. 182 kubectl get all
  183. 183 kubectl delete replicasets.apps redis-696dfdfbfc
  184. 184 kubectl get all
  185. 185 kubectl delete deploy myweb
  186. 186 kubectl delete deploy redis
  187. 187 kubectl create deploy nginxup --image=nginx:1.14
  188. 188 kubectl get all
  189. 189 kubectl scale deployment nginxup --replicas=4
  190. 190 kubectl get all --selector app=nginxup
  191. 191 kubectl set image deploy nginxup nginx=nginx:1.17
  192. 192 kubectl get all
  193. 193 ./countdown 12
  194. 194 kubectl create deploy bluelabel --image=nginx
  195. 195 kubectl label deployments.apps bluelabel state=demo
  196. 196 kubectl get deploy --show-labels
  197. 197 kubectl get all --selector app=bluelabel
  198. 198 kubectl get deploy bluelabel -o yaml | less
  199. 199 kubectl get all --selector state=demo
  200. 200 kubectl get deploy bluelabel -o yaml | less
  201. 201 kubectl scale deploy bluelabel --replicas=4
  202. 202 kubectl set env deploy bluelabel type=blended
  203. 203 kubectl get all
  204. 204 vim rolling.yaml
  205. 205 kubectl create -f rolling.yaml
  206. 206 kubectl rollout history deployment
  207. 207 kubectl edit deployments.apps rolling-nginx
  208. 208 kubectl rollout history deployment
  209. 209 kubectl rollout history deployment rolling-nginx --revision=2
  210. 210 kubectl rollout history deployment rolling-nginx --revision=1
  211. 211 kubectl rollout undo deployment rolling-nginx --to-revision=1
  212. 212 kubectl get all
  213. 213 kubectl create deploy nginxsvc --image=nginx --replicas=3
  214. 214 kubectl get all --selector app=nginxsvc
  215. 215 kubectl expose deployment nginxsvc --port=80
  216. 216 kubectl get all --selector app=nginxsvc
  217. 217 kubectl describe svc nginxsvc
  218. 218 kubectl get endpoints
  219. 219 kubectl get svc
  220. 220 curl 10.109.114.11
  221. 221 minikube ssh
  222. 222 kubectl edit svc nginxsvc
  223. 223 kubectl get svc
  224. 224 minikube ip
  225. 225 curl 192.168.49.2:32000
  226. 226 ./countdown 15
  227. 227 kubectl run testpod --image=busybox -- sleep 3600
  228. 228 kubectl exec -it testpod -- cat /etc/resolv.conf
  229. 229 kubectl get svc -A
  230. 230 kubectl get svc
  231. 231 kubectl exec -it testpod -- nslookup nginxsvc
  232. 232 minikube addons list
  233. 233 minikube addons enable ingress
  234. 234 kubectl get pods -A
  235. 235 minikube addons list
  236. 236 kubectl get deploy
  237. 237 kubectl get svc nginxsvc
  238. 238 minikube ip
  239. 239 curl http://192.168.49.2:32000
  240. 240 kubectl create ingress --help | less
  241. 241 kubectl create ingress nginxsvc-ingress --rule="/=nginxsvc:80" --rule="/hello=newdep:8080"
  242. 242 minikube ip
  243. 243 sudo vim /etc/hosts
  244. 244 kubectl get ingress
  245. 245 curl nginxsvc.info
  246. 246 kubectl create deploy newdep --image=gcr.io/google-samples/hello-app:2.0
  247. 247 kubectl expose deploy newdep --port=8080
  248. 248 curl nginxsvc.info/hello
  249. 249 kubectl describe ingress nginxsvc-ingress
  250. 250 history
  251. 251 kubectl get svc nginxsvc -o yaml
  252. 252 kubectl explain pod.spec.volumes | less
  253. 253 vim morevolumes.yaml
  254. 254 kubectl create -f morevolumes.yaml
  255. 255 kubectl get pods
  256. 256 kubectl get deploy
  257. 257 kubectl delete deploy bluelabl
  258. 258 kubectl delete deploy bluelabel
  259. 259 kubectl delete deploy nginxup
  260. 260 kubectl delete deploy rolling-nginx
  261. 261 kubectl get pods
  262. 262 kubectl describe pods morevol2 | less
  263. 263 kubectl exec -it morevol2 -c centos1 -- touch /centos1/test
  264. 264 kubectl exec -it morevol2 -c centos2 -- ls -l /centos2/
  265. 265 cat morevolumes.yaml
  266. 266 cat pv.yaml
  267. 267 kubectl create -f pv.yaml
  268. 268 kubectl describe pv pv-volume
  269. 269 kubectl get pv
  270. 270 vim pvc.yaml
  271. 271 kubectl get pv
  272. 272 kubectl create -f pvc.yaml
  273. 273 kubectl get pv
  274. 274 kubectl get pvc
  275. 275 kubectl describe pvc pv-claim
  276. 276 kubectl describe pv pvc-de920cdc-7e05-410d-b296-94225a71a2d9
  277. 277 vim pvc-pod.yaml
  278. 278 kubectl create -f pvc-pod.yaml
  279. 279 kubectl get pvc,pv
  280. 280 kubectl describe pv pvc-318f01a0-d186-4c64-9d82-9391e91d9a82
  281. 281 kubectl exec nginx-pvc-pod -- touch /usr/share/nginx/html/testfile
  282. 282 minikube ssh
  283. 283 kubectl get storageclass
  284. 284 vim pvc.yaml
  285. 285 kubectl get pv
  286. 286 vim pv-pvc-pod.yaml
  287. 287 kubectl create -f pv-pvc-pod.yaml
  288. 288 vim pv-pvc-pod.yaml
  289. 289 kubectl create -f pv-pvc-pod.yaml
  290. 290 kubectl get pv,pvc
  291. 291 kubectl get storageclass
  292. 292 vim pv-pvc-pod.yaml
  293. 293 kubectl create deployment mydb --image=mariadb
  294. 294 kubectl logs mydb-fb7ff4d78-d24j8
  295. 295 kubectl set env deploy mydb MYSQL_ROOT_PASSWORD=password
  296. 296 kubectl get all --selector app=mydb
  297. 297 kubectl get deploy mydb -o yaml > mydb.yaml
  298. 298 vim mydb.yaml
  299. 299 ./countdown 12
  300. 300 vim varsfile
  301. 301 kubectl create cm mydbvars --from-env-file=varsfile
  302. 302 kubectl describe cm mydbvars
  303. 303 kubectl create deploy mydb --image=mariadb --replicas=3
  304. 304 kubectl delete deployments.apps mydb
  305. 305 kubectl create deploy mydb --image=mariadb --replicas=3
  306. 306 kubectl get all --selector app=mydb
  307. 307 kubectl set env --help | less
  308. 308 kubectl set env deploy mydb --from=configmap/mydbvars
  309. 309 kubectl get all --selector app=mydb
  310. 310 kubectl get deployments.apps mydb -o yaml
  311. 311 echo "hello world" > index.html
  312. 312 kubectl create cm myindex --from-file=index.html
  313. 313 kubectl describe cm myindex
  314. 314 kubectl create deploy myweb --image=nginx
  315. 315 kubectl edit deploy myweb
  316. 316 kubectl get all --selector app=myweb
  317. 317 kubectl expose deploy myweb --port=80
  318. 318 kubectl get services
  319. 319 kubectl edit svc myweb
  320. 320 kubectl get svc
  321. 321 curl $(minikube ip):31589
  322. 322 history
  323. 323 kubectl create secret generic dbpw --from-literal=ROOT_PASSWORD=password
  324. 324 kubectl describe secrets dbpw
  325. 325 kubectl get secrets dbpw -o yaml
  326. 326 echo cGFzc3dvcmQ= | base64 -d
  327. 327 kubectl create deploy mynewdb --image=mariadb
  328. 328 kubectl set env deploy mynewdb --from=secret/dbpw --prefix=MYSQL_
  329. 329 kubectl get all --selector app=mynewdb
  330. 330 kubectl get all
  331. 331 for i in mydb mynewdb myweb newdep nginxsvc; do kubectl delete $i; done
  332. 332 for i in mydb mynewdb myweb newdep nginxsvc; do kubectl delete deploy $i; done
  333. 333 history
  334. 334 kubectl api-resources
  335. 335 kubectl api-resources | wc
  336. 336 kubectl get pods -n kube-system
  337. 337 kubectl config view
  338. 338 kubectl proxy --port=8001 &
  339. 339 kubectl create deploy curlginx --image=nginx --replicas=3
  340. 340 curl http://localhost:8001/version
  341. 341 curl http://localhost:8001/api/v1/namespaces/default/pods | less
  342. 342 curl http://localhost:8001/api/v1/namespaces/default/pods/curlginx/
  343. 343 curl http://localhost:8001/api/v1/namespaces/default/pods/curlginx*
  344. 344 curl http://localhost:8001/api/v1/namespaces/default/pods | less
  345. 345 curl http://localhost:8001/api/v1/namespaces/default/pods/curlginx-c6f4b6874-6kzlv
  346. 346 curl -XDELETEE http://localhost:8001/api/v1/namespaces/default/pods/curlginx-c6f4b6874-6kzlv
  347. 347 kubectl get pods
  348. 348 curl -XDELETE http://localhost:8001/api/v1/namespaces/default/pods/curlginx-c6f4b6874-6kzlv
  349. 349 kubectl get pods
  350. 350 cat ~/.kube/config
  351. 351 kubectl config view
  352. 352 kubectl auth can-i delete pods
  353. 353 kubectl auth can-i delete pods --as [email protected]
  354. 354 ./countdown 13
  355. 355 kubectl get pods testpod -o yaml | less
  356. 356 kubectl get sa -A
  357. 357 vim mypod.yaml
  358. 358 kubectl apply -f mypod.yaml
  359. 359 kubectl get pods mypod -o yaml
  360. 360 kubectl exec -it mypod -- sh
  361. 361 kubectl describe mypod
  362. 362 kubectl describe pod mypod
  363. 363 vim mysa.yaml
  364. 364 kubectl create -f mysa.yaml
  365. 365 kubectl get sa
  366. 366 vim list-pods.yaml
  367. 367 kubectl create -f list-pods.yaml
  368. 368 vim list-pods-mysa-binding.yaml
  369. 369 kubectl apply -f list-pods-mysa-binding.yaml
  370. 370 vim mysapod.yaml
  371. 371 kubectl create -f mysapod.yaml
  372. 372 kubectl exec -it mysapod -- sh
  373. 373 kubectl get svc
  374. 374 cd
  375. 375 cd Downloads/
  376. 376 ls
  377. 377 tar xvf helm-v3.8.1-linux-amd64.tar.gz
  378. 378 sudo mv linux-amd64/helm /usr/local/bin/
  379. 379 helm version
  380. 380 helm repo list
  381. 381 helm repo add bitnami https://charts.bitnami.com/bitnami
  382. 382 helm repo list
  383. 383 helm search repo bitnami
  384. 384 helm repo update
  385. 385 helm install bitnami/mysql --generate-name
  386. 386 kubectl get all
  387. 387 helm show chart bitnami/mysql
  388. 388 helm show all bitnami/mysql
  389. 389 helm list
  390. 390 helm status mysql-1648219871
  391. 391 helm show values bitnami/nginx
  392. 392 helm pull bitnami/nginx
  393. 393 ls
  394. 394 tar xvf nginx-9.9.5.tgz
  395. 395 vim nginx/values.yaml
  396. 396 helm template --debug nginx
  397. 397 helm install -f nginx/values.yaml my-nginx nginx/
  398. 398 cd ../ckad/
  399. 399 vim crd-object.yaml
  400. 400 kubectl create -f crd-object.yaml
  401. 401 kubectl api-resources | grep backup
  402. 402 vim crd-backup.yaml
  403. 403 kubectl create -f crd-backup.yaml
  404. 404 kubectl get backups
  405. 405 ./countdown 12
  406. 406 kubectl create deploy blue-nginx --image=nginx:1.14 --replicas=3
  407. 407 kubectl get all
  408. 408 kubectl expose deploy blue-nginx --port=80 --name=bgnginx
  409. 409 kubectl get deploy blue-nginx -o yaml > green-nginx.yaml
  410. 410 vim green-nginx.yaml
  411. 411 kubectl create -f green-nginx.yaml
  412. 412 kubectl get pods
  413. 413 kubectl get endpoints
  414. 414 kubectl delete svc bgnginx; kubectl expose deploy green-nginx --port=80 --name=bgnginx
  415. 415 kubectl get endpoints
  416. 416 kubectl get deploy
  417. 417 kubectl scale deployment blue-nginx --replicas=0
  418. 418 kubectl create deploy old-nginx --image=nginx:1.14 --replicas=3 --dry-run=client -o yaml > ~/oldnginx.yaml
  419. 419 cd ..
  420. 420 ls
  421. 421 vim oldnginx.yaml
  422. 422 kubectl create -f oldnginx.yaml
  423. 423 kubectl expose deploy old-nginx --name=oldnginx --port=80 --selector type=canary
  424. 424 kubectl get svc
  425. 425 kubectl get endpoints
  426. 426 minikube ssh
  427. 427 kubectl cp old-nginx-66bd7bb796-srtml:/usr/share/nginx/html/index.html index.html
  428. 428 vim index.html
  429. 429 kubectl create cm canary --from-file=index.html
  430. 430 kubectl describe cm canary
  431. 431 vim ckad/canary.yaml
  432. 432 kubectl get endpoints
  433. 433 kubectl create -f ckad/canary.yaml
  434. 434 kubectl get endpoints
  435. 435 kubectl get svc
  436. 436 minikube ssh
  437. 437 kubectl get deploy
  438. 438 kubectl scale deployment old-nginx --replicas=0
  439. 439 cd ckad/
  440. 440 vim busybox-ready.yaml
  441. 441 kubectl create -f busybox-ready.yaml
  442. 442 kubectl get pods
  443. 443 kubectl describe pods busybox-ready
  444. 444 kubectl edit pods busybox-ready
  445. 445 kubectl exec -it busybox-ready -- sh
  446. 446 kubectl get pods
  447. 447 vim nginx-probes.yaml
  448. 448 kubectl create -f nginx-probes.yaml
  449. 449 kubectl get pods
  450. 450 history
  451.  
Add Comment
Please, Sign In to add comment