sandervanvugt

kube3weeks march 23 all days

Mar 24th, 2023
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.39 KB | None | 0 0
  1. student@control:~$ history
  2. 1 exit
  3. 2 free -m
  4. 3 lscpu | less
  5. 4 df -h
  6. 5 git clone https://github.com/sandervanvugt/kube3weeks
  7. 6 cd kube3weeks/
  8. 7 ./countdown 15
  9. 8 ls -l *sh
  10. 9 cd ..
  11. 10 cd kube3weeks/
  12. 11 git pull
  13. 12 history
  14. 13 vim setup-container.sh
  15. 14 ./setup-container.sh
  16. 15 sudo systemctl status containerd
  17. 16 history
  18. 17 ./setup-kubetools.sh
  19. 18 sudo ./setup-kubetools.sh
  20. 19 sudo kubeadm init
  21. 20 mkdir -p $HOME/.kube
  22. 21 kubectl get all
  23. 22 ls cal*
  24. 23 kubectl apply -f calico.yaml
  25. 24 history
  26. 25 sudo systemctl status containerd
  27. 26 free -m
  28. 27 history
  29. 28 kubectl get all
  30. 29 source <(kubectl completion bash)
  31. 30 kubectl create deploy myfirstapp --image=nginx --replicas=3
  32. 31 kubectl get all
  33. 32 history
  34. 33 kubectl get all
  35. 34 kubectl delete pod myfirstapp-ff8c4b4d4-fkg4h
  36. 35 kubectl get all
  37. 36 history
  38. 37 kubectl run lonelypod --image=nginx
  39. 38 kubectl get all
  40. 39 kubectl delete pod lonelypod
  41. 40 kubectl get all
  42. 41 history
  43. 42 sudo systemctl status containerd
  44. 43 sudo systemctl status kubelet
  45. 44 kubectl get pods -n kube-system
  46. 45 kubectl get all
  47. 46 kubectl config view
  48. 47 kubectl get nodes
  49. 48 kubectl edit nodes control
  50. 49 kubectl get all
  51. 50 history | grep create depl
  52. 51 history | grep 'create depl'
  53. 52 kubectl api-resources | less
  54. 53 kubectl explain pod.spec
  55. 54 kubectl explain pod.spec | less
  56. 55 history
  57. 56 kubectl run mynginx --image=nginx --dry-run=client -o yaml
  58. 57 kubectl run mynginx --image=nginx --dry-run=client -o yaml > mynginx.yaml
  59. 58 kubectl explain pods.spec
  60. 59 kubectl explain pods.spec.volumes
  61. 60 kubectl apply -f mynginx.yaml
  62. 61 kubectl create -f mynginx.yaml
  63. 62 kubectl get pods
  64. 63 kubectl delete -f mynginx.yaml
  65. 64 ./countdown 13
  66. 65 vim multicontainer.yaml
  67. 66 kubectl apply -f multicontainer.yaml
  68. 67 kubectl get pods
  69. 68 vim initcontainer.yaml
  70. 69 kubectl create -f initcontainer.yaml
  71. 70 kubectl get pods
  72. 71 kubectl get ns
  73. 72 kubectl get pods
  74. 73 kubectl get pods -n kube-system
  75. 74 kubectl create ns myns
  76. 75 kubectl get ns
  77. 76 kubectl run mypod --image=nginx -n myns
  78. 77 kubectl get pods
  79. 78 kubectl get pods -n myns
  80. 79 kubectl get pods -A
  81. 80 history
  82. 81 kubectl config set-context --current namespace=myns
  83. 82 kubectl config set-context --current --namespace=myns
  84. 83 kubectl get pods
  85. 84 kubectl config set-context --current --namespace=default
  86. 85 kubectl get pdos
  87. 86 kubectl get pods
  88. 87 kubectl config view
  89. 88 history
  90. 89 kubectl run mydb --image=mariadb
  91. 90 kubectl get pods
  92. 91 kubectl describe pods mydb
  93. 92 kubectl get pods
  94. 93 kubectl describe pod mydb | less
  95. 94 history
  96. 95 kubectl logs mydb
  97. 96 kubectl delete pod mydb
  98. 97 kubectl run -h | less
  99. 98 kubectl run dbsdb --image=mariadb --env MARIADB_ROOT_PASSWORD=password
  100. 99 kubectl get pods
  101. 100 ls
  102. 101 cd ..
  103. 102 cd kube3weeks/
  104. 103 git pull
  105. 104 vim frontend-resources.yaml
  106. 105 kubectl apply -f frontend-resources.yaml
  107. 106 kubectl get pods
  108. 107 kubectl describe pod frontend
  109. 108 vim frontend-resources.yaml
  110. 109 kubectl delete pod frontend
  111. 110 kubectl apply -f frontend-resources.yaml
  112. 111 kubectl get pods
  113. 112 kubectl describe pod frontend
  114. 113 kubectl delete pod frontend
  115. 114 kubectl run busy --image=busybox
  116. 115 kubectl get pods
  117. 116 kubectl describe pod busy | less
  118. 117 kubectl logs busy
  119. 118 history
  120. 119 kubectl get pods -o wide
  121. 120 history
  122. 121 sudo poweroff
  123. 122 cd kube3weeks/
  124. 123 ./countdown 15
  125. 124 ls
  126. 125 cd kube3weeks/
  127. 126 ./countdown 13
  128. 127 kubectl get all
  129. 128 source <(kubectl completion bash)
  130. 129 kubectl get deploy
  131. 130 kubectl delete deploy myfirstapp
  132. 131 kubectl create deploy mynginx --image=nginx --replicas=3
  133. 132 kubectl get all
  134. 133 kubectl delete pod mynginx-56766fcf49-88vjj
  135. 134 kubectl get all
  136. 135 kubectl scale deploy mynginx --replicas=4
  137. 136 kubectl get all
  138. 137 kubectl scale deploy mynginx --replicas=0
  139. 138 history
  140. 139 kubectl get all
  141. 140 kubectl edit deploy mynginx
  142. 141 kubectl create deploy oldnginx --image=nginx:1.14 --replicas=3
  143. 142 kubectl get all --selector app=oldnginx
  144. 143 kubectl set image deploy oldnginx nginx=nginx:latest
  145. 144 kubectl get all --selector app=oldnginx
  146. 145 kubectl rollout status
  147. 146 kubectl rollout status deployment oldnginx
  148. 147 kubectl rollout history deployment oldnginx
  149. 148 kubectl get all --selector app=oldnginx -o wide
  150. 149 kubectl edit deployments.apps oldnginx
  151. 150 kubectl get deploy oldnginx -o yaml
  152. 151 kubectl create deploy lnginx --image=nginx --replicas=3
  153. 152 kubectl get all --show-labels
  154. 153 kubectl get all --selector app=lnginx
  155. 154 kubectl label pod lnginx-54d4579875-2jwjt app-
  156. 155 kubectl get all
  157. 156 kubectl delete pod lnginx-54d4579875-2jwjt
  158. 157 kubectl get all
  159. 158 history
  160. 159 kubectl get deploy
  161. 160 kubectl delete deploy lnginx mynginx oldnginx
  162. 161 kubectl create deploy daemondemo --image=nginx --dry-run=client -o yaml > daemondemo.yaml
  163. 162 vim daemondemo.yaml
  164. 163 kubectl apply -f daemondemo.yaml
  165. 164 kubectl get daemonset
  166. 165 kubectl get all --selector app=daemondemo
  167. 166 kubectl get all --selector app=daemondemo -o wide
  168. 167 history
  169. 168 vim daemondemo.yaml
  170. 169 kubectl edit nodes control
  171. 170 kubectl create deploy nginxsvc --image=nginx
  172. 171 kubectl scale deploy nginxsvc --replicas 3
  173. 172 kubectl get all --selector app=nginxsvc
  174. 173 kubectl expose deploy nginxsvc --port=80
  175. 174 kubectl get all --selector app=nginxsvc
  176. 175 kubectl describe svc nginxsvc
  177. 176 kubectl get svc
  178. 177 kubectl get enpoints
  179. 178 kubectl get endpoints
  180. 179 curl 10.109.60.162
  181. 180 kubectl edit svc nginxsvc
  182. 181 kubectl get svc
  183. 182 ip a
  184. 183 history
  185. 184 kubectl edit svc nginxsvc
  186. 185 kubectl get svc
  187. 186 kubectl edit svc nginxsvc
  188. 187 kubectl get svc
  189. 188 kubectl edit svc nginxsvc
  190. 189 kubectl get svc
  191. 190 kubectl edit svc nginxsvc
  192. 191 kubectl get svc
  193. 192 kubectl edit svc nginxsvc
  194. 193 cat daemondemo.yaml
  195. 194 kubectl get svc
  196. 195 kubectl run testpod --image=busybox -- sh
  197. 196 kubectl exec -it testpod -- sh
  198. 197 kubectl delete pod testpod
  199. 198 kubectl run -it testpod --image=busybox -- sh
  200. 199 kubectl run -it testpod --image=sandervanvugt/gittools -- sh
  201. 200 kubectl run -it testpod2 --image=sandervanvugt/gittools -- sh
  202. 201 reset
  203. 202 kubectl get pods
  204. 203 kubectl delete pod testpod
  205. 204 kubectl delete pod testpod2
  206. 205 kubectl run -it testpod --image=busybox -- sh
  207. 206 kubectl get svc
  208. 207 kubectl get svc -A
  209. 208 history
  210. 209 ls
  211. 210 tar xvf helm-v3.11.2-linux-amd64.tar.gz
  212. 211 ls -l linux-amd64/helm
  213. 212 sudo cp linux-amd64/helm /usr/local/bin
  214. 213 helm version
  215. 214 helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace
  216. 215 kubectl get all -n ingress-nginx
  217. 216 kubectl get all --selector app=nginxsvc
  218. 217 kubectl create ingress nginxsvc --class=nginx --rule=nginxsvc.info/*=nginxsvc:80
  219. 218 kubectl port-forward -n ingress-nginx svc/ingress-nginx-controller 8080:80
  220. 219 bg
  221. 220 history
  222. 221 sudo vim /etc/hosts
  223. 222 curl nginxsvc.info:8080
  224. 223 history
  225. 224 kubectl get ing,svc,pods --selector app=nginxsvc
  226. 225 kubectl get ing,svc,pods
  227. 226 kubectl describe ing nginxsvc
  228. 227 history
  229. 228 helm version
  230. 229 kubectl explain pods.spec.volumes | less
  231. 230 cd kube3weeks/
  232. 231 ls
  233. 232 vim morevolumes.yaml
  234. 233 kubectl apply -f morevolumes.yaml
  235. 234 kubectl get pods
  236. 235 kubectl get pods -o wide
  237. 236 kubectl describe pod morevol2
  238. 237 kubectl exec -it morevol2 -c centos1 -- touch /centos1/testfile
  239. 238 kubectl exec -it morevol2 -c centos2 -- ls /centos2
  240. 239 history
  241. 240 vim pv.yaml
  242. 241 kubectl apply -f pv.yaml
  243. 242 kubectl get pv
  244. 243 vim pvc.yaml
  245. 244 kubectl apply -f pvc.yaml
  246. 245 kubectl get pvc,pv
  247. 246 kubectl describe pv
  248. 247 vim pv-pod.yaml
  249. 248 kubectl apply -f pv-pod.yaml
  250. 249 kubectl get pods
  251. 250 kubectl exec -it pv-pod -- touch /usr/share/nginx/html/hello.txt
  252. 251 kubectl get pods -o wide
  253. 253 ls
  254. 254 vim pv-pvc-pod.yaml
  255. 255 history
  256. 256 kubectl get pods -o wide
  257. 257 kubectl describe pod pv-pod
  258. 258 kubectl get pvc,pv
  259. 259 kubectl describe pv pv-volume
  260. 260 kubectl get pods -o wide
  261. 261 ssh 192.168.29.41
  262. 262 sudo apt install nfs-server -y
  263. 263 sudo mkdir /nfsexport
  264. 264 sudo vim /etc/exports
  265. 265 sudo systemctl restart nfs-server
  266. 266 showmount -e localhost
  267. 267 sudo vim /etc/hosts
  268. 268 helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/
  269. 269 helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner --set nfs.server=192.168.29.40 --set nfs.path=/nfsexport
  270. 270 kubectl get all
  271. 271 kubectl get pods -n kube-system
  272. 272 kubectl get pv
  273. 273 vim nfs-provisioner-pvc-test.yaml
  274. 274 kubectl get storageclass
  275. 275 kubectl describe storageclass nfs-client
  276. 276 kubectl edit storageclasses.storage.k8s.io nfs-client
  277. 277 kubectl apply -f nfs-provisioner-pvc-test.yaml
  278. 278 kubectl get pvc,pv
  279. 279 vim nfs-provisioner-pvc-test.yaml
  280. 280 kubectl apply -f nfs-provisioner-pvc-test.yaml
  281. 281 kubectl get pvc,pv
  282. 282 ls /nfsexport/
  283. 283 history
  284. 284 ./countdown 1
  285. 285 cat /etc/exports
  286. 286 history
  287. 287 tail -n /etc/exports
  288. 288 tail -1 /etc/exports
  289. 289 cat /etc/hosts
  290. 290 helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
  291. 291 helm install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard
  292. 292 kubectl get all
  293. 293 kubectl edit deploy kubernetes-dashboard
  294. 294 kubectl get all
  295. 295 kubectl get pods
  296. 296 kubectl get svc
  297. 297 kubectl edit svc kubernetes-dashboard
  298. 298 kubectl get svc
  299. 299 echo RBAC PROBLEM ON DASHBOARDkubectl get svc!
  300. 300 history
  301. 301 sudo poweroff
  302. 302 kubectl get all
  303. 303 history
  304. 304 cd kube3weeks/
  305. 305 vim varsfile
  306. 306 kubectl create cm mydbvars --from-env-file=varsfile
  307. 307 source <(kubectl completion bash)
  308. 308 kubectl describe cm mydbvars
  309. 309 kubectl get cm mydbvars -o yaml
  310. 310 kubectl create deploy mydb --image=mariadb --replicas=3
  311. 311 kubectl get all --selector app=mydb
  312. 312 kubectl set env deploy mydb --from=configmap/mydbvars
  313. 313 kubectl get all --selector app=mydb
  314. 314 kubectl get deployments.apps mydb -o yaml | less
  315. 315 history
  316. 316 echo hello > index.html
  317. 317 kubectl create cm myindex --from-file=index.html
  318. 318 kubectl describe cm myindex
  319. 319 kubectl create deploy myweb --image=nginx
  320. 320 kubectl edit deploy myweb
  321. 321 kubectl exec -it myweb-589445db67-wj5tp -- cat /usr/share/nginx/html/index.html
  322. 322 kubectl get pods -o wide
  323. 323 history
  324. 324 kubectl create secret generic -h | less
  325. 325 kubectl create secret generic dbsecret --from-literal=MYPASSWORD=password
  326. 326 kubectl describe secrets dbsecret
  327. 327 kubectl get secrets dbsecret -o yaml
  328. 328 echo cGFzc3dvcmQ= | base64 -d
  329. 329 kubectl set env deploy mydb --from=secret/dbsecret
  330. 330 kubectl get deploy mydb -o yaml | less
  331. 331 kubectl exec -it mydb-568db98b4d-zm6nb -- env
  332. 332 history
  333. 333 kubectl create secret docker-registry mycreds --docker-username=unclebob --docker-password=secretpw [email protected] --docker-server=myregistry:5000
  334. 334 kubectl explain pod.spec.containers | less
  335. 335 kubectl explain pod.spec | less
  336. 336 history
  337. 337 kubectl edit deploy kubernetes-dashboard
  338. 338 kubectl edit svc kubernetes-dashboard
  339. 339 ./countdown 13
  340. 340 kubectl get ns
  341. 341 kubectl get pods
  342. 342 kubectl edit deployments.apps kubernetes-dashboard
  343. 343 kubectl get sa
  344. 344 history
  345. 345 kubectl get sa kubernetes-dashboard -o yaml
  346. 346 kubectl api-resources | less
  347. 347 kubectl get clusterrolebindings.rbac.authorization.k8s.io
  348. 348 kubectl get clusterrolebindings.rbac.authorization.k8s.io | wc
  349. 349 kubectl get clusterrolebindings.rbac.authorization.k8s.io | grep dash
  350. 350 kubectl describe clusterrolebindings.rbac.authorization.k8s.io kubernetes-dashboard-metrics
  351. 351 kubectl describe clusterrole kubernetes-dashboard-metrics
  352. 352 history
  353. 353 kubectl get clusterroles | less
  354. 354 kubectl describe clusterrole cluster-admin
  355. 355 kubectl describe clusterrole admin
  356. 356 history
  357. 357 kubectl create clusterrolebinding -h | less
  358. 358 kubectl create clusterrolebinding kubernetes-dashboard-cluster-admin --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard
  359. 359 kubectl create clusterrolebinding kubernetes-dashboard-cluster-admin --clusterrole=cluster-admin --serviceaccount=default:kubernetes-dashboard
  360. 360 kubectl describe clusterrolebindings.rbac.authorization.k8s.io kubernetes-dashboard-cluster-admin
  361. 361 kubectl get pods
  362. 362 kubectl delete pod kubernetes-dashboard-55f488db5d-vmzxp
  363. 363 kubectl get pods
  364. 364 history
  365. 365 kubectl get service
  366. 366 vim statefulset.yaml
  367. 367 kubectl get storageclass
  368. 368 kubectl get pvc,pv
  369. 369 vim statefulset.yaml
  370. 370 kubectl apply -f statefulset.yaml
  371. 371 kubectl get statefulsets.apps,pv,pvc,svc
  372. 372 kubectl get pods
  373. 373 vim statefulset.yaml
  374. 374 helm install bitnami/mysql --generate-name
  375. 375 helm repo add bitnami/bitnami
  376. 376 helm repo add bitnami https://charts.bitnami.com/bitnami
  377. 377 helm install bitnami/mysql --generate-name
  378. 378 kubectl get all | less
  379. 379 kubectl describe pods mysql-1679666722-0
  380. 380 kubectl get pvc
  381. 381 kubectl describe pvc data-mysql-1679666722-0
  382. 382 kubectl get pvc www-web-0 | less
  383. 383 kubectl get pvc www-web-0 -o yaml | less
  384. 384 kubectl edit pvc data-mysql-1679666722-0
  385. 385 kubectl get pvc
  386. 386 kubectl get pods
  387. 387 ./countdown 13
  388. 388 vim statefulset.yaml
  389. 389 kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/lastest/download/components.yaml
  390. 390 minikube addons list
  391. 391 kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
  392. 392 kubectl get pods -n kube-system
  393. 393 kubectl edit deployments.apps -n kube-system metrics-server
  394. 394 kubectl get pods -n kube-system
  395. 395 kubectl logs -n kube-system metrics-server-6c74f597cf-c5dgd
  396. 396 kubectl get pods -n kube-system
  397. 397 kubectl top pods
  398. 398 kubectl top nodes
  399. 399 history
  400. 400 ls
  401. 401 cd ..
  402. 402 cd kube3weeks/
  403. 403 git pull
  404. 404 kubectl edit deployments.apps -n kube-system metrics-server
  405. 405 cd autoscaling/
  406. 406 ls
  407. 407 vim Dockerfile
  408. 408 vim index.php
  409. 409 sudo apt install docker.io
  410. 410 sudo docker build -t php-apache .
  411. 411 crictl ps
  412. 412 sudo crictl ps
  413. 413 vim hpa.yaml
  414. 414 kubectl apply -f hpa.yaml
  415. 415 kubectl get deploy hpa
  416. 416 kubectl get deploy php-apache
  417. 417 kubectl autoscale -h | less
  418. 418 kubectl get deploy php-apache
  419. 419 kubectl top pods
  420. 420 kubectl autoscale deployment php-apache --cpu-percent=1 --min=3 --max=10
  421. 421 kubectl get hpa
  422. 422 kubectl top pods
  423. 423 kubectl run -it load-generator --rm --image=busybox --restart=Never -- /bin/sh -c "while sleep 0.01; do wget -q -O - http://php-apache; done"
  424. 424 kubectl get hpa
  425. 425 vim hpa.yaml
  426. 426 history
  427. 427 kubectl get hpa
  428. 428 kubectl top pods
  429. 429 kubectl get hpa
  430. 430 kubectl get deployments.apps php-apache
  431. 431 kubectl api-resources | less
  432. 432 cd ..
  433. 433 vim crd-object.yaml
  434. 434 kubectl apply -f crd-object.yaml
  435. 435 kubectl api-resources | grep back
  436. 436 cat crd-backup.yaml
  437. 437 kubectl create -f crd-backup.yaml
  438. 438 kubectl get backups.stable.example.com
  439. 439 kubectl get backups.stable.example.com -o yaml
  440. 440 ./countdown 13
  441. 441 kubectl get backups.stable.example.com -o yaml
  442. 442 cd ..
  443. 443 git clone https://github.com/sandervanvugt/kcna
  444. 444 cd kcna/
  445. 445 ls
  446. 446 cd kubernetes-prometheus/
  447. 447 ls
  448. 448 kubectl apply -f .
  449. 449 kubectl create ns monitoring
  450. 450 kubectl apply -f .
  451. 451 kubectl get all -n monitoring
  452. 452 kubectl delete -f .
  453. 453 cd
  454. 454 git clone https://github.com/prometeheus-operator/kube-prometheus
  455. 455 git clone https://github.com/prometheus-operator/kube-prometheus
  456. 456 cd kube
  457. 457 cd kube-prometheus/
  458. 458 kubectl create -f manifests/setup/
  459. 459 kubectl create -f manifests/
  460. 460 kubectl get pods -n monitoring
  461. 461 kubectl top pods
  462. 462 kubectl top pods -n monitor
  463. 463 kubectl top pods -n monitoring
  464. 464 kubectl top nodes
  465. 465 kubectl get svc -n monitoring
  466. 466 kubectl -n monitoring port-forward svc/prometheus-k8s 9090
  467. 467 bg
  468. 468 kubectl -n monitoring port-forward svc/grafana 3000 &
  469. 469 kubectl get pods -n monitoring
  470. 470 kubectl edit -n monitoring prometheus-k8s
  471. 471 kubectl edit -n monitoring svc prometheus-k8s
  472. 472 kubectl get svc -n monitoring
  473. 473 cd
  474. 474 history
Add Comment
Please, Sign In to add comment