Advertisement
sandervanvugt

CKAD day2 june23

Jun 21st, 2023
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.90 KB | None | 0 0
  1. 1 cd ckad/
  2. 2 ./countdown 4
  3. 3 vim sg.yal
  4. 4 vim sg.yaml
  5. 5 kubectl apply sg.yaml
  6. 6 kubectl apply -f sg.yaml
  7. 7 kubectl run sidecard --image=busybox --dry-run=client -o yaml -- sleep infinity
  8. 8 kubectl run sidecard --image=busybox --dry-run=client -o yaml -- sleep infinity > sidecard.yaml
  9. 9 vim sidecard.yaml
  10. 10 kubectl apply -f sidecard.yaml
  11. 11 kubectl get pods
  12. 12 ./countdown 12
  13. 13 history
  14. 14 minikube start --vm-driver=docker --cni=calico
  15. 15 kubectl get all
  16. 16 ./countdown 2
  17. 17 minikube dashboard
  18. 18 source <(kubectl completion bash)
  19. 19 kubectl create deploy apptwo --image=nginx --replicas=3
  20. 20 kubectl get all
  21. 21 history
  22. 22 ./countdown 15
  23. 23 kubectl get all
  24. 24 kubectl delete pod appone-dcc78d77f-mrz5r
  25. 25 kubectl get all
  26. 26 kubectl create deploy appthree --image=nginx
  27. 27 kubectl get all
  28. 28 kubectl create -h
  29. 29 kubectl create -h | less
  30. 30 kubectl create deploy -h | less
  31. 31 kubectl completion -h | less
  32. 32 kubectl get pods
  33. 33 kubectl get pods appthree-dd4b5fc5d-vsmc4 -o yaml | less
  34. 34 ls
  35. 35 cd dockerfile/
  36. 36 ls
  37. 37 vim Dockerfile
  38. 38 docker build -t centmap:1.0 .
  39. 39 docker images
  40. 40 cd ..
  41. 41 ls
  42. 42 cd alpmap/
  43. 43 ls
  44. 44 vim Containerfile
  45. 45 docker build -t alpmap .
  46. 46 mv Containerfile Dockerfile
  47. 47 docker build -t alpmap .
  48. 48 touch sander.repo
  49. 49 docker build -t alpmap .
  50. 50 docker images
  51. 51 docker save alpmap
  52. 52 docker save --help | less
  53. 53 docker save alpmap -o alpmap.tgz
  54. 54 ls -l alpmap.tgz
  55. 55 file alpmap.tgz
  56. 56 kubectl explain pod.spec | less
  57. 57 kubectl get all
  58. 58 kubectl delete pod appthree-dd4b5fc5d-vsmc4
  59. 59 kubectl get all
  60. 60 kubectl run alone --image=nginx
  61. 61 kubectl get all
  62. 62 kubectl delete pod alone
  63. 63 kubectl get all
  64. 64 history
  65. 65 kubectl run -h | less
  66. 66 kubectl get pods appthree-dd4b5fc5d-z58r2 -o yaml | less
  67. 67 kubectl describe pods appthree-dd4b5fc5d-z58r2 | less
  68. 68 cd ..
  69. 69 ./countdown 4
  70. 70 kubectl run busybox --image-busybox
  71. 71 kubectl run busybox --image=busybox
  72. 72 kubectl get pods
  73. 73 kubectl describe pod busybox
  74. 74 kubectl delete pod busybox
  75. 75 kubectl run busybox --image=busybox --restart=Never
  76. 76 kubectl get pods
  77. 77 ./countdown 12
  78. 78 kubectl get pods busybox -o yaml | less
  79. 79 ./countdown 12
  80. 80 kubectl explain pod
  81. 81 kubectl explain pod.spec
  82. 82 ls
  83. 83 vim busybox.yaml
  84. 84 kubectl run mynginx --image=nginx --dry-run=client -o yaml > mynginx.yaml
  85. 85 vim mynginx.yaml
  86. 86 kubectl create -f mynginx.yaml
  87. 87 kubectl remove -f mynginx.yaml
  88. 88 kubectl delete -f mynginx.yaml
  89. 89 kubectl apply -f mynginx.yaml
  90. 90 vim sidecar.yaml
  91. 91 kubectl apply -f sidecar.yaml
  92. 92 kubectl get pods
  93. 93 kubectl exec -it sidecar-pod -c sidecar -- /bin/bash
  94. 94 vim sidecar.yaml
  95. 95 vim bonuslab.txt
  96. 96 history
  97. 97 cat bonuslab.txt
  98. 98 cat sidecar.yaml
  99. 99 ls -lrt
  100. 100 history
  101. 101 cat bonuslab.txt
  102. 102 cat sidecard.yaml
  103. 103 vim init-example1.yaml
  104. 104 kubectl apply -f init-example1.yaml
  105. 105 kubectl get pods
  106. 106 vim init-example2.yaml
  107. 107 kubectl apply -f init-example2.yaml
  108. 108 kubectl get pods
  109. 109 kubectl describe pod init-demo2
  110. 110 kubectl get ns
  111. 111 kubectl get pods
  112. 112 kubectl get pods -A
  113. 113 kubectl create ns secret
  114. 114 kubectl run secretpod --image=nginx -n secret
  115. 115 kubectl get pods
  116. 116 kubectl get pods -n secret
  117. 117 kubectl config set-context --current --namespace=secret
  118. 118 kubectl get pods
  119. 119 kubectl config set-context --current -n default
  120. 120 kubectl config set-context --current --namespace=default
  121. 121 kubectl get pods
  122. 122 history
  123. 123 ./countdown 2
  124. 124 kubectl run faildb --image=mariadb
  125. 125 kubectl get pods
  126. 126 kubectl describe pod faildb | less
  127. 127 kubectl logs faildb
  128. 128 kubectl delete pod faildb
  129. 129 kubectl run faildb --image=mariadb --env MARIADB_ROOT_PASSWORD=password
  130. 130 kubectl get pods
  131. 131 kubectl run -h | less
  132. 132 kubectl explain --recursive pod.spec | less
  133. 133 kubectl explain pod.spec.containers | less
  134. 134 kubectl explain pod.spec.containers.securityContext
  135. 135 kubectl explain pod.spec.containers.securityContext | less
  136. 136 vim securitycontextdemo2.yaml
  137. 137 kubectl apply -f securitycontextdemo2.yaml
  138. 138 kubectl exec -it security-context-demo -- sh
  139. 139 kubectl apply -f securitycontextdemo.yaml
  140. 140 vim securitycontextdemo.yaml
  141. 141 kubectl get pods
  142. 142 kubectl describe pod nginxsecure
  143. 143 history
  144. 144 kubectl explain --recursive pod.spec | less
  145. 145 kubectl explain pod.spec | less
  146. 146 kubectl explain pod.spec.securitycontext
  147. 147 kubectl explain pod.spec.securityContext
  148. 148 kubectl explain pod.spec.containers.securityContext
  149. 149 history
  150. 150 sudo poweroff
  151. 151 sudo apt install vim git -y
  152. 152 git clone https://github.com/sandervanvugt/ckad
  153. 153 history
  154. 154 cd ckad/
  155. 155 ls
  156. 156 ./minikube-docker-setup.sh
  157. 157 minikube start
  158. 158 kubectl explain job.spec | less
  159. 159 source <(kubectl completion bash)
  160. 160 kubectl create job -h | less
  161. 161 kubectl create onejob --image=busybox -- date
  162. 162 kubectl create job onejob --image=busybox -- date
  163. 163 kubectl get jobs
  164. 164 kubectl get jobs,pods
  165. 165 kubectl get jobs onejob -o yaml | less
  166. 166 kubectl delete jobs onejob
  167. 167 kubectl get pods
  168. 168 kubect create job mynewjob --image=busybox --dry-run=client -o yaml -- sleep 5 > mynewjob.yaml
  169. 169 kubectl create job mynewjob --image=busybox --dry-run=client -o yaml -- sleep 5 > mynewjob.yaml
  170. 170 vim mynewjob.yaml
  171. 171 kubectl apply -f mynewjob.yaml
  172. 172 kubectl get jobs,pods
  173. 173 kubectl create cronjob -h | less
  174. 174 kubectl create cronjob runme --image=busybox --schedule="*/2 * * 6 1-5"
  175. 175 kubectl get cronjobs,jobs,pods
  176. 176 date
  177. 177 kubectl get cronjobs -o yaml
  178. 178 kubectl get cronjobs,jobs,pods
  179. 179 kubectl logs runme-28122618-8lgbl
  180. 180 kubectl get cronjobs -o yaml
  181. 181 kubectl create cronjob runmeagain --image=busybox --schedule="*/2 * * 6 1-5" -- echo take two
  182. 182 date
  183. 183 kubectl get cronjobs,jobs,pods
  184. 184 kubectl logs runmeagain-28122620-b7hnv
  185. 185 history
  186. 186 kubectl create cronjob -h | less
  187. 187 kubectl create cronjob logjob --image=busybox --schedule="5 * * * *" -- logger hello world
  188. 188 #kubectl create cronjob logjob --image=busybox --schedule="0 5 * * *" -- logger hello world
  189. 189 kubectl explain pod.spec.containers.resources
  190. 190 cd ckad/
  191. 191 vim frontend-resources.yaml
  192. 192 kubectl apply -f frontend-resources.yaml
  193. 193 kubectl get pods
  194. 194 kubectl describe pods frontend
  195. 195 kubectl delete -f frontend-resources.yaml
  196. 196 vim frontend-resources.yaml
  197. 197 kubectl apply -f frontend-resources.yaml
  198. 198 kubectl get pods
  199. 199 kubectl get deployments.apps
  200. 200 kubectl delete deployments.apps appone apptwo appthree
  201. 201 kubectl get pods
  202. 202 kubectl delete cronjobs.batch logjob runme runmeagain
  203. 203 kubectl get pods
  204. 204 kubectl describe pod frontend
  205. 205 kubectl delete -f frontend-resources.yaml
  206. 206 vim frontend-resources.yaml
  207. 207 kubectl apply -f frontend-resources.yaml
  208. 208 kubectl get pods
  209. 209 history
  210. 210 cat frontend-resources.yaml
  211. 211 vim lab6.yaml
  212. 212 kubectl apply -f lab6.yaml
  213. 213 kubectl get pods
  214. 214 kubectl get pods lab6 -o yaml | less
  215. 215 vim lab6.yaml
  216. 216 kubectl delete pod lab6
  217. 217 kubectl apply -f lab6.yaml
  218. 218 kubectl get pods lab6 -o yaml | less
  219. 219 vim busybox-ready.yaml
  220. 220 kubectl apply -f busybox-ready.yaml
  221. 221 kubectl get pods
  222. 222 kubectl describe pods busybox-ready
  223. 223 kubectl edit pods busybox-ready
  224. 224 kubectl exec -it busybox-ready -- /bin/sh
  225. 225 kubectl get pods
  226. 226 vim nginx-probes.yaml
  227. 227 kubectl apply -f nginx-probes.yaml
  228. 228 history
  229. 229 vim dm9.yaml
  230. 230 kubectl create cronjob -h | less
  231. 231 kubectl create cronjob lab9job --image=busybox --schedule="*/1 * * * *" --dry-run=client -o yaml -- sleep 30 > lab9.yaml
  232. 232 kubectl explain job.spec
  233. 233 kubectl explain job.spec | less
  234. 234 vim lab9.yaml
  235. 235 kubectl apply -f lab9.yaml
  236. 236 kubectl get cronjobs,jobs,pods
  237. 237 history
  238. 238 cat lab9.yaml
  239. 239 kubectl get all
  240. 240 kubectl delete cronjobs.batch lab9job
  241. 241 kubectl delete pod busybox busybox-ready faildb init-demo1 init-demo2 lab6 mynginx nginx-probes nginxsecure security-context-demo sidecar-pod sidecard sidecar-question
  242. 242 kubectl get pods
  243. 243 kubectl create deploy myweb --image=nginx --replicas 3
  244. 244 kubectl get all
  245. 245 kubectl describe deployments.apps myweb
  246. 246 kubectl get all
  247. 247 kubectl delete pod myweb-5b7f574f7f-v8h5g
  248. 248 kubectl get all
  249. 249 kubectl run pod mypod --image=nginx
  250. 250 kubectl get pods
  251. 251 kubectl run mypod --image=nginx
  252. 252 kubectl get pods
  253. 253 kubectl delete pod pod
  254. 254 kubectl delete pod mypod
  255. 255 kubectl get pods
  256. 256 vim redis-deploy.yaml
  257. 257 kubectl apply -f redis-deploy.yaml
  258. 258 vim redis-deploy.yaml
  259. 259 kubectl api-versions
  260. 260 vim redis-deploy.yaml
  261. 261 kubectl apply -f redis-deploy.yaml
  262. 262 kubectl get all
  263. 263 kubectl edit deployments.apps redis
  264. 264 kubectl get all
  265. 265 kubectl scale deployment redis --replicas 1
  266. 266 kubectl get all
  267. 267 kubectl delete rs redis-6dc855767d
  268. 268 kubectl get all
  269. 269 history
  270. 270 kubectl create deployment nginx-lab7 --image=nginx --replicas 3
  271. 271 kubectl get all --selector app=nginx-lab7
  272. 272 kubectl create deployment nginxup --image=nginx:1.14
  273. 273 kubectl get all --selector app=nginxup
  274. 274 kubectl set -h | less
  275. 275 kubectl set image deploy nginxup nginx=nginx:1.17
  276. 276 kubectl get all --selector app=nginxup
  277. 277 kubectl get deployments.apps redis -o yaml | less
  278. 278 kubectl create deploy bluelabel --image=nginx
  279. 279 kubectl label deploy bluelabel state=demo
  280. 280 kubectl get all --show-labels --selector app=bluelabel
  281. 281 kubectl get all --show-labels --selector state=demo
  282. 282 kubectl describe deployments.apps bluelabel
  283. 283 kubectl describe pod bluelabel-5cdb7645b5-kt2xm | less
  284. 284 kubectl label pod bluelabel-5cdb7645b5-kt2xm app-
  285. 285 kubectl get all --show-labels
  286. 286 kubectl get deploy bluelabel -o yaml | less
  287. 287 kubectl scale deployment bluelabel --replicas=4
  288. 288 kubectl set env deploy bluelabel type=blended
  289. 289 kubectlk get all --selector app=bluelabel
  290. 290 kubectl get all --selector app=bluelabel
  291. 291 ./countdown 14
  292. 292 kubectl edit deployments.apps bluelabel
  293. 293 vim rolling.yaml
  294. 294 kubectl apply -f rolling.yaml
  295. 295 kubectl rollout history deployment
  296. 296 kubectl edit deployments.apps rolling-nginx
  297. 297 kubectl rollout history deployment rolling-nginx
  298. 298 kubectl describe deployments.apps rolling-nginx
  299. 299 kubectl rollout history deployment rolling-nginx --revision=2
  300. 300 kubectl rollout history deployment rolling-nginx --revision=1
  301. 301 kubectl rollout undo deployment rolling-nginx --to-revision 1
  302. 302 kubectl get all
  303. 303 kubectl create deploy nginxsvc --image=nginx
  304. 304 kubectl get deploy
  305. 305 kubectl scale deployment nginxsvc --replicas=3
  306. 306 kubectl expose deployment nginxsvc --port=80
  307. 307 kubectl describe svc nginxsvc
  308. 308 kubectl get svc nginxsvc -o yaml | less
  309. 309 kubectl get svc
  310. 310 kubectl get endpoints
  311. 311 kubectl scale deployment nginxsvc --replicas 5
  312. 312 kubectl get endpoints
  313. 313 curl 10.105.204.135
  314. 314 minikube ssh
  315. 315 kubectl edit svc nginxsvc
  316. 316 kubectl get svc
  317. 317 minikube ip
  318. 318 curl 192.168.49.2:30762
  319. 319 ./countdown 2
  320. 320 history
  321. 321 kubectl edit svc nginxsvc
  322. 322 kubectl get svc
  323. 323 minikube ip
  324. 324 curl 192.168.49.2:30762
  325. 325 kubectl describe svc
  326. 326 kubectl edit svc nginxsvc
  327. 327 kubectl get endpoints
  328. 328 curl 192.168.49.2:30762
  329. 329 history
  330. 330 kubectl get svc,pods -n kube-system
  331. 331 kubectl run testpod --image=busybox -- sleep 3600
  332. 332 kubectl create ns other
  333. 333 kubectl run newnginx --image=nginx -n other
  334. 334 kubectl expose -n other newnginx --port=80
  335. 335 kubectl expose pod -n other newnginx --port=80
  336. 336 kubectl get svc -A
  337. 337 kubectl exec -it testpod -- cat /etc/resolv.conf
  338. 338 kubectl get pods,svc -n kube-system
  339. 339 kubectl exec -it testpod -- nslookup nginxsvc
  340. 340 kubectl exec -it testpod -- nslookup newnginx
  341. 341 kubectl exec -it testpod -- nslookup newnginx.other.svc.cluster.local
  342. 342 history
  343. 343 vim nwpolicy-complete-example.yaml
  344. 344 kubectl apply -f nwpolicy-complete-example.yaml
  345. 345 kubectl expose pod nginx --port=80
  346. 346 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  347. 347 kubectl label pod busybox access=true
  348. 348 kubectl exec -it busybox -- wget --spider --timeout=1 nginx
  349. 349 vim nwpolicy-complete-example.yaml
  350. 350 history
  351. 351 kubectl exec busybox -- wget --spider --timeout=1 nginx
  352. 352 minikube addons list
  353. 353 minikube addons enable ingress
  354. 354 kubectl get ns
  355. 355 kubectl get pods,svc -n ingress-nginx
  356. 356 kubectl get svc
  357. 357 kubectl create ing -h | less
  358. 358 kubectl create ingress nginxsvc-ingress --rule="/=nginxsvc:80" --rule="/hello=newdep:8080"
  359. 359 sudo vim /etc/hosts
  360. 360 kubectl get ingress
  361. 361 curl nginxsvc.info
  362. 362 kubectl describe ing nginxsvc-ingress
  363. 363 kubectl create deploy newdep --image=gcr.io/google-samples/hello-app:2.0
  364. 364 kubectl expose deploy newdep --port=8080
  365. 365 kubectl describe ing nginxsvc-ingress
  366. 366 curl nginxsvc.info
  367. 367 curl nginxsvc.info/hello
  368. 368 history
  369.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement