sandervanvugt

devops3weeks jun22 day3

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