sandervanvugt

kube3weeks march 23 all days

Mar 24th, 2023
41
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. 252 ssh student@192.168.29.41
  254. 253 ls
  255. 254 vim pv-pvc-pod.yaml
  256. 255 history
  257. 256 kubectl get pods -o wide
  258. 257 kubectl describe pod pv-pod
  259. 258 kubectl get pvc,pv
  260. 259 kubectl describe pv pv-volume
  261. 260 kubectl get pods -o wide
  262. 261 ssh 192.168.29.41
  263. 262 sudo apt install nfs-server -y
  264. 263 sudo mkdir /nfsexport
  265. 264 sudo vim /etc/exports
  266. 265 sudo systemctl restart nfs-server
  267. 266 showmount -e localhost
  268. 267 sudo vim /etc/hosts
  269. 268 helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/
  270. 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
  271. 270 kubectl get all
  272. 271 kubectl get pods -n kube-system
  273. 272 kubectl get pv
  274. 273 vim nfs-provisioner-pvc-test.yaml
  275. 274 kubectl get storageclass
  276. 275 kubectl describe storageclass nfs-client
  277. 276 kubectl edit storageclasses.storage.k8s.io nfs-client
  278. 277 kubectl apply -f nfs-provisioner-pvc-test.yaml
  279. 278 kubectl get pvc,pv
  280. 279 vim nfs-provisioner-pvc-test.yaml
  281. 280 kubectl apply -f nfs-provisioner-pvc-test.yaml
  282. 281 kubectl get pvc,pv
  283. 282 ls /nfsexport/
  284. 283 history
  285. 284 ./countdown 1
  286. 285 cat /etc/exports
  287. 286 history
  288. 287 tail -n /etc/exports
  289. 288 tail -1 /etc/exports
  290. 289 cat /etc/hosts
  291. 290 helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
  292. 291 helm install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard
  293. 292 kubectl get all
  294. 293 kubectl edit deploy kubernetes-dashboard
  295. 294 kubectl get all
  296. 295 kubectl get pods
  297. 296 kubectl get svc
  298. 297 kubectl edit svc kubernetes-dashboard
  299. 298 kubectl get svc
  300. 299 echo RBAC PROBLEM ON DASHBOARDkubectl get svc!
  301. 300 history
  302. 301 sudo poweroff
  303. 302 kubectl get all
  304. 303 history
  305. 304 cd kube3weeks/
  306. 305 vim varsfile
  307. 306 kubectl create cm mydbvars --from-env-file=varsfile
  308. 307 source <(kubectl completion bash)
  309. 308 kubectl describe cm mydbvars
  310. 309 kubectl get cm mydbvars -o yaml
  311. 310 kubectl create deploy mydb --image=mariadb --replicas=3
  312. 311 kubectl get all --selector app=mydb
  313. 312 kubectl set env deploy mydb --from=configmap/mydbvars
  314. 313 kubectl get all --selector app=mydb
  315. 314 kubectl get deployments.apps mydb -o yaml | less
  316. 315 history
  317. 316 echo hello > index.html
  318. 317 kubectl create cm myindex --from-file=index.html
  319. 318 kubectl describe cm myindex
  320. 319 kubectl create deploy myweb --image=nginx
  321. 320 kubectl edit deploy myweb
  322. 321 kubectl exec -it myweb-589445db67-wj5tp -- cat /usr/share/nginx/html/index.html
  323. 322 kubectl get pods -o wide
  324. 323 history
  325. 324 kubectl create secret generic -h | less
  326. 325 kubectl create secret generic dbsecret --from-literal=MYPASSWORD=password
  327. 326 kubectl describe secrets dbsecret
  328. 327 kubectl get secrets dbsecret -o yaml
  329. 328 echo cGFzc3dvcmQ= | base64 -d
  330. 329 kubectl set env deploy mydb --from=secret/dbsecret
  331. 330 kubectl get deploy mydb -o yaml | less
  332. 331 kubectl exec -it mydb-568db98b4d-zm6nb -- env
  333. 332 history
  334. 333 kubectl create secret docker-registry mycreds --docker-username=unclebob --docker-password=secretpw --docker-email=uncle@bob.org --docker-server=myregistry:5000
  335. 334 kubectl explain pod.spec.containers | less
  336. 335 kubectl explain pod.spec | less
  337. 336 history
  338. 337 kubectl edit deploy kubernetes-dashboard
  339. 338 kubectl edit svc kubernetes-dashboard
  340. 339 ./countdown 13
  341. 340 kubectl get ns
  342. 341 kubectl get pods
  343. 342 kubectl edit deployments.apps kubernetes-dashboard
  344. 343 kubectl get sa
  345. 344 history
  346. 345 kubectl get sa kubernetes-dashboard -o yaml
  347. 346 kubectl api-resources | less
  348. 347 kubectl get clusterrolebindings.rbac.authorization.k8s.io
  349. 348 kubectl get clusterrolebindings.rbac.authorization.k8s.io | wc
  350. 349 kubectl get clusterrolebindings.rbac.authorization.k8s.io | grep dash
  351. 350 kubectl describe clusterrolebindings.rbac.authorization.k8s.io kubernetes-dashboard-metrics
  352. 351 kubectl describe clusterrole kubernetes-dashboard-metrics
  353. 352 history
  354. 353 kubectl get clusterroles | less
  355. 354 kubectl describe clusterrole cluster-admin
  356. 355 kubectl describe clusterrole admin
  357. 356 history
  358. 357 kubectl create clusterrolebinding -h | less
  359. 358 kubectl create clusterrolebinding kubernetes-dashboard-cluster-admin --clusterrole=cluster-admin --serviceaccount=kubernetes-dashboard
  360. 359 kubectl create clusterrolebinding kubernetes-dashboard-cluster-admin --clusterrole=cluster-admin --serviceaccount=default:kubernetes-dashboard
  361. 360 kubectl describe clusterrolebindings.rbac.authorization.k8s.io kubernetes-dashboard-cluster-admin
  362. 361 kubectl get pods
  363. 362 kubectl delete pod kubernetes-dashboard-55f488db5d-vmzxp
  364. 363 kubectl get pods
  365. 364 history
  366. 365 kubectl get service
  367. 366 vim statefulset.yaml
  368. 367 kubectl get storageclass
  369. 368 kubectl get pvc,pv
  370. 369 vim statefulset.yaml
  371. 370 kubectl apply -f statefulset.yaml
  372. 371 kubectl get statefulsets.apps,pv,pvc,svc
  373. 372 kubectl get pods
  374. 373 vim statefulset.yaml
  375. 374 helm install bitnami/mysql --generate-name
  376. 375 helm repo add bitnami/bitnami
  377. 376 helm repo add bitnami https://charts.bitnami.com/bitnami
  378. 377 helm install bitnami/mysql --generate-name
  379. 378 kubectl get all | less
  380. 379 kubectl describe pods mysql-1679666722-0
  381. 380 kubectl get pvc
  382. 381 kubectl describe pvc data-mysql-1679666722-0
  383. 382 kubectl get pvc www-web-0 | less
  384. 383 kubectl get pvc www-web-0 -o yaml | less
  385. 384 kubectl edit pvc data-mysql-1679666722-0
  386. 385 kubectl get pvc
  387. 386 kubectl get pods
  388. 387 ./countdown 13
  389. 388 vim statefulset.yaml
  390. 389 kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/lastest/download/components.yaml
  391. 390 minikube addons list
  392. 391 kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
  393. 392 kubectl get pods -n kube-system
  394. 393 kubectl edit deployments.apps -n kube-system metrics-server
  395. 394 kubectl get pods -n kube-system
  396. 395 kubectl logs -n kube-system metrics-server-6c74f597cf-c5dgd
  397. 396 kubectl get pods -n kube-system
  398. 397 kubectl top pods
  399. 398 kubectl top nodes
  400. 399 history
  401. 400 ls
  402. 401 cd ..
  403. 402 cd kube3weeks/
  404. 403 git pull
  405. 404 kubectl edit deployments.apps -n kube-system metrics-server
  406. 405 cd autoscaling/
  407. 406 ls
  408. 407 vim Dockerfile
  409. 408 vim index.php
  410. 409 sudo apt install docker.io
  411. 410 sudo docker build -t php-apache .
  412. 411 crictl ps
  413. 412 sudo crictl ps
  414. 413 vim hpa.yaml
  415. 414 kubectl apply -f hpa.yaml
  416. 415 kubectl get deploy hpa
  417. 416 kubectl get deploy php-apache
  418. 417 kubectl autoscale -h | less
  419. 418 kubectl get deploy php-apache
  420. 419 kubectl top pods
  421. 420 kubectl autoscale deployment php-apache --cpu-percent=1 --min=3 --max=10
  422. 421 kubectl get hpa
  423. 422 kubectl top pods
  424. 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"
  425. 424 kubectl get hpa
  426. 425 vim hpa.yaml
  427. 426 history
  428. 427 kubectl get hpa
  429. 428 kubectl top pods
  430. 429 kubectl get hpa
  431. 430 kubectl get deployments.apps php-apache
  432. 431 kubectl api-resources | less
  433. 432 cd ..
  434. 433 vim crd-object.yaml
  435. 434 kubectl apply -f crd-object.yaml
  436. 435 kubectl api-resources | grep back
  437. 436 cat crd-backup.yaml
  438. 437 kubectl create -f crd-backup.yaml
  439. 438 kubectl get backups.stable.example.com
  440. 439 kubectl get backups.stable.example.com -o yaml
  441. 440 ./countdown 13
  442. 441 kubectl get backups.stable.example.com -o yaml
  443. 442 cd ..
  444. 443 git clone https://github.com/sandervanvugt/kcna
  445. 444 cd kcna/
  446. 445 ls
  447. 446 cd kubernetes-prometheus/
  448. 447 ls
  449. 448 kubectl apply -f .
  450. 449 kubectl create ns monitoring
  451. 450 kubectl apply -f .
  452. 451 kubectl get all -n monitoring
  453. 452 kubectl delete -f .
  454. 453 cd
  455. 454 git clone https://github.com/prometeheus-operator/kube-prometheus
  456. 455 git clone https://github.com/prometheus-operator/kube-prometheus
  457. 456 cd kube
  458. 457 cd kube-prometheus/
  459. 458 kubectl create -f manifests/setup/
  460. 459 kubectl create -f manifests/
  461. 460 kubectl get pods -n monitoring
  462. 461 kubectl top pods
  463. 462 kubectl top pods -n monitor
  464. 463 kubectl top pods -n monitoring
  465. 464 kubectl top nodes
  466. 465 kubectl get svc -n monitoring
  467. 466 kubectl -n monitoring port-forward svc/prometheus-k8s 9090
  468. 467 bg
  469. 468 kubectl -n monitoring port-forward svc/grafana 3000 &
  470. 469 kubectl get pods -n monitoring
  471. 470 kubectl edit -n monitoring prometheus-k8s
  472. 471 kubectl edit -n monitoring svc prometheus-k8s
  473. 472 kubectl get svc -n monitoring
  474. 473 cd
  475. 474 history
Add Comment
Please, Sign In to add comment