sandervanvugt

kube3weeks day3 april22

Apr 22nd, 2022
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.33 KB | None | 0 0
  1. student@control:~$ history
  2. 1 git clone https://github.com/sandervanvugt/cka
  3. 2 cd cka
  4. 3 ls
  5. 4 ./setup-container.sh
  6. 5 ./setup-kubetools.sh
  7. 6 sudo ./setup-kubetools.sh
  8. 7 ip a
  9. 8 sudo vim /etc/hosts
  10. 9 sudo kubeadm init
  11. 10 192.168.29.157 control.example.com control
  12. 11 192.168.29.158 worker1.example.com worker1
  13. 12 192.168.29.159 worker2.example.com worker2
  14. 13 192.168.29.157 control.example.com control
  15. 14 192.168.29.158 worker1.example.com worker1
  16. 15 192.168.29.159 worker2.example.com worker2
  17. 16 sudo kubeadm --help
  18. 17 sudo kubeadm reset
  19. 18 sudo -i
  20. 19 cd
  21. 20 mkdir .kube
  22. 21 sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
  23. 22 sudo chown $(id -u):$(id -g) $HOME/.kube/config
  24. 23 kubectl get all
  25. 24 kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
  26. 25 kubectl get nodes
  27. 26 top
  28. 27 ls
  29. 28 sudo kubeadm init
  30. 29 sudo -i
  31. 30 kubectl get all
  32. 31 kubectl get nodes
  33. 32 vim varsfile
  34. 33 kubectl create cm mydbvars --from-env-file=varsfile
  35. 34 source <(kubectl completion bash)
  36. 35 kubectl create deployment mydb --image=mariadb --replicas=3
  37. 36 kubectl get all
  38. 37 kubectl set env deploy mydb --from=configmap/mydbvars
  39. 38 kubectl get all
  40. 39 kubectl get deploy mydb -o yaml
  41. 40 echo "hello friday" > index.html
  42. 41 kubectl create vm myindex --from-file=index.html
  43. 42 kubectl create cm myindex --from-file=index.html
  44. 43 kubectl describe cm myindex
  45. 44 kubectl create deploy myweb --image-nginx
  46. 45 kubectl create deploy myweb --image=nginx
  47. 46 kubectl get all
  48. 47 kubectl edit deploy myweb
  49. 48 kubectl get pods
  50. 49 kubectl exec -it myweb-ff8bf9988-hw7m2 -- cat /usr/share/nginx/html/index.html
  51. 50 historu
  52. 51 history
  53. 52 kubectl create secret -h
  54. 53 kubectl create secret docker-registry -h
  55. 54 kubectl create secret docker-registry my-docker-credentials --docker-username=unclebob --docker-password=password [email protected] --docker-server=myregistry:5000
  56. 55 kubectl describe secrets my-docker-credentials
  57. 56 kubectl get -o yaml secrets my-docker-credentials
  58. 57 echo eyJhdXRocyI6eyJteXJlZ2lzdHJ5OjUwMDAiOnsidXNlcm5hbWUiOiJ1bmNsZWJvYiIsInBhc3N3b3JkIjoicGFzc3dvcmQiLCJlbWFpbCI6InVuY2xlQGJvYi5vcmciLCJhdXRoIjoiZFc1amJHVmliMkk2Y0dGemMzZHZjbVE9In19fQ== | base64 -d
  59. 58 ip a
  60. 59 ls
  61. 60 tar xvf helm-v3.8.2-linux-amd64.tar.gz
  62. 61 sudo mv linux-amd64/helm /usr/local/bin/
  63. 62 helm version
  64. 63 helm repo list
  65. 64 helm repo add kubernetes-dashboard https://kubernetes.github.io/dashboard
  66. 65 helm repo list
  67. 66 helm install kubernetes-dashboard kubernetes-dashboard/kubernetes-dashboard
  68. 67 echo $POD_NAME
  69. 68 echo https://127.0.0.1:8443/
  70. 69 kubectl -n default port-forward $POD_NAME 8443:8443
  71. 70 bg
  72. 71 ip a
  73. 72 ss -tunap | less
  74. 73 jobs
  75. 74 fg
  76. 75 kubectl port-forward -h
  77. 76 kubectl -n default port-forward $POD_NAME --address localhost,192.168.29.157 8443:8443
  78. 77 bg
  79. 78 ss -tunap | less
  80. 79 kubectl get pods -o wide
  81. 80 ls
  82. 81 git clone https://github.com/sandervanvugt/kube3weeks
  83. 82 cd kube3weeks/
  84. 83 history
  85. 84 sleep 120; countdown 10
  86. 85 ./countdown 8
  87. 86 kubectl get pods -o wide
  88. 87 kubectl describe pod kubernetes-dashboard-585b459448-9vch2
  89. 88 kubectl describe pod kubernetes-dashboard-585b459448-9vch2 | less
  90. 89 history
  91. 90 helm repo add bitnami https://charts.bitnami.com/bitnami
  92. 91 helm repo list
  93. 92 helm search repo bitnami
  94. 93 helm repo update
  95. 94 helm list
  96. 95 kubectl get all
  97. 96 helm install bitnami/mysql --generate-name
  98. 97 helm show chart bitnami/mysql
  99. 98 helm show all bitnami/mysql
  100. 99 helm list
  101. 100 helm status mysql
  102. 101 helm status mysql-1650634346
  103. 102 source <(helm completion bash)
  104. 103 helm show values bitnami/nginx
  105. 104 helm pull bitnami/nginx
  106. 105 ls
  107. 106 tar xvf nginx-10.1.3.tgz
  108. 107 cd nginx/
  109. 108 ls
  110. 109 vim values.yaml
  111. 110 cd ..
  112. 111 helm install -f nginx/values.yaml mynginx nginx/
  113. 112 helm list
  114. 113 cd ..
  115. 114 git clone https://github.com/sandervanvugt/microservices
  116. 115 cd microservices/
  117. 116 ls
  118. 117 vim kustomization.yaml
  119. 118 cd lesson6lab/
  120. 119 ls
  121. 120 vim kustomization.yaml
  122. 121 kubectl api-resources | grep template
  123. 122 cd
  124. 123 helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace
  125. 124 kubectl get all
  126. 125 kubectl get secret
  127. 126 kubectl get pods -n ingress-nginx
  128. 127 kubectl describe -n ingress-nginx pods ingress-nginx-controller-7575567f98-vsmnz | less
  129. 128 kubectl get all -n ingress-nginx
  130. 129 kubectl create deploy nginxsvc --image=nginx --port=80
  131. 130 kubectl expose deploy nginxsvc
  132. 131 kubectl get all
  133. 132 kubectl edit svc nginxsvc
  134. 133 kubectl edit -n ingress-nginx svc ingress-nginx-controller
  135. 134 kubectl create ingress nginxsvc --class=nginx --rule=nginxsvc.info/*=nginxsvc:80
  136. 135 kubectl describe ingress nginxsvc
  137. 136 kubectl port-forward -n ingress-nginx svc/ingress-nginx-controller 8080:80
  138. 137 bg
  139. 138 curl nginxsvc.info
  140. 139 cd kube3weeks/
  141. 140 history
  142. 141 sleep 120; ./countdown 10
  143. 142 sudo cat /etc/kubelet/
  144. 143 sudo cat /var/lib/kubelet/config.conf
  145. 144 kubectl get all
  146. 145 vim statefulset.yaml
  147. 146 kubectl create -f statefulset.yaml
  148. 147 kubectl get pods
  149. 148 kubectl describe pod web-0
  150. 149 kubectl get pvc
  151. 150 top
  152. 151 kubectl apply -f https://github.com/kubernetes-sigs/metrics-servers/releases/latest/download/components.yaml
  153. 152 kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
  154. 153 kubectl get pods -n kube-system
  155. 154 kubectl logs -n kube-system metrics-server-847dcc659d-xgnjp
  156. 155 kubectl edit deploy -n kube-system metrics-server
  157. 156 kubectl get pods -n kube-system
  158. 157 kubectl edit deploy -n kube-system metrics-server
  159. 158 kubectl get pods -n kube-system
  160. 159 kubectl top nodes
  161. 160 kubectl top pods
  162. 161 cd ..
  163. 162 git clone https://github.com/sandervanvugt/ckad
  164. 163 cd ckad
  165. 164 cd autoscaling/
  166. 165 ls
  167. 166 vim Dockerfile
  168. 167 sudo apt install docker.io
  169. 168 sudo docker build -t php-apache .
  170. 169 vim hpa.yaml
  171. 170 kubectl apply -f hpa.yaml
  172. 171 kubectl get all
  173. 172 kubectl autoscale deploy php-apache --cpu-percent=50 --min=1 --max=10
  174. 173 kubectl get hpa
  175. 174 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"
  176. 175 kubectl get pods
  177. 176 kubectl get hpa
  178. 177 cd ..
  179. 178 history
  180. 179 sleep 120; ./countdown 10
  181. 180 cd ..
  182. 181 cd kube3weeks/
  183. 182 ls
  184. 183 cd ..
  185. 184 git clone https://github.com/rook/rook.git
  186. 185 cd rook/deploy/examples/
  187. 186 ls
  188. 187 vim common.yaml
  189. 188 vim operator.yaml
  190. 189 cd ~/kube3weeks/
  191. 190 ls
  192. 191 vim cluster.yaml
  193. 192 lsblk
  194. 193 cd ../rook/deploy/examples/
  195. 194 kubectl create -f crds.yaml -f common.yaml -f operator.yaml
  196. 195 kubectl -n rook-ceph get all
  197. 196 kubectl create -f cluster.yaml
  198. 197 kubectl -n rook-ceph get all
  199. 198 vim ~/kube3weeks/storageclass.yaml
  200. 199 kubectl -n rook-ceph get all
  201. 200 kubectl -n rook-ceph get pods
  202. 201 kubectl create -f ~/kube3weeks/storageclass.yaml
  203. 202 kubectl get storageclass
  204. 203 kubectl create -f toolbox.yaml
  205. 204 kubectl -n rook-ceph exec -it rook-ceph-tools-d6d7c985c-6qk78 -- ceph status
  206. 205 kubectl get pv.pvc
  207. 206 kubectl get pv,pvc
  208. 207 kubectl -n rook-ceph exec -it rook-ceph-tools-d6d7c985c-6qk78 -- ceph status
  209. 208 kubectl create -f wordpress.yaml
  210. 209 kubectl get pv,pvc
  211. 210 kubectl delete -f wordpress.yaml
  212. 211 kubectl delete -f ~/kube3weeks/storageclass.yaml
  213. 212 exit
  214. 213 kubectl get hpa
  215. 214 kubectl get deploy php-apache
  216. 215 kubectl api-resources | less
  217. 216 cd kube3weeks/
  218. 217 ls
  219. 218 vim crd-object.yaml
  220. 219 kubectl create -f crd-object.yaml
  221. 220 kubectl api-resources | grep backup
  222. 221 vim crd-backup.yaml
  223. 222 kubectl create crd-backup.yaml
  224. 223 kubectl create -f crd-backup.yaml
  225. 224 kubectl get backups
  226. 225 cd
  227. 226 cd kube3weeks/
  228. 227 ls
  229. 228 kubectl create deploy old-nginx --image=nginx:1.14 --replicas=3 --dry-run=client -o yaml > oldnginx.yaml
  230. 229 vim oldnginx.yaml
  231. 230 kubectl create -f oldnginx.yaml
  232. 231 kubectl get all --selector type=canary
  233. 232 kubectl expose deploy old-nginx --name=oldnginx --port=80 --selector type=canary
  234. 233 kubectl get svc; kubectl get endpoints
  235. 234 kubectl get svc; kubectl get endpoints --selector type=canary
  236. 235 echo newdeploy > index.html
  237. 236 kubectl create cm canary --from-file=index.html
  238. 237 vim canary.yaml
  239. 238 kubectl create -f canary.yaml
  240. 239 kubectl get endpoints --selector type=canary
  241. 240 kubectl get svc
  242. 241 curl 10.98.181.145
  243. 242 kubectl get all --selector type=canary
  244. 243 kubectl scale deploy new-nginx --replicas=3
  245. 244 kubectl get all --selector type=canary
  246. 245 kubectl scale deploy old-nginx --replicas=0
  247. 246 kubectl get all --selector type=canary
  248. 247 exit
  249. 248 history
  250.  
Add Comment
Please, Sign In to add comment