sandervanvugt

devops3weeks jun22 day3

Jun 24th, 2022
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.76 KB | None | 0 0
  1. OPENSHIFT COMMANDS
  2. 1000 crc start -m 12288 -p ../pull-secret
  3. 1001 history | grep oc login
  4. 1002 history | grep 'oc login'
  5. 1003 oc login -u kubeadmin -p jcjAC-MpSHT-MSPge-tHVKS https://api.crc.testing:6443
  6. 1004 history | grep crc
  7. 1005 crc oc-env
  8. 1006 eval $(crc oc-env)
  9. 1007 oc login -u kubeadmin -p jcjAC-MpSHT-MSPge-tHVKS https://api.crc.testing:6443
  10. 1008 oc get ns | less
  11. 1009 oc api-resources | less
  12. 1010 ex180/countdown 12
  13. 1011 oc get is -n openshift
  14. 1012 oc new-app -h | less
  15. 1013 oc new-app php~https://github.com/sandervanvugt/simpleapp --name=simple-app
  16. 1014 oc get all
  17. 1015 oc new-project
  18. 1016 oc new-project friday
  19. 1017 oc get all
  20. 1018 oc new-app php~https://github.com/sandervanvugt/simpleapp --name=simple-app
  21. 1019 oc get all
  22. 1020 oc expose service simple-app
  23. 1021 oc get all
  24. 1022 curl simple-app-friday.apps-crc.testing
  25. 1023 oc get all
  26. 1024 history | grep build
  27. 1025 oc start-build simple-app-1
  28. 1026 oc get all
  29. 1027 oc start-build simple-app
  30. 1028 oc get all
  31. 1029 curl simple-app-friday.apps-crc.testing
  32. 1030 history
  33.  
  34. KUBERNETES COMMANDS
  35. student@student-virtual-machine:~$ history
  36. 1 df -h
  37. 2 free -m
  38. 3 lscpu | less
  39. 4 sudo apt install git
  40. 5 git clone https://github.com/sandervanvugt/devopsinfourweeks
  41. 6 cd devopsinfourweeks/
  42. 7 ls
  43. 8 ./minikube-docker-setup.sh
  44. 9 ssh sander@192.168.52.136
  45. 10 minikube start --help
  46. 11 minikube start --vm-driver=docker --memory=6g
  47. 12 minikube status
  48. 13 kubectl get all
  49. 14 sudo apt install vim
  50. 15 ./counter.sh 15
  51. 16 kubectl api-resources
  52. 17 kubectl api-resources | wc
  53. 18 kubectl --help | less
  54. 19 kubectl completion --help | less
  55. 20 source <(kubectl completion bash)
  56. 21 kubectl create deployment -h | less
  57. 22 kubectl create deployment my-dep --image=nginx --replicas=3
  58. 23 kubectl get all
  59. 24 kubectl api-resources | less
  60. 25 kubectl delete pod my-dep-84885b44-2tnbt
  61. 26 kubectl get all
  62. 27 kubectl get pods
  63. 28 kubectl get pods
  64. 29 kubectl get pods -A
  65. 30 minikube dashboard &
  66. 31 kubectl get pods -A
  67. 32 kubectl create mytrouble --image=mariadb --replicas=3
  68. 33 kubectl create deploy mytrouble --image=mariadb --replicas=3
  69. 34 kubectl get all
  70. 35 kubectl describe pod mytrouble-7cd9cf99f7-8hmd9 | less
  71. 36 kubectl logs mytrouble-7cd9cf99f7-8hmd9
  72. 37 kubectl get pods
  73. 38 kubectl exec -it my-dep-84885b44-8hfll -- sh
  74. 39 ./counter.sh 15
  75. 40 kubectl create -h | less
  76. 41 kubectl create deploy -h | less
  77. 42 kubectl create deployment myother --image=busybox
  78. 43 kubectl get all
  79. 44 kubectl describe pod myother-5758f49dc4-dvg6j
  80. 45 kubectl get all
  81. 46 kubectl delete deployments.apps myother
  82. 47 kubectl create deployment myother --image=busybox sleep infinity
  83. 48 kubectl create deploy -h | less
  84. 49 kubectl create deployment myother --image=busybox -- sleep infinity
  85. 50 kubectl get all
  86. 51 kubectl delete deployments.apps mytrouble
  87. 52 kubectl create deploy mynginx --image=nginx --replicas=3 --dry-run=client -o yaml
  88. 53 kubectl create deploy mynginx --image=nginx --replicas=3 --dry-run=client -o json
  89. 54 kubectl create deploy mynginx --image=nginx --replicas=3 --dry-run=client -o yaml > mynginx.yaml
  90. 55 vim mynginx.yaml
  91. 56 kubectl explain deploy
  92. 57 kubectl explain deploy.spec
  93. 58 kubectl explain deploy.spec | less
  94. 59 kubectl explain deploy.spec.template.spec | less
  95. 60 kubectl edit deployments.apps my-dep
  96. 61 kubectl get deploy --selector app=my-dep
  97. 62 kubectl get all --selector app=my-dep
  98. 63 kubectl edit deployments.apps my-dep
  99. 64 kubectl get all --selector app=my-dep
  100. 65 kubectl edit deployments.apps my-dep
  101. 66 kubectl get all --selector app=my-dep
  102. 67 kubectl get pods -o wide
  103. 68 kubectl get deployments.apps
  104. 69 kubectl delete deploy myother
  105. 70 kubectl delete deploy my-dep
  106. 71 kubectl get all
  107. 72 kubectl create deployment mynginx --image=nginx --replicas=3
  108. 73 kubectl get all
  109. 74 kubectl get pods -o wide
  110. 75 curl 172.17.0.4
  111. 76 kubectl expose deployment mynginx --port=80
  112. 77 kubectl get svc
  113. 78 curl 10.99.255.223
  114. 79 minikube ssh
  115. 80 kubectl edit svc mynginx
  116. 81 kubectl get svc
  117. 82 curl $(minikube ip):31516
  118. 83 ./counter.sh 13
  119. 84 vim pv-pvc-pod.yaml
  120. 85 kubectl explain persistentvolume.spec
  121. 86 kubectl explain persistentvolume.spec | less
  122. 87 kubectl explain pod.spec.volumes | less
  123. 88 vim pv-pvc-pod.yaml
  124. 89 kubectl create -f pv-pvc-pod.yaml
  125. 90 vim pv-pvc-pod.yaml
  126. 91 kubectl create -f pv-pvc-pod.yaml
  127. 92 kubectl get pv,pvc
  128. 93 kubectl get storageclass
  129. 94 kubectl describe pod local-pv-pod
  130. 95 kubectl exec local-pv-pod -- touch /usr/share/nginx/html/friday
  131. 96 kubectl describe pv pvc-abc43582-9814-48a4-b77a-c105c96be7d1
  132. 97 minikube ssh
  133. 98 kubectl run mymysql --image=mysql:latest
  134. 99 kubectl get pods
  135. 100 kubectl describe pod mymysql
  136. 101 kubectl logs mymysql
  137. 102 kubectl delete pod mymysql
  138. 103 kubectl run mymysql --image=mysql:latest --env=MYSQL_ROOT_PASSWORD=password
  139. 104 kubectl get pods
  140. 105 sudo poweroff
  141. 106 history
  142. 107 minikube start --vm-driver=docker --memory=6g
  143. 108 kubectl get all
  144. 109 history
  145. 110 kubectl create cm myvars --from-literal=VAR1=goat --from-literal=VAR=cow
  146. 111 kubectl describe cm myvars
  147. 112 cd devopsinfourweeks/
  148. 113 vim cm-test-pod.yaml
  149. 114 kubectl create -f cm-test-pod.yaml
  150. 115 kubectl logs test1
  151. 116 kubectl create cm nginxconf --from-file nginx-custom-config.conf
  152. 117 kubectl describe cm nginxconf
  153. 118 vim nginx-cm.yml
  154. 119 kubectl create -f nginx-cm.yml
  155. 120 source <(kubectl completion bash)
  156. 121 kubectl get pods
  157. 122 kubectl describe pod nginx-cm
  158. 123 kubectl get cm
  159. 124 kubectl delete -f nginx-cm.yml
  160. 125 vim nginx-cm.yml
  161. 126 kubectl create -f nginx-cm.yml
  162. 127 kubectl get pods
  163. 128 kubectl delete pods test1
  164. 129 kubectl exec -it nginx-cm -- /bin/bash
  165. 130 kubectl exec -it nginx-cm -- cat /etc/nginx/conf.d/default.conf
  166. 131 cat nginx-custom-config.conf
  167. 132 kubectl run --help | less
  168. 133 kubectl create deploy -h | less
  169. 134 kubectl set env -h | less
  170. 135 kubectl create deploy blue-nginx --image=nginx:1.14 --replicas=3
  171. 136 kubectl get all --selector app=blue-nginx
  172. 137 kubectl expose deploy blue-nginx --port=80 --name=bgnginx
  173. 138 kubectl get all --selector app=blue-nginx
  174. 139 minikube ip
  175. 140 minikube ssh
  176. 141 kubectl get deployments.apps blue-nginx -o yaml > green-nginx.yaml
  177. 142 vim green-nginx.yaml
  178. 143 kubectl create -f green-nginx.yaml
  179. 144 kubectl get pods
  180. 145 kubectl get svc
  181. 146 oc get endpoints
  182. 147 kubectl get endpoints
  183. 148 kubectl delete svc bgnginx; kubectl expose deployment green-nginx --port=80 --name=bgnginx
  184. 149 kubectl get endpoints
  185. 150 oc get deploy
  186. 151 kubectl get deploy
  187. 152 kubectl scale deployment blue-nginx --replicas=0
  188. 153 kubectl get deploy
  189. 154 ./counter.sh 1
  190. 155 kubectl get deploy
  191. 156 kubectl delete deploy blue-nginx
  192. 157 kubectl delete deploy mynginx
  193. 158 kubectl delete deploy gree-nmynginx
  194. 159 kubectl delete deploy green-mynginx
  195. 160 kubectl delete deploy green-nginx
  196. 161 kubectl get svc
  197. 162 kubectl delete svc mynginx
  198. 163 kubectl delete svc bgnginx
  199. 164 kubectl create deploy old-nginx --image=nginx:1.14 --replicas=3 --dry-run=client -o yaml > ~/oldnginx.yaml
  200. 165 cd
  201. 166 vim oldnginx.yaml
  202. 167 kubectl create -f oldnginx.yaml
  203. 168 kubectl get all --show-labels
  204. 169 kubectl expose deploy old-nginx --name=oldnginx --port=80 --selector type=canary
  205. 170 kubectl get svc
  206. 171 kubectl edit svc oldnginx
  207. 172 kubectl get svc
  208. 173 kubectl get endpoints
  209. 174 curl 192.168.49.2:31038
  210. 175 kubectl cp old-nginx-66bd7bb796-g7ss8:/usr/share/nginx/html/index.html index.html
  211. 176 vim index.html
  212. 177 kubectl create cm canary --from-file=index.html
  213. 178 kubectl describe cm canary
  214. 179 cp oldnginx.yaml canary.yaml
  215. 180 cd devopsinfourweeks/
  216. 181 vim canary.yaml
  217. 182 kubectl get endpoints
  218. 183 kubectl create -f canary.yaml
  219. 184 kubectl get endpoints
  220. 185 kubectl get svc
  221. 186 curl 192.168.49.2:31038
  222. 187 kubectl get deploy
  223. 188 kubectl scale deployment new-nginx --replicas=3
  224. 189 kubectl get deploy
  225. 190 kubectl scale deployment old-nginx --replicas=0
  226. 191 kubectl get deploy
  227. 192 kubectl delete deployments.apps old-nginx
  228. 193 ./counter.sh 1
  229. 194 cd ../Downloads/
  230. 195 ls
  231. 196 tar xvf helm-v3.9.0-linux-amd64.tar.gz
  232. 197 sudo mv linux-amd64/helm /usr/local/bin/
  233. 198 helm version
  234. 199 helm repo add bitnami https://charts.bitnami.com/bitnami
  235. 200 helm repo list
  236. 201 helm search repo bitnami
  237. 202 helm repo update
  238. 203 helm install bitnami/mysql --generate-name
  239. 204 kubectl get all
  240. 205 helm show chart bitnami/mysql
  241. 206 helm show all bitnami/mysql
  242. 207 helm list
  243. 208 helm status mysql-1656076179
  244. 209 history
  245. 210 helm show values bitnami/nginx
  246. 211 helm pull bitnami/nginx
  247. 212 ls
  248. 213 tar xvf nginx-12.0.5.tgz
  249. 214 vim nginx/values.yaml
  250. 215 helm template --debug nginx
  251. 216 helm install -f nginx/values.yaml my-nginx nginx/
  252. 217 kubectl api-resources
  253. 218 kubectl api-resources | less
  254. 219 cd ../devopsinfourweeks/
  255. 220 ls
  256. 221 git pull
  257. 222 vim crd-object.yaml
  258. 223 kubectl create -f crd-object.yaml
  259. 224 kubectl api-resources | grep backup
  260. 225 vim crd-backup.yaml
  261. 226 kubectl create -f crd-backup.yaml
  262. 227 kubectl get backups.stable.example.com
  263. 228 minikube stop
  264. 229 minikube delete
  265. 230 minikube start --network-plugin=cni --extra-config=kubeadm.pod-network-cidr=10.10.0.0/16
  266. 231 kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml
  267. 232 kubectl get all -n tigera-operator
  268. 233 kubectl get pods -n tigera-operator tigera-operator-7d8c9d4f67-ds8g2 -o yaml | less
  269. 234 wget https://docs.projectcalico.org/manifests/custom-resources.yaml
  270. 235 vim custom-resources.yaml
  271. 236 kubectl create -f custom-resources.yaml
  272. 237 kubectl get installations.operator.tigera.io
  273. 238 kubectl get pods -n calico-system
  274. 239 ./counter.sh 1
  275. 240 minikube addons list
  276. 241 kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml
  277. 242 kubectl api-resources | grep -i tekton
  278. 243 kubectl get ns
  279. 244 kubectl get pods -n tekton-pipelines
  280. 245 cat hello-world.yaml
  281. 246 kubectl apply -f hello-world.yaml
  282. 247 cat hello-world-run.yaml
  283. 248 kubectl apply -f hello-world-run.yaml
  284. 249 kubectl get taskruns.tekton.dev
  285. 250 kubectl logs --selector=tekton.dev/taskRun=hello-task-run
  286. 251 kubectl get taskruns.tekton.dev
  287. 252 kubectl get all -n tekton-pipelines
  288. 253 kubectl get all
  289. 254 history
  290. 255 cat goodbye-world.yaml
  291. 256 kubectl apply -f goodbye-world.yaml
  292. 257 cat hello-goodbye-pipeline.yaml
  293. 258 kubectl explain Pipeline.spec
  294. 259 kubectl apply -f hello-goodbye-pipeline.yaml
  295. 260 cat hello-goodbye-pipeline-run.yaml
  296. 261 kubectl apply -f hello-goodbye-pipeline-run.yaml
  297. 262 kubectl get pods
  298. 263 tkn pipelinerun logs hello-goodbye-run -f -n default
  299. 264 ./counter.sh 1
  300. 265 kubectl create ns argocd
  301. 266 kubectl get ns
  302. 267 kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
  303. 268 kubectl get all -n argocd
  304. 269 cd ../Downloads/
  305. 270 ls
  306. 271 file argocd-linux-amd64
  307. 272 sudo mv argocd-linux-amd64 /usr/local/bin/argocd
  308. 273 kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
  309. 274 kubectl port-forward svc/argocd-server -n argocd 8080:443
  310. 275 bg
  311. 276 argocd login localhost:8080
  312. 277 sudo chmod +x /usr/local/bin/argocd
  313. 278 argocd login localhost:8080
  314. 279 argocd account update-password
  315. 280 argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook --dest-server https://kubernetes.default.svc --dest-namespace default
  316. 281 argocd app get guestbook
  317. 282 kubectl get all
  318. 283 argocd app list
  319. 284 argocd app sync guestbook
  320. 285 kubectl get all
  321. 286 exit
  322. 287 ls
  323. 288 cd devopsinfourweeks/
  324. 289 ./counter.sh 15
  325. 290 sudo apt update;sudo apt install -y gnupg
  326. 291 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3EFE0E0A2F2F60AA
  327. 292 echo "deb http://ppa.launchpad.net/tektoncd/cli/ubuntu eoan main"|sudo tee /etc/apt/sources.list.d/tektoncd-ubuntu-cli.list
  328. 293 sudo apt update && sudo apt install -y tektoncd-cli
  329. 294 exit
  330. 295 history
  331.  
Add Comment
Please, Sign In to add comment