Advertisement
sandervanvugt

CKAD day2 dec22

Dec 6th, 2022
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.08 KB | None | 0 0
  1. student@student-virtual-machine:~/ckad$ history
  2. 1 minikube start --vm-driver=docker --cni=calico
  3. 2 kubectl get all
  4. 3 minikube status
  5. 4 minikube ssh
  6. 5 minikube dashboard
  7. 6 bg
  8. 7 kubectl get all
  9. 8 source <(kubectl completion bash)
  10. 9 kubectl get all
  11. 10 kubectl create deployment firstginx --image=nginx --replicas=3
  12. 11 kubectl get all
  13. 12 history
  14. 13 kubectl completion -h | less
  15. 14 kubectl scale deployment --replicas=1
  16. 15 kubectl scale deployment firstginx --replicas 1
  17. 16 kubectl get all
  18. 17 kubectl scale deployment firstginx --replicas 3
  19. 18 history
  20. 19 kubectl get pods
  21. 20 kubectl get pods -o wide
  22. 21 history
  23. 22 kubectl -h | less
  24. 23 kubectl create -h | less
  25. 24 kubectl create deploy -h | less
  26. 25 ls
  27. 26 history
  28. 27 cd
  29. 28 git clone https://github.com/sandervanvugt/ckad
  30. 29 cd ckad
  31. 30 cd dockerfile/
  32. 31 ls
  33. 32 vim Dockerfile
  34. 33 docker build . -t centmap
  35. 34 docker images
  36. 35 docker save --help
  37. 36 cd ..
  38. 37 ./countdown 12
  39. 38 history
  40. 39 kubectl run -h | less
  41. 40 kubectl run hazelcast --image=hazelcast/hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"
  42. 41 kubectl get pods
  43. 42 kubectl get pods hazelcast -o json | less
  44. 43 kubectl get pods hazelcast -o yaml | less
  45. 44 kubectl describe pod hazelcast | less
  46. 45 kubectl get pods
  47. 46 kubectl delete pod firstginx-7c4fcf6b55-w6pd2
  48. 47 kubectl get pods
  49. 48 kubectl get all
  50. 49 kubectl delete pod hazelcast
  51. 50 kubectl get all
  52. 51 kubectl scale deployment firstginx --replicas 2
  53. 52 kubectl get all
  54. 53 kubectl delete replicasets.apps firstapp-568f648dc5
  55. 54 kubectl get all
  56. 55 kubectl delete deploy firstapp
  57. 56 kubectl get all
  58. 57 history
  59. 58 kubectl get deployments.apps -o yaml | less
  60. 59 kubectl get deployments.apps firstginx -o yaml | less
  61. 60 kubectl explain pod
  62. 61 kubectl explain pod.spec | less
  63. 62 kubectl explain pod.spec.volumes | less
  64. 63 kubectl run yournginx --image=nginx --dry-run=client -o yaml
  65. 64 kubectl run yournginx --image=nginx --dry-run=client -o yaml > yournginx.yaml
  66. 65 kubectl explain pod.spec
  67. 66 kubectl explain pod.spec | less
  68. 67 vim yournginx.yaml
  69. 68 kubectl create -f yournginx.yaml
  70. 69 kubectl apply -f yournginx.yaml
  71. 70 kubectl run -h | less
  72. 71 kubectl create -h | less
  73. 72 history
  74. 73 vim sidecar.yaml
  75. 74 kubectl create -f sidecar.yaml
  76. 75 kubectl get pods
  77. 76 kubectl describe pod sidecar-pod
  78. 77 kubectl exec -it sidecar-pod -c sidecar -- /bin/bash
  79. 78 ./countdown 12
  80. 79 cat sidecar.yaml
  81. 80 vim initone.yaml
  82. 81 kubectl apply -f initone.yaml
  83. 82 kubectl get pods
  84. 83 cat initone.yaml
  85. 84 kubectl get pods
  86. 85 kubectl describe pod initone
  87. 86 kubectl get pods
  88. 87 vim initone.yaml inittwo.yaml
  89. 88 vim inittwo.yaml
  90. 89 cp initone.yaml inittwo.yaml
  91. 90 vim inittwo.yaml
  92. 91 kubectl apply -f inittwo.yaml
  93. 92 kubectl get pods
  94. 93 kubectl delete pod initone
  95. 94 history
  96. 95 kubectl get all
  97. 96 kubectl get ns
  98. 97 kubectl create ns secret
  99. 98 kubectl get ns
  100. 99 kubectl run secretpod --image=nginx -n secret
  101. 100 kubectl get pods
  102. 101 kubectl get pods -n secret
  103. 102 kubectl get pods -A
  104. 103 kubectl config view
  105. 104 kubectl config set-context --current secret
  106. 105 kubectl config set --current secret
  107. 106 kubectl config --help
  108. 107 kubectl config set-context --current ns=secret
  109. 108 kubectl config set-context --current --ns=secret
  110. 109 kubectl config set-context --current --namespace=secret
  111. 110 kubectl config set-context -h | less
  112. 111 kubectl get pods
  113. 112 kubectl config set-context --current --namespace=default
  114. 113 kubectl get pods
  115. 114 history
  116. 115 kubectl explain pod
  117. 116 kubectl explain pod.spec
  118. 117 kubectl describe pod yournginx
  119. 118 kubectl get pods
  120. 119 kubectl exec -it firstginx-7c4fcf6b55-6r9zl -- sh
  121. 120 kubectl logs yournginx
  122. 121 kubectl describe pods yournginx | less
  123. 122 history
  124. 123 kubectl describe pods yournginx | grep volume
  125. 124 kubectl run faildb --image=mariadb
  126. 125 kubectl get pods
  127. 126 kubectl describe pod faildb
  128. 127 kubectl logs faildb
  129. 128 kubectl get pods
  130. 129 history
  131. 130 kubectl explain pod.spec.securityContext
  132. 131 kubectl explain pod.spec.securityContext | less
  133. 132 kubectl explain pod.spec.containers.spec.securityContext | less
  134. 133 kubectl explain pod.spec.containers.securityContext | less
  135. 134 vim securitycontextdemo2.yaml
  136. 135 kubectl apply -f securitycontextdemo2.yaml
  137. 136 kubectl exec -it security-context-demo sh
  138. 137 kubectl apply -f securitycontextdemo.yaml
  139. 138 kubectl get pods
  140. 139 kubectl describe pod nginxsecure
  141. 140 history
  142. 141 kubectl api-resources | less
  143. 142 kubectl create job onejob --image=busybox -- date
  144. 143 kubectl get jobs,pods
  145. 144 kubectl get jobs onejob -o yaml | less
  146. 145 kubectl delete job onejob
  147. 146 kubectl get pods
  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 kubectl get pods,jobs
  152. 151 sleep 60; kubectl get pods,jobs
  153. 152 history
  154. 153 kubectl create cronjob -h | less
  155. 154 kubectl create cronjob runme --image=busybox --schedule="42 * * * *" -- echo greetings from the cluster
  156. 155 kubectl get cronjobs,jobs,pods
  157. 156 date
  158. 157 kubectl get cronjobs,jobs,pods
  159. 158 kubectl logs runme-27838902-tjshv
  160. 159 kubectl get cronjob runme -o yaml | less
  161. 160 kubectl delete cronjobs.batch runme
  162. 161 history
  163. 162 kubectl create cj -h | less
  164. 163 kubectl create cronjob my-job --image=busybox --schedule="*/5 * * * *" -- logger hello world
  165. 164 history
  166. 165 vim frontend-resources.yaml
  167. 166 kubectl apply -f frontend-resources.yaml
  168. 167 kubectl describe pod frontend | less
  169. 168 kubectl get pods
  170. 169 kubectl describe pod frontend
  171. 170 kubectl delete -f frontend-resources.yaml
  172. 171 vim frontend-resources.yaml
  173. 172 kubectl apply -f frontend-resources.yaml
  174. 173 kubectl get pods
  175. 174 kubectl delete -f frontend-resources.yaml
  176. 175 vim frontend-resources.yaml
  177. 176 kubectl apply -f frontend-resources.yaml
  178. 177 kubectl get pods
  179. 178 vim frontend-resources.yaml
  180. 179 minikube ssh
  181. 180 kubectl delete -f frontend-resources.yaml
  182. 181 vim frontend-resources.yaml
  183. 182 kubectl apply -f frontend-resources.yaml
  184. 183 kubectl get pods
  185. 184 kubectl describe pod frontend
  186. 185 vim frontend-resources.yaml
  187. 186 kubectl apply -f frontend-resources.yaml
  188. 187 history
  189. 188 vim lab6.yaml
  190. 189 kubectl apply -f lab6.yaml
  191. 190 kubectl get pods
  192. 191 kubectl describe pod httpd
  193. 192 vim busybox-ready.yaml
  194. 193 kubectl create -f busybox-ready.yaml
  195. 194 kubectl get pods
  196. 195 kubectl describe pod busybox-ready
  197. 196 kubectl edit pods busybox-ready
  198. 197 kubectl exec -it busybox-ready -- /bin/sh
  199. 198 kubectl get pods
  200. 199 vim nginx-probes.yaml
  201. 200 kubectl get all
  202. 201 curl -k kubernetes:6443/healthz
  203. 202 minikube ssh
  204. 203 vim au.yaml
  205. 204 kubectl create -f au.yaml
  206. 205 kubectl get pods
  207. 206 vim au.yaml
  208. 207 kubectl delete -f au.yaml
  209. 208 kubectl create -f au.yaml
  210. 209 kubectl get pods
  211. 210 vim au.yaml
  212. 211 kubectl delete pod readiness-exec
  213. 212 kubectl create -f au.yaml
  214. 213 kubectl get pods
  215. 214 vim au.yaml
  216. 215 minikube ssh
  217. 216 vim au.yaml
  218. 217 kubectl explain pod.spec.readinessProbe
  219. 218 vim au.yaml
  220. 219 kubectl explain pod.spec.containers.readinessProbe
  221. 220 kubectl explain pod.spec.containers.readinessProbe.httpGet
  222. 221 vim au.yaml
  223. 222 kubectl explain pod.spec.containers.readinessProbe.tcpSocket
  224. 223 vim au.yaml
  225. 224 kubectl delete -f au.yaml
  226. 225 kubectl create -f au.yaml
  227. 226 kubectl get pods
  228. 227 curl -k $(minikube ip):8443/healthz
  229. 228 curl -k https://$(minikube ip):8443/healthz
  230. 229 minikube ssh
  231. 230 minikube ip
  232. 231 kubectl delete -f au.yaml
  233. 232 vim au.yaml
  234. 233 kubectl delete pod readiness-exec
  235. 234 kubectl create -f au.yaml
  236. 235 kubectl get pods
  237. 236 kubectl describe pod readiness-exec
  238. 237 kubectl delete pod readiness-exec
  239. 238 vim au.yaml
  240. 239 kubectl create -f au.yaml
  241. 240 kubectl get pods
  242. 241 kubectl describe pod readiness-exec
  243. 242 kubectl delete pod readiness-exec
  244. 243 vim au.yaml
  245. 244 cp au.yaml au2.yaml
  246. 245 vim au2.yaml
  247. 246 kubectl create -f au2.yaml
  248. 247 kubectl get pods
  249. 248 kubectl describe pod readiness-exec
  250. 249 kubectl get pods
  251. 250 kubectl exec -it busybox-ready -- sh
  252. 251 vim au2.yaml
  253. 252 kubectl delete pod readiness-exec
  254. 253 kubectl create -f au2.yaml
  255. 254 kubectl get pods
  256. 255 kubectl delete pod readiness-exec
  257. 256 vim au2.yaml
  258. 257 kubectl create -f au2.yaml
  259. 258 kubectl get pods
  260. 259 history
  261. 260 curl -k https://$(minikube ip):8443/healthz
  262. 261 vim au.yaml
  263. 262 vim au2.yaml
  264. 263 cat au2.yaml
  265. 264 kubectl create deploy myweb --image=nginx --replicas=3
  266. 265 kubectl describe deploy myweb | less
  267. 266 kubectl get all --selector app=myweb
  268. 267 kubectl delete pod myweb-d5b9458bc-n6ggw
  269. 268 kubectl get all --selector app=myweb
  270. 269 vim redis-deploy.yaml
  271. 270 kubectl apply -f redis-deploy.yaml
  272. 271 vim redis-deploy.yaml
  273. 272 kubectl api-resources | less
  274. 273 vim redis-deploy.yaml
  275. 274 kubectl apply -f redis-deploy.yaml
  276. 275 kubectl get all
  277. 276 kubectl edit deployments.apps redis
  278. 277 kubectl get deploy
  279. 278 kubectl delete rs redis-6467896d84
  280. 279 kubectl get all | grep redis
  281. 280 history
  282. 281 kubectl create deploy nginxup --image=nginx:1.14
  283. 282 kubectl get all --selector app=nginxup
  284. 283 kubectl scale deployment nginxup --replicas=3
  285. 284 kubectl set image deploy nginxup nginx=nginx:1.17
  286. 285 kubectl get all --selector app=nginxup
  287. 286 kubectl get deploy
  288. 287 kubectl get deploy redis -o yaml | less
  289. 288 kubectl create deploy bluelabel --image=nginx
  290. 289 kubectl label deployment bluelabel state=demo
  291. 290 kubectl get deploy --show-labels
  292. 291 kubectl get all --selector state=demo
  293. 292 kubectl get all --selector app=bluelabel
  294. 293 kubectl describe deploy bluelabel
  295. 294 kubectl get all | grep blue
  296. 295 kubectl label pod bluelabel-d7894847c-wwsl9 app-
  297. 296 kubectl get all | grep blue
  298. 297 kubectl get all --selector=run
  299. 298 kubectl get all --selector=run --show-labels
  300. 299 history
  301. 300 kubectl scale deploy bluelabel --replicas 4
  302. 301 kubectl get all --selector app=bluelabel
  303. 302 kubectl set env deploy bluelabel type=blended
  304. 303 kubectl get all --selector app=bluelabel
  305. 304 vim rolling.yaml
  306. 305 kubectl apply -f rolling.yaml
  307. 306 kubectl rollout history deployment
  308. 307 kubectl edit deployments.apps rolling-nginx
  309. 308 kubectl rollout history deployment rolling-nginx
  310. 309 kubectl rollout history deployment rolling-nginx --revision=2
  311. 310 kubectl rollout history deployment rolling-nginx --revision=1
  312. 311 kubectl rollout undo deployment rolling-nginx --to-revision 1
  313. 312 kubectl get all --selector app=rolling-nginx
  314. 313 kubectl get all | grep rolling
  315. 314 kubectl delete all --all
  316. 315 history
  317. 316 vim rolling.yaml
  318. 317 kubect get all
  319. 318 kubectl get all
  320. 319 kubectl create deployment nginxsvc --image=nginx --replicas=3
  321. 320 kubectl get all
  322. 321 kubectl expose deploy nginxsvc --port=80
  323. 322 kubectl get all
  324. 323 kubectl get svc nginxsvc -o yaml | less
  325. 324 kubectl get svc
  326. 325 kubectl describe svc nginxsvc
  327. 326 kubectl get pods -o wide
  328. 327 kubectl get endpoints
  329. 328 kubectl edit svc nginxsvc
  330. 329 kubectl get endpoints
  331. 330 kubectl edit svc nginxsvc
  332. 331 kubectl get endpoints
  333. 332 curl 10.109.243.181
  334. 333 kubectl get svc
  335. 334 minikube ssh
  336. 335 kubectl edit svc nginxsvc
  337. 336 kubectl get svc
  338. 337 minikube ip
  339. 338 curl 192.168.49.2:32000
  340. 339 history
  341. 340 kubectl run testbox --image=busybox --sleep=36000
  342. 341 kubectl run testbox --image=busybox -- sleep=36000
  343. 342 kubectl exec -it testbox -- cat /etc/resolv.conf
  344. 343 kubectl get all
  345. 344 kubectl delete testbox
  346. 345 kubectl delete pod testbox
  347. 346 kubectl run testbox --image=busybox -- sleep 36000
  348. 347 kubectl exec -it testbox -- cat /etc/resolv.conf
  349. 348 kubectl get svc -A
  350. 349 kubectl exec -it testbox -- nslookup nginxsvc
  351. 350 kubectl create ns testspace; kubectl run testx --image=nginx -n testspace
  352. 351 kubectl get pods -A
  353. 352 kubectl expose -n testspace pod testx --port=80 --type=NodePort
  354. 353 kubectl get svc -A
  355. 354 kubectl exec -it testbox -- nslookup testspace
  356. 355 kubectl exec -it testbox -- nslookup testx
  357. 356 kubectl exec -it testbox -- nslookup testx.testspace.svc.cluster.local
  358. 357 kubectl get svc -A
  359. 358 kubectl exec -it testbox -- nslookup testx.testspace.svc.cluster.local
  360. 359 history
  361.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement