Advertisement
sandervanvugt

kube3weeks all days nov22

Nov 18th, 2022
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.47 KB | None | 0 0
  1. #### after creating user Anna
  2. anna@k3wcontrol:~$ history
  3. 1 sudo ls /root
  4. 2 openssl genrsa -out anna.key 2048
  5. 3 openssl req -new -key anna.key -out anna.csr -subj "/CN=anna/O=k8s"
  6. 4 ls
  7. 5 sudo openssl x509 -req -in anna.csr -CA /etc/kubernetes/pki/ca.crt -CAkey /etc/kubernetes/pki/ca.key -CAcreateserial -out anna.crt -days 1800
  8. 6 kubectl config set-context anna-context --cluster=kubernetes --namespace=staff --user=anna
  9. 7 kubectl config view
  10. 8 kubectl config user-context anna-context
  11. 9 kubectl config use-context anna-context
  12. 10 kubectl get pods
  13. 11 kubectl config get-contexts
  14. 12 exit
  15. 13 kubectl config set-credentials anna --client-certificate=anna.crt --client-key=anna.key
  16. 14 kubectl get all
  17. 15 cat .kube/config
  18. 16 kubectl config get-contexts
  19. 17 exit
  20. 18 kubectl config view
  21. 19 kubectl create deploy nginx --image=nginx
  22. 20 vim .kube/config
  23. 21 kubectl create deploy nginx --image=nginx
  24. 22 kubectl create deploy nginx --image=nginx -n default
  25. 23 history
  26. anna@k3wcontrol:~$ cat .kube/config
  27. apiVersion: v1
  28. clusters:
  29. - cluster:
  30. certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeU1URXdOREV6TXpZeU0xb1hEVE15TVRFd01URXpNell5TTFvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTUNJCnBpODJzckExNkxoRG9TREZLam45TUZHS3dDQkRDSWFjK2pTT094cjA2dGFMNkdVcDNkUGlwUlp2NVZVbVNyWmIKditsRWxvYmE0UlU4RFRDaWJQODlmQnR1SGxHaWwrZGNEK203b1pOMzcrNXhqTTdVaWd2eGlZajE5T1JkQXk3UApWajc3Z29XOVFkT25XOHZuY01iM2h4M1IwQUtLdy9lSVhhSFBobk1heHNFcVk5eEtINTdOQzZCV3k4WTJrOUVzCnJWdCs5SzI5RC9PdTFDTXhWT2lRSnhWaWpUSEFWMkNMYTZpOW1uTS9WMjljWFVNcFN2QVpiVXVUVVdpcXBPMUYKVlFoOHdSTGVZcXhOTU1sUlAyVkRLdU5wVDA1Wk5sc2hoa3pDaDl4WU5RUHYzNVNXOHhOVXpZajlxNk5WbndVNwoyS0J6MVgxcDdJazkzK3ZUamRNQ0F3RUFBYU5aTUZjd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZPSzVBSnJMTHg3OEgvaTJMK1Bob0tqQXhJMzFNQlVHQTFVZEVRUU8KTUF5Q0NtdDFZbVZ5Ym1WMFpYTXdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBQzVsWlNDbXBFRHVhVjhoVldVdApnZWNkTUkzZ0x3ZlRPclN2VE5MNS9jc0ZKUjhTeENrWm5JbnRXL0VxUDBXeS9zUnFKc3BPS25ONW5xTjRxQ0tlCmJSdUdBdXZsSzcvdzdUUVNaS3dYbWQvWnpmbXY0cTQ3Wm9JSmRvU3BtdVpFSHJTZmhjSXJLRGVPdXIyMjlFYW8KUlFuclpDRTJIdFhCQW41OTI1Mlp3ZnA4NkZGVlRLaVUyTHN2bzNOQ01MQjZQckYxZ2tiVHU2Z1B5eGhobDVvNQo3bm9URjh4MDdVK0h0UjBnS1pscnpZelQ2cElVcGg5VTdRSFNaMHVDSS9qVmJSMmh4YWR1UThHcnpHNU1ZV3dRCkhQdURYN216UDFqektCWjBSOEEyNEdsSlFOcHFYbnVpVWFmSWViQ3Z3SGZTMm14OWFQTGJnby84SW8xL0QxM3cKdFNjPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
  31. server: https://192.168.29.110:6443
  32. name: kubernetes
  33. contexts:
  34. - context:
  35. cluster: kubernetes
  36. namespace: staff
  37. user: anna
  38. name: anna-context
  39. current-context: anna-context
  40. kind: Config
  41. preferences: {}
  42. users:
  43. - name: anna
  44. user:
  45. client-certificate: /home/anna/anna.crt
  46. client-key: /home/anna/anna.key
  47. student@k3wcontrol:~$ history
  48. 1 ssh 192.168.29.112
  49. 2 exit
  50. 3 sudo apt install git vim -y
  51. 4 git clone https://github.com/sandervanvugt/cka
  52. 5 cd cka
  53. 6 ls
  54. 7 sudo ./setup-container.sh
  55. 8 sudo ./setup-kubetools.sh
  56. 9 sudo kubeadm init
  57. 10 history
  58. 11 mkdir -p $HOME/.kube
  59. 12 kubectl get all
  60. 13 kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
  61. 14 kubectl get nodes
  62. 15 history
  63. 16 vim cluster-install-instructions.txt
  64. 17 kubectl get all
  65. 18 source <(kubectl completion bash)
  66. 19 kubectl create deployment myfirstapp --image=nginx --replicas=3
  67. 20 kubectl get all
  68. 21 kubectl delete pod myfirstapp-77c9bf8446-dl7fw
  69. 22 kubectl get all
  70. 23 kubectl run lonelypod --image=nginx
  71. 24 kubectl get all
  72. 25 kubectl delete pod lonelypod
  73. 26 kubectl get all
  74. 27 kubectl api-resources | less
  75. 28 history
  76. 29 kubectl get pods
  77. 30 kubectl get pods myfirstapp-77c9bf8446-clrsb -o yaml | less
  78. 31 kubectl explain pod.spec | less
  79. 32 kubectl explain pod.spec.containers | less
  80. 33 kubectl explain pod.spec.containers.tty
  81. 34 kubectl run mynginx --image=nginx --dry-run=client -o yaml
  82. 35 kubectl run mynginx --image=nginx --dry-run=client -o yaml > mynginx.yaml
  83. 36 vim mynginx.yaml
  84. 37 kubectl apply -f mynginx.yaml
  85. 38 kubectl get pods mynginx -o yaml | less
  86. 39 kubectl delete -f mynginx.yaml
  87. 40 kubectl create -f mynginx.yaml
  88. 41 kubectl get pods mynginx -o yaml | less
  89. 42 cd ..
  90. 43 git clone https://github.com/kube3weeks
  91. 44 git clone https://github.com/sandervanvugt/kube3weeks
  92. 45 cd kube3weeks/
  93. 46 vim multicontainer.yaml
  94. 47 kubectl apply -f multicontainer.yaml
  95. 48 kubectl get pods
  96. 49 kubectl describe pod multicontainer | less
  97. 50 ./countdown 12
  98. 51 vim logpod.yaml
  99. 52 kubectl apply -f logpod.yaml
  100. 53 kubectl get pods
  101. 54 kubectl logs counter
  102. 55 kubectl logs counter -c count-log-1
  103. 56 kubectl logs counter -c count-log-2
  104. 57 history
  105. 58 vim initcontainer.yaml
  106. 59 kubectl apply -f initcontainer.yaml ; kubectl get pods
  107. 60 kubectl get pods
  108. 61 cp initcontainer.yaml initagain.yaml
  109. 62 vim initagain.yaml
  110. 63 kubectl apply -f initagain.yaml
  111. 64 vim initagain.yaml
  112. 65 kubectl apply -f initagain.yaml
  113. 66 kubectl get pods
  114. 67 kubectl get all
  115. 68 kubectl get pods
  116. 69 kubectl config set-context --current --namespace=kube-system
  117. 70 kubectl get pods
  118. 71 kubectl config set-context --current --namespace=default
  119. 72 kubectl config view
  120. 73 kubectl get pods -n kube-system
  121. 74 kubectl create ns secret
  122. 75 kubectl run secretapp --image=nginx -n secret
  123. 76 kubectl get pods
  124. 77 kubectl get pods -A
  125. 78 kubectl get pods -n secret
  126. 79 history
  127. 80 kubectl create deploy mydb --image=mariadb
  128. 81 kubectl get all --selector app=mariadb
  129. 82 kubectl get all --selector app=mydb
  130. 83 kubectl describe pod mydb-c8bddc94c-m22r5 | less
  131. 84 kubectl logs mydb-c8bddc94c-m22r5
  132. 85 kubectl run busybox --image=busybox
  133. 86 crictl ps
  134. 87 kubectl get pods
  135. 88 kubectl describe pod busybox
  136. 89 kubectl get pods
  137. 90 kubectl delete pods busybox
  138. 91 kubectl run busybox --image=busybox -- sleep 3600
  139. 92 kubectl get pods
  140. 93 history
  141. 94 sudo poweroff
  142. 95 ip a
  143. 96 history
  144. 97 kubectl get deploy
  145. 98 kubectl delete deploy myfirstapp
  146. 99 kubectl create deploy mynginx --image=nginx --replicas=3
  147. 100 kubectl get all --selector app=mynginx
  148. 101 source <(kubectl completion bash)
  149. 102 kubectl delete pod mynginx-ff886775c-cvsq4
  150. 103 kubectl get all --selector app=mynginx
  151. 104 kubectl scale deployment mynginx --replicas 4
  152. 105 kubectl get all --selector app=mynginx
  153. 106 kubectl scale deployment mynginx --replicas 0
  154. 107 kubectl get all --selector app=mynginx
  155. 108 kubectl edit deploy mynginx
  156. 109 kubectl set image deploy mynginx nginx=nginx:1.14; kubectl get all --selector app=mynginx
  157. 110 kubectl scale deployment mynginx --replicas 3
  158. 111 kubectl set image deploy mynginx nginx=nginx:1.17; kubectl get all --selector app=mynginx
  159. 112 kubectl get all --selector app=mynginx
  160. 113 kubectl create deploy oldnginx --image=nginx:1.14 --replicas=3
  161. 114 kubectl get all --selector app=oldnginx
  162. 115 kubectl set image -h | less
  163. 116 kubectl set image deploy oldnginx nginx=nginx:1.17; kubectl get all --selector app=oldnginx
  164. 117 kubectl get all --selector app=oldnginx
  165. 118 kubectl rollout history
  166. 119 kubectl rollout history deploy oldnginx
  167. 120 kubectl get deployments.apps oldnginx -o yaml | less
  168. 121 kubectl get all --show-labels
  169. 122 kubectl label pod oldnginx-687b4bdcbf-4kc4n app-
  170. 123 kubectl get all --show-labels
  171. 124 kubectl create deploy lnginx --image=nginx --replicas=3
  172. 125 kubectl get all --show-labels
  173. 126 kubectl delete deployments.apps mynginx
  174. 127 kubectl delete deployments.apps oldnginx
  175. 128 kubectl get all --show-labels
  176. 129 kubectl get all --selector app=lnginx
  177. 130 kubectl label pod lnginx-6d99fdb9bc-g69c5 app-
  178. 131 kubectl get pods --show-labels | grep lng
  179. 132 kubectl get deployments.apps
  180. 133 kubectl delete deploy lnginx
  181. 134 kubectl delete deploy mydb
  182. 135 kubectl create deploy nginxsvc --image=nginx
  183. 136 kubectl scale deployment nginxsvc --replicas=3
  184. 137 kubectl get all --selector app=nginxsvc
  185. 138 kubectl get pods -o wide
  186. 139 kubectl expose deploy nginxsvc --port=80
  187. 140 kubectl get all --selector app=nginxsvc
  188. 141 curl 10.104.130.232
  189. 142 kubectl get svc
  190. 143 kubectl edit svc nginxsvc
  191. 144 kubectl get svc
  192. 145 ip a
  193. 146 kubectl get svc
  194. 147 kubectl get svc nginxsvc -o yaml
  195. 148 history
  196. 149 kubectl get all --selector app=nginxsvc
  197. 150 kubectl describe svc nginxsvc
  198. 151 kubectl get endpoints
  199. 152 kubectl scale deployment nginxsvc --replicas=9
  200. 153 kubectl get all --selector app=nginxsvc
  201. 154 kubectl get endpoints
  202. 155 kubectl run -h | less
  203. 156 kubectl run --image=busybox -- sh
  204. 157 kubectl run -h | less
  205. 158 kubectl run testpod --image=busybox -- sh
  206. 159 kubectl get pods
  207. 160 kubectl delete testpod
  208. 161 kubectl delete pod testpod
  209. 162 kubectl delete pod sh
  210. 163 kubectl run sleepybox --image=busybox -- sleep 3600
  211. 164 kubectl get pods
  212. 165 kubectl exec -it sleepybox -- sh
  213. 166 kubectl get pods -n kube-system
  214. 167 cd kube3weeks/
  215. 168 ls
  216. 169 vim morevolumes.yaml
  217. 170 kubectl apply -f morevolumes.yaml
  218. 171 kubectl describe pod morevol2
  219. 172 kubectl get pods
  220. 173 kubectl exec morevol2 -c centos1 -- touch /centos1/testfile
  221. 174 kubectl exec morevol2 -c centos2 -- ls -l /centos2/
  222. 175 kubectl get pods morevol2 -o wide
  223. 176 kubectl explain pods.spec.volumes | less
  224. 177 vim pv.yaml
  225. 178 kubectl apply -f pv.yaml
  226. 179 kubectl get pv
  227. 180 vim pvc.yaml
  228. 181 kubectl apply -f pvc.yaml
  229. 182 kubectl get pv,pvc
  230. 183 vim pv-pod.yaml
  231. 184 kubectl apply -f pv-pod.yaml
  232. 185 kubectl exec pv-pod -- touch /usr/share/nginx/html/hellofile.txt
  233. 186 kubectl describe pv pv-volume
  234. 187 kubectl get pods -o wide
  235. 188 ./countdown 14
  236. 189 sudo apt install nfs-server -y
  237. 190 sudo mkdir /nfsexport
  238. 191 sudo vim /etc/exports
  239. 192 sudo systemctl restart nfs-server
  240. 193 showmount -e localhost
  241. 194 sudo chmod 777 /nfsexport
  242. 195 cd
  243. 196 ls
  244. 197 tar xvf helm-v3.10.2-linux-amd64.tar.gz
  245. 198 sudo mv linux-amd64/helm /usr/local/bin/
  246. 199 helm --version
  247. 200 helm version
  248. 201 history
  249. 202 helm repo add nfs-sudir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/
  250. 203 helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner --set nfs.server=192.168.29.110 --set nfs.path=/nfsexport
  251. 204 helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/
  252. 205 helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner --set nfs.server=192.168.29.110 --set nfs.path=/nfsexport
  253. 206 kubectl get pods
  254. 207 kubectl get pv
  255. 208 kubectl get storageclass
  256. 209 ls kube3weeks/
  257. 210 git clone https://github.com/sandervanvugt/cka
  258. 211 cd cka
  259. 212 ;s
  260. 213 ls
  261. 214 git pull
  262. 215 vim nfs-provisioner-pvc-test.yaml
  263. 216 kubectl apply -f nfs-provisioner-pvc-test.yaml
  264. 217 kubectl get pvc,pv
  265. 218 kubectl get pv
  266. 219 kubectl describe pv pvc-b87d429c-5a62-4cce-b39a-685e5d8a94be
  267. 220 cp nfs-provisioner-pvc-test.yaml nfs-provisioner-pvc-test2.yaml
  268. 221 vim nfs-provisioner-pvc-test2.yaml
  269. 222 kubectl apply -f nfs-provisioner-pvc-test2.yaml
  270. 223 vim nfs-provisioner-pvc-test2.yaml
  271. 224 kubectl create -f nfs-provisioner-pvc-test2.yaml
  272. 225 kubectl get pvc,pv
  273. 226 kubectl describe pvc nfs-pvc-test2
  274. 227 cd ../kube3weeks/
  275. 228 vim varsfile
  276. 229 kubectl create cm mydbvars --from-env-file=varsfile
  277. 230 kubectl describe cm mydbvars
  278. 231 kubectl create mydb --image=mariadb --replicas=3
  279. 232 kubectl create deploy mydb --image=mariadb --replicas=3
  280. 233 kubectl get all --selector app=mydb
  281. 234 kubectl logs mydb-c8bddc94c-rs5hx
  282. 235 kubectl set env deploy mydb --from=configmap/mydbvars
  283. 236 kubectl get all --selector app=mydb
  284. 237 kubectl get deploy mydb -o yaml
  285. 238 echo hello world > index.html
  286. 239 kubectl create cm myindex --from-file=index.html
  287. 240 kubectl create cm mypw --from-file=/etc/passwd
  288. 241 kubectl describe cm mypw
  289. 242 kubectl create deploy myweb --image=nginx --dry-run=client -o yaml > myweb.yaml
  290. 243 vim myweb.yaml
  291. 244 kubectl apply -f myweb.yaml
  292. 245 kubectl exec myweb -- cat /usr/share/nginx/html/index.html
  293. 246 kubectl exec myweb-859f554699-sm54s -- cat /usr/share/nginx/html/index.html
  294. 247 ./countdown 14
  295. 248 helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard/
  296. 249 helm repo --help
  297. 250 helm repo list
  298. 251 helm install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard
  299. 252 kubectl get pods
  300. 253 kubectl -n default port-forward kubernetes-dashboard-7754b4fccd-nt92d 8443:8443
  301. 254 ls -l /etc/kubernetes/admin.conf
  302. 255 chmod o+r /etc/kubernetes/admin.conf
  303. 256 sudo chmod o+r /etc/kubernetes/admin.conf
  304. 257 sudo chmod o-r /etc/kubernetes/admin.conf
  305. 258 helm repo list
  306. 259 helm repo add bitnami https://charts.bitnami.com/bitnami
  307. 260 helm repo list
  308. 261 helm search repo bitnami
  309. 262 helm repo update
  310. 263 helm install bitnami/mysql --generate-name
  311. 264 kubectl get all
  312. 265 helm show chart bitnami/mysql
  313. 266 helm show all bitnami/mysql
  314. 267 helm show --help
  315. 268 helm show values
  316. 269 helm show values bitnami/mysql
  317. 270 helm status mysql
  318. 271 helm list
  319. 272 helm status mysql-1668185150
  320. 273 helm show values bitnami/nginx
  321. 274 helm pull bitnami/nginx
  322. 275 tar xvf nginx-13.2.13.tgz
  323. 276 cd nginx/
  324. 277 vim values.yaml
  325. 278 helm template --debug nginx
  326. 279 helm template --debug .
  327. 280 kubectl get deploy
  328. 281 kubectl edit deploy kubernetes-dashboard
  329. 282 kubectl get pods
  330. 283 history
  331. 284 sudo poweroff
  332. 285 kubectl api-resources | less Role
  333. 286 kubectl api-resources | grep Role
  334. 287 sudo poweroff
  335. 288 helm --help | less
  336. 289 helm install --help | less
  337. 290 helm show values bitnami/nginx | grep commonLabels
  338. 291 helm show values bitnami/nginx | grep commonLabels -C 3
  339. 292 helm install bitnami/nginx --set commonLabels: type=helm
  340. 293 helm repo list
  341. 294 helm show values bitnami/nginx
  342. 295 helm install bitnami/nginx --set commonLabels: type=helm
  343. 296 helm install bitnami/nginx --set "commonLabels: type=helm"
  344. 297 helm install bitnami/nginx --generate-name --set "commonLabels: type=helm"
  345. 298 kubectl get all --selector type=helm
  346. 299 kubectl get all --show-labels
  347. 300 kubectl get all --show-labels | grep nginx
  348. 301 helm show values bitnami/nginx | less
  349. 302 helm list
  350. 303 helm remove nginx-13.2.13
  351. 304 helm uninstall nginx-13.2.13
  352. 305 helm uninstall nginx
  353. 306 helm uninstall nginx-1668678584
  354. 307 vim values.yaml
  355. 308 helm install bitnami/nginx --generate-name --values values.yaml
  356. 309 vim values.yaml
  357. 310 helm install bitnami/nginx --generate-name --values values.yaml
  358. 311 kubectl get deploy
  359. 312 kubectl get deploy --show-labels
  360. 313 cat values.yaml
  361. 314 history
  362. 315 history | grep helm install
  363. 316 history | grep "helm install"
  364. 317 kubectl get deploy
  365. 318 kubectl delete deploy nginxsvc
  366. 319 helm uninstall nginx-1668679159
  367. 320 sudo poweroff
  368. 321 kubectl get all
  369. 322 helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace
  370. 323 kubectl get all -n ingress-nginx
  371. 324 source <(kubectl completion bash)
  372. 325 kubectl get all -n ingress-nginx
  373. 326 kubectl get deploy
  374. 327 kubectl create deploy nginxsvc --image=nginx
  375. 328 kubectl expose deploy nginxsvc
  376. 329 kubectl expose deploy nginxsvc --port=80
  377. 330 kubectl get svc
  378. 331 kubectl describe svc nginxsvc
  379. 332 kubectl create ingress -h | less
  380. 333 kubectl create ingress nginxsvc --class=nginx --rule=nginxsvc.info/*=nginxsvc:80
  381. 334 kubectl port-forward -n ingress-nginx svc/ingress-nginx-controller 8080:80
  382. 335 bg
  383. 336 ip a
  384. 337 sudo vim /etc/hosts
  385. 338 curl nginxsvc.info:8080
  386. 339 kubectl get statefulset
  387. 340 history
  388. 341 cd kube3weeks/
  389. 342 vim statefulset.yaml
  390. 343 kubectl get storageclass
  391. 344 kubectl get pvc
  392. 345 kubectl delete pvc nfs-pvc-test
  393. 346 kubectl delete pvc nfs-pvc-test2
  394. 347 kubectl get pv
  395. 348 vim statefulset.yaml
  396. 349 kubectl get all
  397. 350 kubectl create ns state
  398. 351 vim statefulset.yaml
  399. 352 kubectl api-resources | grep storage
  400. 353 kubectl create -f statefulset.yaml
  401. 354 kubectl get all -n state
  402. 355 kubectl get pvc,pv -n state
  403. 356 kubectl get all -n state
  404. 357 vim what-are-we-doing-next.txt
  405. 358 kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
  406. 359 kubectl get all -n kube-system
  407. 360 kubectl logs -n kube-system metrics-server-847d45fd4f-bld6j
  408. 361 kubectl -n kube-system edit deployments.apps metrics-server
  409. 362 kubectl get pods -n kube-system
  410. 363 kubectl top pods
  411. 364 ./countdown 13
  412. 365 ls
  413. 366 cd ..
  414. 367 git clone https://github.com/sandervanvugt/ckad
  415. 368 cd ckad
  416. 369 ls
  417. 370 cd autoscaling/
  418. 371 ls
  419. 372 vim Dockerfile
  420. 373 history | grep crictl
  421. 374 sudo crictl --help | less
  422. 375 sudo apt install docker.io
  423. 376 sudo docker build -t php-apache .
  424. 377 vim hpa.yaml
  425. 378 kubectl apply -f hpa.yaml
  426. 379 kubectl get deploy; sleep 60
  427. 380 kubectl autoscale deployment php-apache --cpu-percent=1 --min=3 --max=10
  428. 381 kubectl autoscale -h | less
  429. 382 kubectl get hpa
  430. 383 kubectl get deploy
  431. 384 kubectl get hpa
  432. 385 kubectl get deployments.apps php-apache
  433. 386 kubectl get hpa
  434. 387 kubectl api-resources
  435. 388 kubectl api-resources | wc
  436. 389 cd ../../kube3weeks/
  437. 390 vim crd-object.yaml
  438. 391 kubectl create -f crd-object.yaml
  439. 392 kubectl api-resources | grep backup
  440. 393 kubectl explain backups
  441. 394 kubectl explain backups.spec
  442. 395 vim crd-backup.yaml
  443. 396 kubectl create -f crd-backup.yaml
  444. 397 kubectl get backups
  445. 398 kubectl get backups -o yaml
  446. 399 ./countdown 1
  447. 400 kubectl api-resources get co
  448. 401 kubectl api-resources | grep operat
  449. 402 curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.22.0/install.sh | bash -s v0.22.0
  450. 403 kubectl get ns
  451. 404 kubectl create -f https://operatorhub.io/install/rook-ceph.yaml
  452. 405 kubectl get all -n my-rook-ceph
  453. 406 kubectl get csv -n my-rook-ceph
  454. 407 kubectl get all -n my-rook-ceph
  455. 408 kubectl api-resources | grep csv
  456. 409 kubectl get all -n my-rook-ceph
  457. 410 kubectl get csv -n my-rook-ceph
  458. 411 kubectl get pods nginxsvc-5647fc5c85-tmlwb -o yaml | less
  459. 412 kubectl get pods nfs-subdir-external-provisioner-74847dc574-xxft8 | less
  460. 413 kubectl get pods nfs-subdir-external-provisioner-74847dc574-xxft8 -o yaml | less
  461. 414 kubectl get sa -A | less
  462. 415 ./countdown 14
  463. 416 kubectl create role -h | less
  464. 417 cd ..
  465. 418 cd ckad
  466. 419 vim mypod.yaml
  467. 420 kubectl apply -f mypod.yaml
  468. 421 kubectl get pod mypod -o yaml | less
  469. 422 kubectl exec -it mypod -- sh
  470. 423 vim mysa.yaml
  471. 424 kubectl apply -f mysa.yaml
  472. 425 vim list-pods.yaml
  473. 426 kubectl explain role.rules.verbs
  474. 427 kubectl apply -f list-pods.yaml
  475. 428 vim list-pods-mysa-binding.yaml
  476. 429 kubectl apply -f list-pods-mysa-binding.yaml
  477. 430 vim mysapod.yaml
  478. 431 kubectl apply -f mysapod.yaml
  479. 432 kubectl exec -it mysapod -- sh
  480. 433 ./countdown 1
  481. 434 cd ..
  482. 435 less .kube/config
  483. 436 kubectl create ns students
  484. 437 kubectl create ns staff
  485. 438 kubectl config get-contexts
  486. 439 sudo useradd -m -G sudo -s /bin/bash anna
  487. 440 sudo passwd anna
  488. 441 su - anna
  489. 442 ls
  490. 443 su - anna
  491. 444 git clone https://github.com/sandervanvugt/cka
  492. 445 cd cka
  493. 446 ls
  494. 447 vim staff-role.yaml
  495. 448 kubectl apply -f staff-role.yaml
  496. 449 vim rolebind.yaml
  497. 450 kubectl apply -f rolebind.yaml
  498. 451 su - anna
  499. 452 cd ..
  500. 453 ls
  501. 454 tar xvf prometheus-2.40.2.linux-amd64.tar.gz
  502. 455 cd prometheus-2.40.2.linux-amd64/
  503. 456 cd ~/kube3weeks/
  504. 457 ls
  505. 458 cd ..
  506. 459 git clone https://github.com/sandervanvugt/kcna
  507. 460 ls
  508. 461 cd prometheus-2.40.2.linux-amd64/
  509. 462 ls
  510. 463 cp ../kcna/prometheus-1.yml prometheus.yml
  511. 464 vim prometheus.yml
  512. 465 ./prometheus
  513. 466 bg
  514. 467 cd
  515. 468 tar xvf node_exporter-1.4.0.linux-amd64.tar.gz
  516. 469 cd node_exporter-1.4.0.linux-amd64/
  517. 470 ls
  518. 471 ./node_exporter
  519. 472 bg
  520. 473 cd ../prometheus-2.40.2.linux-amd64/
  521. 474 cp ~/kcna/prometheus-2.yml prometheus.yml
  522. 475 ps aux | grep promet
  523. 476 kill 145317
  524. 477 ./prometheus &
  525. 478 ps aux | grep prom
  526. 479 kill 149138
  527. 480 cd
  528. 481 cd kcna/
  529. 482 ls
  530. 483 cd kubernetes-prometheus/
  531. 484 ls
  532. 485 kubectl apply -f .
  533. 486 kubectl create ns monitoring
  534. 487 kubectl apply -f .
  535. 488 kubectl get all -n monitoring
  536. 489 kubectl top pods
  537. 490 kubectl top pods -A
  538. 491 kubectl top pods -n monitoring
  539. 492 top
  540. 493 cd
  541. 494 history
  542.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement