Advertisement
sandervanvugt

CKAD day2 oct21

Oct 14th, 2021
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.36 KB | None | 0 0
  1. student@student-virtual-machine:~/ckad$ history
  2. 1 sudo apt install git vim -y
  3. 2 git clone https://github.com/sandervanvugt/ckad
  4. 3 cd ckad
  5. 4 ls
  6. 5 ./minikube-docker-setup.sh
  7. 6 minikube start --vm-driver=docker
  8. 7 history
  9. 8 ls
  10. 9 minikube status
  11. 10 minikube dashboard
  12. 11 kubectl get all
  13. 12 curl 10.99.11.196
  14. 13 minikube ssh
  15. 14 ls
  16. 15 kubectl version
  17. 16 ls
  18. 17 ./countdown 13
  19. 18 kubectl api-resources | less
  20. 19 kubectl get all
  21. 20 kubectl get pods -o wide
  22. 21 kubectl delete pod removemeginx-b4b69d8d7-qkmmp
  23. 22 kubectl get all
  24. 23 kubectl api-versions
  25. 24 minikube ssh
  26. 25 kubectl --v=10 get pods
  27. 26 kubectl proxy --port=8001 &
  28. 27 curl http://localhost:8001/version
  29. 28 curl http://localhost:8001/api/v1/namespaces/default/pods
  30. 29 curl http://localhost:8001/api/v1/namespaces/default/pods/removemeginx-b4b69d8d7-4mds4
  31. 30 curl -XDELETE http://localhost:8001/api/v1/namespaces/default/pods/removemeginx-b4b69d8d7-4mds4
  32. 31 kubectl get pods
  33. 32 kubectl -h
  34. 33 kubectl -h | less
  35. 34 kubectl create -h | less
  36. 35 kubectl create serviceaccount -h | less
  37. 36 kubectl completion -h
  38. 37 source <(kubectl completion bash)
  39. 38 kubectl config view
  40. 39 cd ~/.kube/c
  41. 40 cd ~/.kube/
  42. 41 vim config
  43. 42 cd -
  44. 43 history; sleep 2; ./countdown 12
  45. 44 history; sleep 120; ./countdown 10
  46. 45 kubectl get pods
  47. 46 kubectl run -h | less
  48. 47 kubectl run ghost --image=ghost:0.9
  49. 48 kubectl get pods
  50. 49 kubectl describe pod ghost
  51. 50 kubectl get pods ghost
  52. 51 kubectl get pods ghost -o yaml | less
  53. 52 kubectl get pods
  54. 53 kubectl delete pod ghost
  55. 54 kubectl get pods
  56. 55 kubectl explain pods
  57. 56 kubectl explain pods.spec
  58. 57 kubectl explain pods.spec.containers
  59. 58 kubectl explain --recursive pods.spec | less
  60. 59 history
  61. 60 kubectl run ghost --image=ghost:0.9 --dry-run=client -o yaml > myghost.yaml
  62. 61 vim myghost.yaml
  63. 62 kubectl api-resources | less
  64. 63 vim myghost.yaml
  65. 64 kubectl create -f myghost.yaml
  66. 65 vim myghost.yaml
  67. 66 kubectl apply -f myghost.yaml
  68. 67 kubectl replace -f myghost.yaml
  69. 68 kubectl get pods
  70. 69 history
  71. 70 kubectl delete -f myghost.yaml
  72. 71 vim myghost.yaml
  73. 72 kubectl apply -f myghost.yaml
  74. 73 vim myghost.yaml
  75. 74 kubectl apply -f myghost.yaml
  76. 75 ./countdown 10
  77. 76 vim sidecar.yaml
  78. 77 kubectl create -f sidecar.yaml
  79. 78 kubectl exec -it sidecar-pod -c sidecar /bin/bash
  80. 79 vim morevolumes.yaml
  81. 80 vim initpod.yaml
  82. 81 kubectl create -f initpod.yaml
  83. 82 kubectl get pods
  84. 83 kubectl delete -f initpod.yaml
  85. 84 vim initpod.yaml
  86. 85 kubectl create -f initpod.yaml
  87. 86 kubectl get pods
  88. 87 vim sidecar.yaml
  89. 88 kubectl run mydb --image=mariadb
  90. 89 kubectl get all
  91. 90 kubectl describe pod mydb
  92. 91 kubectl logs mydb
  93. 92 kubectl delete pod mydb
  94. 93 kubectl run -h | less
  95. 94 kubectl run mydb --image=mariadb --env=MARIADB_ROOT_PASSWORD=password
  96. 95 kubectl get pods
  97. 96 kubectl exec -it mydb -- sh
  98. 97 history
  99. 98 sudo poweroff
  100. 99 minikube start
  101. 100 history
  102. 101 kubectl explain pod.spec.securityContext
  103. 102 kubectl explain pod.spec.containers.spec.securityContext
  104. 103 kubectl explain pod.spec.containers.securityContext
  105. 104 history
  106. 105 kubectl explain --recursive pod.spec | less
  107. 106 cd ckad/
  108. 107 vim securitycontextdemo2.yaml
  109. 108 kubectl apply -f securitycontextdemo2.yaml
  110. 109 kubectl get pods
  111. 110 source <(kubectl completion bash)
  112. 111 kubectl exec -it securitycontextdemo -- sh
  113. 112 kubectl get pods
  114. 113 kubectl exec -it security-context-demo -- sh
  115. 114 kubectl apply -f securitycontextdemo2.yaml
  116. 115 vim securitycontextdemo2.yaml
  117. 116 vim securitycontextdemo.yaml
  118. 117 kubectl create -f securitycontextdemo.yaml
  119. 118 kubectl get pods
  120. 119 kubectl describe nginxsecure
  121. 120 kubectl describe pod nginxsecure
  122. 121 kubectl get all
  123. 122 kubectl delete all --all
  124. 123 kubectl create -h | less
  125. 124 kubectl create job -h | less
  126. 125 kubectl create job my-job --image=busybox -- date --dry-run=client -o yaml
  127. 126 kubectl create job my-job --image=busybox --dry-run=client -o yaml -- date
  128. 127 vim simplejob.yaml
  129. 128 kubectl create -f simplejob.yaml
  130. 129 kubectl get all
  131. 130 kubectl delete job/my-job
  132. 131 kubectl get all
  133. 132 kubectl get jobs simple-job -o yaml
  134. 133 kubectl delete jobs.batch simple-job
  135. 134 vim simplejob.yaml
  136. 135 kubectl create -f simplejob.yaml
  137. 136 kubectl get all
  138. 137*
  139. 138 kubectl delete jobs.batch simple-job
  140. 139 vim simplejob.yaml
  141. 140 kubectl create -f simplejob.yaml
  142. 141 kubectl get all
  143. 142 vim simplejob.yaml
  144. 143 kubectl get all
  145. 144 kubectl explain CronJob.spec | less
  146. 145 kubectl create -h | less
  147. 146 kubectl create cronjob -h | less
  148. 147 vim cron-example.yaml
  149. 148 kubectl create -f cron-example.yaml
  150. 149 kubectl get cronjobs.batch hello
  151. 150 kubectl get cronjobs
  152. 151 kubectl get jobs --watch
  153. 152 kubectl get all
  154. 153 kubectl logs hello-27236922--1-g9f57
  155. 154 kubectl delete cronjob hello
  156. 155 kubectl create cronjob -h | less
  157. 156 # kubectl create cronjob my-job --image=busybox --schedule="*/1 * * * *" -- date
  158. 157 kubectl create cronjob my-job --image=busybox --schedule="*/5 * * * *" -- logger hello world
  159. 158 kubectl get all
  160. 159 kubectl get ns
  161. 160 kubectl get all
  162. 161 kubectl get all -A
  163. 162 kubectl get all -n kube-system
  164. 163 kubectl get all -A
  165. 164 kubectl create ns secret
  166. 165 vim busybox-ns.yaml
  167. 166 kubectl run -h | less
  168. 167 kubectl run busybox -n secret -- sleep 1800
  169. 168 kubectl run sleepubox --image=busybox -n secret -- sleep 1800
  170. 169 kubectl get all
  171. 170 kubectl get pods -n secret
  172. 171 kubectl config set-context --current -n secret
  173. 172 kubectl config set-context --current --namespace=secret
  174. 173 kubectl get pods
  175. 174 kubectl config set-context --current --namespace=default
  176. 175 ./countdown 12
  177. 176 kubectl delete --help | less
  178. 177 kubectl get pods -A
  179. 178 kubectl delete all --all
  180. 179 kubectl get pods -A
  181. 180 vim frontend-resources.yaml
  182. 181 kubectl create -f frontend-resources.yaml
  183. 182 kubectl get all
  184. 183 kubectl describe pod frontend
  185. 184 kubectl edit pod frontend
  186. 185 kubectl delete pod frontend --grace-period=0 --force
  187. 186 kubectl get all
  188. 187 vim frontend-resources.yaml
  189. 188 kubectl create -f frontend-resources.yaml
  190. 189 kubectl get pods
  191. 190 kubectl run --help | less
  192. 191 kubectl run myserver --image=nginx --limits="memory=512M"
  193. 192 kubectl explain deployment.spec
  194. 193 kubectl explain deployment.spec.strategy
  195. 194 kubectl explain deployment.spec.strategy.rollingUpdate
  196. 195 kubectl create deployment nginxblah --image=nginx
  197. 196 kubectl get all
  198. 197 kubectl scale deployment nginxblah --replicas=3
  199. 198 kubectl get all
  200. 199 kubectl delete pod nginxblah-7dc7fb8c85-2hhj6
  201. 200 kubectl get pods
  202. 201 kubectl get deployments.apps nginxblah -o yaml | less
  203. 202 kubectl get all --show-labels
  204. 203 kubectl get all --selector app=nginxblah
  205. 204 kubectl get all --show-labels
  206. 205 kubectl label pod nginxblah-7dc7fb8c85-zqgbk app-
  207. 206 kubectl get all --show-labels
  208. 207 kubectl get deployments.apps nginxblah -o yaml | less
  209. 208 kubectl edit deployments.apps nginxblah
  210. 209 kubectl get all
  211. 210 vim redis-deploy.yaml
  212. 211 kubectl create -f redis-deploy.yaml
  213. 212 kubectl api-versions | less
  214. 213 vim redis-deploy.yaml
  215. 214 kubectl create -f redis-deploy.yaml
  216. 215 kubectl scale deployment redis --replicas=2
  217. 216 kubectl get all
  218. 217 kubectl delete rs redis-6fb5b985bc
  219. 218 history
  220. 219 kubectl get all
  221. 220 kubectl delete deployments.apps redis
  222. 221 kubectl explain replicaset.spec
  223. 222 kubectl explain deployment.spec
  224. 223 ./countdown 60
  225. 224 kubectl create deployment nginx-lab7 --image=nginx --replicas=3
  226. 225 ./countdown 13
  227. 226 cd ..
  228. 227 https://github.com/cncf/curriculum
  229. 228 git clone https://github.com/cncf/curriculum
  230. 229 cd ckad/
  231. 230 vim rolling.yaml
  232. 231 kubectl create -f rolling.yaml
  233. 232 kubectl rollout history deployment
  234. 233 kubectl edit deployments.apps rolling-nginx
  235. 234 kubectl get all
  236. 235 kubectl rollout history deployment
  237. 236 kubectl describe deployments.apps rolling-nginx
  238. 237 kubectl rollout history deployment rolling-nginx --revision=2
  239. 238 kubectl rollout history deployment rolling-nginx --revision=1
  240. 239 kubectl rollout undo deployment rolling-nginx --to-revision=1
  241. 240 kubectl get all
  242. 241 kubectl get deploy --show-labels
  243. 242 kubectl create deploy nginxsvc --image=nginx --replicas=3
  244. 243 kubectl get all --selector app=nginxsvc
  245. 244 kubectl expose deployment nginxsvc
  246. 245 kubectl expose deployment nginxsvc --port=80
  247. 246 kubectl get all --selector app=nginxsvc
  248. 247 kubectl get endpoint
  249. 248 kubectl get endpoints
  250. 249 curl 10.107.210.223
  251. 250 minikube ssh
  252. 251 kubectl edit svc nginxsvc
  253. 252 kubectl get svc
  254. 253 minikube ip
  255. 254 curl http://$(minikube ip):32000
  256. 255 ./countdown 12
  257. 256 kubectl get svc
  258. 257 kubectl get svc nginxsvc
  259. 258 kubectl get svc nginxsvc -o yaml
  260. 259 kubectl get pods -n kube-system
  261. 260 vim busybox.yaml
  262. 261 kubectl create -f busybox.yaml
  263. 262 kubectl get svc
  264. 263 kubectl exec -it busybox2 -- nslookup nginxsvc
  265. 264 minikube addons list
  266. 265 minikube addons enable ingress
  267. 266 kubect get all --selector app=nginxsvc
  268. 267 kubectl get all --selector app=nginxsvc
  269. 268 curl http://$(minikube ip):32000
  270. 269 vim nginxsvc-ingress.yaml
  271. 270 kubectl apply -f nginxsvc-ingress.yaml
  272. 271 kubectl get ingress
  273. 272 sudo vim /etc/hosts
  274. 273 minikube ip
  275. 274 cat /etc/hosts
  276. 275 kubectl get ingress
  277. 276 curl nginxsvc.info
  278. 277 kubectl get ingress
  279. 278 kubectl get ingress -o yaml
  280. 279 kubectl describe ingress nginxsvc-ingress
  281. 280 kubectl create deployment newdep --image=gcr.io/google-samples/hello-app:2.0
  282. 281 kubectl get deploy
  283. 282 kubectl expose deployment newdep --port=8080
  284. 283 kubectl describe ingress nginxsvc-ingress
  285. 284 curl nginxsvc.info/hello
  286. 285 history
  287.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement