Advertisement
sandervanvugt

CKAD day2 march21

Mar 16th, 2021
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.56 KB | None | 0 0
  1. student@student-virtual-machine:~/ckad$ history
  2. 1 sudo apt install vim git
  3. 2 git clone https://github.com/sandervanvugt/ckad
  4. 3 cd ckad
  5. 4 sudo ls -l /root
  6. 5 ls
  7. 6 ./kube-setup.sh
  8. 7 sudo reboot
  9. 8 cd ckad/
  10. 9 cat kube-setup.sh
  11. 10 minikube start --memory 4096 --vm-driver=kvm2
  12. 11 kubectl get all
  13. 12 history
  14. 13 free -m
  15. 14 sudo grep vmx /proc/cpuinfo
  16. 15 free -m
  17. 16 df -h
  18. 17 ls
  19. 18 vim kube-setup.sh
  20. 19 vim other-options.txt
  21. 20 minikube -h
  22. 21 minikube status
  23. 22 minikube ssh
  24. 23 kubectl get all
  25. 24 minikube dashboard
  26. 25 bg
  27. 26 ./countdown 12
  28. 27 kubectl get all
  29. 28 kubectl delete pod myfirstnginx-bc9b6d4d7-g9fz2
  30. 29 kubectl get all
  31. 30 kubectl -h
  32. 31 kubectl completion -h
  33. 32 source <(kubectl completion bash)
  34. 33 kubectl create deployment newnginx --image=nginx -h
  35. 34 kubectl create deployment newnginx --image=nginx --replicase=3
  36. 35 kubectl create deployment newnginx --image=nginx --replicas=3
  37. 36 kubectl get all
  38. 37 kubectl version
  39. 38 history
  40. 39 kubectl api-resources | less
  41. 40 kubectl explain priorityclasses
  42. 41 kubectl explain priorityclasses | less
  43. 42 kubectl -h | less
  44. 43 kubectl -h |less
  45. 44 kubectl api-resources | less
  46. 45 kubectl api-versions | less
  47. 46 kubectl explain pod | less
  48. 47 history
  49. 48 ./countdown 12
  50. 49 kubectl proxy --port=8001 &
  51. 50 curl http://localhost:8001/version
  52. 51 kubectl get pods
  53. 52 curl http://localhost:8001/api/v1/namespaces/default/pods
  54. 53 curl http://localhost:8001/api/v1/namespaces/default/pods/newnginx-757c575454-8x76n/
  55. 54 curl -XDELETE http://localhost:8001/api/v1/namespaces/default/pods/newnginx-757c575454-8x76n/
  56. 55 kubectl get pods
  57. 56 kubectl -h | less
  58. 57 kubectl completion -h | less
  59. 58 kubectl explain pod
  60. 59 kubectl explain pod.spec
  61. 60 kubectl explain pod.spec | less
  62. 61 kubectl run -h | less
  63. 62 kubectl run nginx --image=nginx
  64. 63 kubectl get all
  65. 64 kubectl delete pod newnginx-757c575454-zft7m
  66. 65 kubectl get all
  67. 66 kubectl delete pod nginx
  68. 67 kubectl get all
  69. 68 kubectl scale deployment --replicas=4 newnginx
  70. 69 kubectl get all
  71. 70 kubectl delete deployments.apps myfirstnginx
  72. 71 kubectl run --image=mariadb
  73. 72 kubectl run mydb --image=mariadb
  74. 73 kubectl get pods
  75. 74 kubectl describe pod mydb
  76. 75 kubectl logs mydb
  77. 76 kubectl run -h | less
  78. 77 kubectl run mydb --image=mariadb --env=MYSQL_ROOT_PASSWORD=password
  79. 78 kubectl delete pod mydb
  80. 79 kubectl run mydb --image=mariadb --env=MYSQL_ROOT_PASSWORD=password
  81. 80 kubectl get pod
  82. 81 history
  83. 82 ls
  84. 83 vim busybox.yaml
  85. 84 kubectl create -f busybox.yaml
  86. 85 kubectl get pods
  87. 86 vim busybox.yaml
  88. 87 kubectl api-resources | less
  89. 88 kubectl explain pods
  90. 89 kubectl explain pods.spec
  91. 90 kubectl explain pods.spec | less
  92. 91 kubectl explain pods.spec.containers
  93. 92 kubectl explain --recursive pods.spec.containers
  94. 93 ./countdown 12
  95. 94 vim busybox.yaml
  96. 95 kubectl create -f busybox.yaml
  97. 96 vim busybox.yaml
  98. 97 kubectl create -f busybox.yaml
  99. 98 vim busybox.yaml
  100. 99 kubectl create -f busybox.yaml
  101. 100 kubectl run mywhatever --image=nginx --dry-run=client -o yaml > whatever.yaml
  102. 101 vim whatever.yaml
  103. 102 kubectl run busypod --image=busybox --restart=Never --command -- /bin/sh
  104. 103 kubectl get pods
  105. 104 kubectl get pods busypod -o yaml > busypod.yaml
  106. 105 vim busypod.yaml
  107. 106 kubectl run busypod --image=busybox --restart=Never --dry-run=client -o yaml --command -- /bin/sh
  108. 107 vim ~/.vimrc
  109. 108 vim sidecar.yaml
  110. 109 kubectl create -f sidecar.yaml
  111. 110 kubectl get pods
  112. 111 history
  113. 112 https://pastebin.com/u/sandervanvugt
  114. 113 top
  115. 114 kubectl get all
  116. 115 vim sidecar.yaml
  117. 116 kubectl get pods
  118. 117 kubectl exec -it sidecar-pod -c sidecar /bin/bash
  119. 118 vim new-init.yaml
  120. 119 kubectl create -f new-init.yaml
  121. 120 kubectl get pods
  122. 121 vim initpod.yaml
  123. 122 kubectl create -f initpod.yaml
  124. 123 kubectl get pods
  125. 124 kubectl describe pod init-demo
  126. 125 kubectl get events
  127. 126 ./countdown
  128. 127 kubectl run -h | less
  129. 128 kubectl explain pods.spec.securityContext
  130. 129 kubectl explain pods.spec.containers.securityContext
  131. 130 kubectl explain --recursive pods
  132. 131 kubectl explain --recursive pods | less
  133. 132 vim securitycontextdemo2.yaml
  134. 133 kubectl apply -f securitycontextdemo2.yaml
  135. 134 kubectl exec -it security-context-demo -- sh
  136. 135 kubectl create -f securitycontextdemo.yaml
  137. 136 kubectl get pods
  138. 137 kubectl describe pods nginxsecure
  139. 138 kubectl explain pods.spec.containers.securityContext
  140. 139 vim simplejob.yaml
  141. 140 kubectl create -f simplejob.yaml
  142. 141 kubectl get all
  143. 142 kubectl explain jobs.spec
  144. 143 vim simplejob.yaml
  145. 144 kubectl create -f simplejob.yaml
  146. 145 kubectl delete jobs simple-job
  147. 146 kubectl get pods
  148. 147 kubectl create -f simplejob.yaml
  149. 148 kubectl get all
  150. 149 vim simplejob.yaml
  151. 150 kubectl apply -f simplejob.yaml
  152. 151 kubectl delete -f simplejob.yaml
  153. 152 vim simplejob.yaml
  154. 153 kubectl apply -f simplejob.yaml
  155. 154 kubectl get all
  156. 155 vim simplejob.yaml
  157. 156 kubectl apply -f simplejob.yaml
  158. 157 kubectl edit jobs simple-job
  159. 158 ./countdown 12
  160. 159 vim cron-example.yaml
  161. 160 kubectl create -f cron-example.yaml
  162. 161 kubectl get all
  163. 162 date
  164. 163 kubectl get all
  165. 164 kubectl describe cronjobs.batch hello
  166. 165 kubectl get all
  167. 166 kubectl create cronjob -h | less
  168. 167 kubectl create cronjob my-job --image=busybox --schedule="*/5 * * * *" -- logger "hello world" --dry-run=client -o yaml > lab6.yaml
  169. 168*
  170. 169 kubectl create cronjob my-job --image=busybox --schedule="*/5 * * * *" --dry-run=client -o yaml -- logger "hello world"
  171. 170 kubectl get pods
  172. 171 minikube ssh
  173. 172 kubectl get all -A
  174. 173 kubectl get pods -A
  175. 174 kubectl get ns
  176. 175 kubectl create ns secret
  177. 176 vim busybox-ns.yaml
  178. 177 kubectl create -f busybox-ns.yaml
  179. 178 vim busybox-ns.yaml
  180. 179 kubectl create -f busybox-ns.yaml
  181. 180 kubectl get pods
  182. 181 kubectl get pods -n secret
  183. 182 kubectl config set-context --current --namespace=secret
  184. 183 kubectl config view
  185. 184 kubectl config set-context --current --namespace=default
  186. 185 kubectl config view
  187. 186 kubectl config view | grep namespace
  188. 187 kubectl config get-contexts
  189. 188 kubectl config set-context --current --namespace=kube-systemn
  190. 189 kubectl config set-context --current --namespace=kube-system
  191. 190 kubectl get pods
  192. 191 kubectl config set-context --current --namespace=default
  193. 192 kubectl edit pod busypod
  194. 193 kubectl edit pod busypod -n secret
  195. 194 kubectl create quota -h
  196. 195 ubectl create quota my-quota
  197. 196 kubectl create quota my-quota --hard=cpu=1,memory=1G,pods=2,services=3,replicationcontrollers=2,resourcequotas=1,secrets=5,persistentvolumeclaims=10 -n secret
  198. 197 kubectl describe ns secret
  199. 198 kubectl create failginx --image=nginx --replicas=3 -n secret
  200. 199 kubectl create deployment failginx --image=nginx --replicas=3 -n secret
  201. 200 kubectl describe deployments.apps failginx -n secret
  202. 201 kubectl get all -n secret
  203. 202 kubectl describe rs -n secret failginx-6d74bcdc5d
  204. 203 kubectl delete -n secret deployments.apps failginx
  205. 204 vim frontend-resources.yaml
  206. 205 kubectl create -f frontend-resources.yaml
  207. 206 kubectl get all -n secret
  208. 207 kubectl get all -n secret\
  209. 208 kubectl get all -n secret
  210. 209 kubectl describe -n secret pod frontend
  211. 210 kubectl get all -n secret
  212. 211 vim frontend-resources.yaml
  213. 212 kubectl create -f frontend-resources.yaml
  214. 213 kubectl get pods
  215. 214 kubectl describe pods frontend
  216. 215 kubectl create quota -h
  217. 216 vim frontend-resources.yaml
  218. 217 kubectl explain deploy.spec
  219. 218 kubectl explain deploy.spec.template
  220. 219 kubectl explain deploy.spec.template.spec
  221. 220 kubectl explain deploy.spec.template.spec.containers
  222. 221 kubectl create deployment nginxvlah --image=nginx
  223. 222 kubectl get deployments.apps nginxvlah -o yaml
  224. 223 vim redis-deploy.yaml
  225. 224 kubectl create -f redis-deploy.yaml
  226. 225 vim redis-deploy.yaml
  227. 226 kubectl explain deploy
  228. 227 kubectl create -f redis-deploy.yaml
  229. 228 kubectl get all
  230. 229 kubectl edit deployments.apps redis
  231. 230 kubectl get all
  232. 231 kubectl delete pod redis-6fb5b985bc-vfgj7
  233. 232 kubectl get all
  234. 233 ./countdown 12
  235. 234 vim rolling.yaml
  236. 235 kubectl create -f rolling.yaml
  237. 236 kubectl rollout history deployment rolling-nginx
  238. 237 kubectl rollout history deployment rolling-nginx --revision=1
  239. 238 kubectl edit deployments.apps rolling-nginx
  240. 239 kubectl get all
  241. 240 kubectl rollout history deployment
  242. 241 kubectl describe deployments.apps rolling-nginx
  243. 242 kubectl rollout history deployment rolling-nginx --revision=1
  244. 243 kubectl rollout history deployment rolling-nginx --revision=2
  245. 244 kubectl rollout undo deployment rolling-nginx --to-revision=1
  246. 245 kubectl get all
  247. 246 kubectl get all --show-labels
  248. 247 kubectl get all --selector app=newnginx
  249. 248 kubectl create deployment ghost --image=ghost
  250. 249 kubectl get all --selector app=ghost
  251. 250 kubectl get all --selector app=ghost --show-labels
  252. 251 kubectl label deployments.apps ghost state=demo
  253. 252 kubectl get all --selector app=ghost --show-labels
  254. 253 kubectl create deployment nginx --image=nginx
  255. 254 kubectl describe deployments.apps nginx
  256. 255 kubectl describe pod nginx-6799fc88d8-qsn74
  257. 256 kubectl scale deployment nginx --replicas=3
  258. 257 kubectl get all --selector app=nginx
  259. 258 kubectl label pod nginx-6799fc88d8-4h6q6 app-
  260. 259 kubectl get all --selector app=nginx
  261. 260 kubectl get pods
  262. 261 ./countdown 5
  263. 262 kubectl get cron.spec
  264. 263 kubectl explain cron.spec
  265. 264 kubectl explain cronjob.spec
  266. 265 kubectl explain cronjob.spec.jobTemplate
  267. 266 kubectl explain cronjob.spec.jobTemplate.spec
  268. 267 kubectl get pods -o wide
  269. 268 ./countdown 12
  270. 269 kubectl create cronjob -h | less
  271. 270 kubectl get deployments.apps
  272. 271 kubectl delete deploy newnginx,nginxvlah
  273. 272 kubectl delete deploy newnginx
  274. 273 kubectl delete deploy nginxvlah
  275. 274 kubectl delete deploy rolling-nginx
  276. 275 kubectl delete deploy redis
  277. 276 kubectl delete deploy ghost
  278. 277 kubectl get deployments.apps
  279. 278 kubectl expose -h
  280. 279 kubectl expose -h | less
  281. 280 kubectl expose deployment nginx --port=80 --type=NodePort
  282. 281 kubectl get svc
  283. 282 kubectl get svc nginx -o yaml
  284. 283 kubectl describe service nginx
  285. 284 kubectl create deployment nginxsvc --image=nginx --replicas=3
  286. 285 kubectl expose deployment nginxsvc
  287. 286 kubectl expose deployment nginxsvc --port 80
  288. 287 kubectl describe svc nginxsvc
  289. 288 kubectl get endpoints
  290. 289 curl http://10.98.138.32
  291. 290 minikube ssh
  292. 291 kubectl edit svc nginxsvc
  293. 292 kubectl get svc
  294. 293 curl http://$(minikube ip):32000
  295. 294 minikube ip
  296. 295 curl http://192.168.39.192:32000
  297. 296 kubectl get pods
  298. 297 kubectl get svc
  299. 298 kubectl exec -it busybox2 -- cat /etc/resolv.conf
  300. 299 kubectl exec -it busybox2 -- nslookup nginxsvc
  301. 300 kubectl exec -it busybox2 -- nslookup myfirstnginx
  302. 301 minikube addons list
  303. 302 minikube addons enable ingress
  304. 303 history
  305.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement