Advertisement
sandervanvugt

EX280 april23 day2

Apr 5th, 2023
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.17 KB | None | 0 0
  1. 1000 source <(oc completion bash)
  2. 1001 oc get all
  3. 1002 oc describe svc bginx
  4. 1003 oc get pods --show-labels
  5. 1004 oc scale deploy bginx --replicas=3
  6. 1005 oc describe svc bginx
  7. 1006 oc edit svc bginx
  8. 1007 oc describe svc bginx
  9. 1008 oc edit svc bginx
  10. 1009 oc get svc
  11. 1010 oc expose -h | less
  12. 1011 oc expose svc bginx
  13. 1012 oc get svc,routes
  14. 1013 curl bginx-sccs.apps-crc.testing
  15. 1014 mkdir openssl
  16. 1015 cd openssl/
  17. 1016 rm -rf *
  18. 1017 openssl genrsa -des3 -out myCA.key 2048
  19. 1018 openssl req -x509 -new -nodes -key myCA.key -sha256 -days 3650 -out myCA.pem
  20. 1019 openssl genrsa -out tls.key 2048
  21. 1020 openssl req -new -key tls.key -out tls.csr
  22. 1021 openssl x509 -req -in tls.csr -CA myCA.pem -CAkey myCA.key -CAcreateserial -out tls.crt -days 1650 -sha256
  23. 1022 ls -l
  24. 1023 man openssl-genrsa
  25. 1024 man openssl-req
  26. 1025 man openssl-x509
  27. 1026 oc whoami
  28. 1027 oc new-project myproject
  29. 1028 oc projects
  30. 1029 oc login -u admin
  31. 1030 oc project myproject
  32. 1031 cd ../ex280
  33. 1032 ls
  34. 1033 cat linginx1.conf
  35. 1034 oc create cm linginx1 --from-file linginx1.conf
  36. 1035 oc create sa linginx-sa
  37. 1036 oc adm policy add-scc-to-user-anyuid -z linginx-sa
  38. 1037 oc adm policy add-scc-to-user anyuid -z linginx-sa
  39. 1038 vim linginx-v1.yaml
  40. 1039 oc create -f linginx-v1.yaml
  41. 1040 oc get pods
  42. 1041 oc get svc
  43. 1042 oc create route -h | less
  44. 1043 oc create route edge -h | less
  45. 1044 oc create route edge linginx1 --service linginx1 --cert=../openssl/tls.crt --key=../openssl/tls.key --ca-cert=../openssl/myCA.pem
  46. 1045 oc get routes
  47. 1046 curl -svv https://linginx1-myproject.apps-crc.testing
  48. 1047 curl -skvv https://linginx1-myproject.apps-crc.testing
  49. 1048 curl -svv https://linginx1-myproject.apps-crc.testing
  50. 1049 history
  51. 1050 vim linginx-v1.yaml
  52. 1051 oc create -f linginx-v1.yaml
  53. 1052 kubectl get pods
  54. 1053 oc get pods
  55. 1054 oc describe pod linginx2-58544f444c-9jr7z
  56. 1055 oc create cm linginx2 --from-file linginx1.conf
  57. 1056 kubectl delete -f linginx-v1.yaml
  58. 1057 oc delete -f linginx-v1.yaml
  59. 1058 oc create -f linginx-v1.yaml
  60. 1059 oc get pods
  61. 1060 oc describe pod linginx2-58544f444c-cs87k
  62. 1061 oc delete -f linginx-v1.yaml
  63. 1062 vim linginx-v1.yaml
  64. 1063 oc create -f linginx-v1.yaml
  65. 1064 oc get pods
  66. 1065 #git clone https://github.com/sandervanvugt/ex280
  67. 1066 cd
  68. 1067 mkdir certificates
  69. 1068 cd certificates/
  70. 1069 openssl genrsa -des3 -out myCA.key 2048
  71. 1070 openssl req -x509 -new -nodes -key myCA.key -sha256 -days 3650 -out myCA.pem
  72. 1071 openssl genrsa -out tls.key 2048
  73. 1072 openssl req -new -key tls.key -out tls.csr
  74. 1073 openssl x509 -req -in tls.csr -CA myCA.pem -CAkey myCA.key -CAcreateserial -out tls.crt -days 1650 -sha256
  75. 1074 oc create secret tls linginx-certs --cert tls.crt --key tls.key
  76. 1075 oc get secret linginx-certs -o yaml
  77. 1076 cat ../ex280/default.conf
  78. 1077 oc create cm nginxconfigmap --from-file ../ex280/default.conf
  79. 1078 oc projects
  80. 1079 oc project default
  81. 1080 oc create secret tls linginx-certs --cert tls.crt --key tls.key
  82. 1081 oc create cm nginxconfigmap --from-file ../ex280/default.conf
  83. 1082 oc create sa linginx-sa
  84. 1083 oc adm policy add-scc-to-user anyuid -z linginx=sa
  85. 1084 oc adm policy add-scc-to-user anyuid -z linginx-sa
  86. 1085 cd ../ex280/
  87. 1086 vim linginx-v2.yaml
  88. 1087 oc delete -f linginx-v1.yaml
  89. 1088 vim linginx-v2.yaml
  90. 1089 oc create -f linginx-v2.yaml
  91. 1090 oc get pods
  92. 1091 oc get svc
  93. 1092 oc create route passthrough -h | less
  94. 1093 oc create route passthrough linginx --service linginx2 --port 8443
  95. 1094 oc delete route linginx
  96. 1095 oc create route passthrough linginx --service linginx2 --port 8443 --hostname=linginx=default.apps=crc.testing
  97. 1096 oc create route passthrough linginx --service linginx2 --port 8443 --hostname=linginx-default.apps-crc.testing
  98. 1097 oc get routes
  99. 1098 curl -svvk https://linginx-default.apps-crc.testing
  100. 1099 oc debug -t deployment/linginx2 --image registry.access.redhat.com/ubi8/ubi:8.0
  101. 1100 oc get svc
  102. 1101 oc debug -t deployment/linginx2 --image registry.access.redhat.com/ubi8/ubi:8.0
  103. 1102 oc get svc
  104. 1103 oc edit svc linginx2
  105. 1104 oc get svc
  106. 1105 crc ip
  107. 1106 curl -svvk https://192.168.130.11:32354
  108. 1107 crc ip
  109. 1108 oc get svc
  110. 1109 oc describe svc linginx2
  111. 1110 oc get endpoints
  112. 1111 history
  113. 1112 vim nwpolicy-complete-example.yaml
  114. 1113 oc new-project nwp
  115. 1114 oc create -f nwpolicy-complete-example.yaml
  116. 1115 oc get pods
  117. 1116 oc expose pod nginx --port=80
  118. 1117 oc exec -it busybox -- wget --spider --timeout=1 nginx
  119. 1118 oc get pods --show-labels
  120. 1119 oc label pod busybox access=true
  121. 1120 oc exec -it busybox -- wget --spider --timeout=1 nginx
  122. 1121 oc whoami
  123. 1122 oc new-project source-project
  124. 1123 oc label ns source-project type=incoming
  125. 1124 vim nginx-source1.yml
  126. 1125 oc create -f nginx-source1.yml
  127. 1126 vim nginx-source2.yml
  128. 1127 oc create -f nginx-source2.yml
  129. 1128 oc get pods
  130. 1129 oc new-project target-project
  131. 1130 oc remove ns target-project
  132. 1131 oc delete ns target-project
  133. 1132 oc login -u linda -p password
  134. 1133 oc new-project target-project
  135. 1134 oc new-app --name nginx-target --image quay.io/openshifttest/hello-openshift:openshift
  136. 1135 oc get pods -o wide
  137. 1136 oc login -u admin
  138. 1137 oc exec -it nginx-access -n source-project -- curl 10.217.0.162:8080
  139. 1138 oc exec -it nginx-noaccess -n source-project -- curl 10.217.0.162:8080
  140. 1139 vim nwpol-allow-specific.yaml
  141. 1140 oc apply -f nwpol-allow-specific.yaml
  142. 1141 oc exec -it -n source-project nginx-noaccess -- curl 10.217.0.162:8080
  143. 1142 oc exec -it -n source-project nginx-access -- curl 10.217.0.162:8080
  144. 1143 history
  145. 1144 oc whoami
  146. 1145 oc login -u linda
  147. 1146 oc new-project scheduleme
  148. 1147 oc create deploy simple --image=bitnami/nginx
  149. 1148 oc get all
  150. 1149 oc scale --replicas 4 deployment simple
  151. 1150 oc get all
  152. 1151 oc login -u admin -p password
  153. 1152 oc get nodes -L env
  154. 1153 oc label node crc-9ltqk-master-0 env=dev
  155. 1154 oc get nodes -L env
  156. 1155 oc login -u linda
  157. 1156 oc edit deployment simple
  158. 1157 oc get all
  159. 1158 oc get pods -o wide
  160. 1159 oc describe pod simple-76bfbc579c-8g5vh
  161. 1160 oc delete deployment simple
  162. 1161 oc get svc
  163. 1162 oc login -u admin -p password
  164. 1163 oc label node -l env-
  165. 1164 oc label node -l env env-
  166. 1165 oc new-app --name simple php~https://github.com/sandervanvugt/simpleapp
  167. 1166 oc get all
  168. 1167 oc autoscale deploy simple --min 5 --max 10 --cpu-percent 1
  169. 1168 oc get hpa
  170. 1169 oc get pods
  171. 1170 oc get all
  172. 1171 oc describe pod simple-8547c955d-dfz57
  173. 1172 oc get deploy -A
  174. 1173 oc delete deploy -n sccs bginx
  175. 1174 oc get deploy
  176. 1175 oc delete deployment -n target-project nginx-target
  177. 1176 oc get deploy -A
  178. 1177 oc delete deploy -n sccs sccnginx
  179. 1178 crc ssh
  180. 1179* oc get pods
  181. 1180 oc delete all
  182. 1181 oc delete all --all
  183. 1182 oc new-project nee
  184. 1183 oc create deploy nee --image=bitnami/nginx --replicas=3
  185. 1184 oc get pods
  186. 1185 oc set resources -h | less
  187. 1186 oc set resources deploy nee --request cpu=10m,memory=1Mi --limits cpu=20m,memory=5Mi
  188. 1187 oc set resources deploy nee --requests cpu=10m,memory=1Mi --limits cpu=20m,memory=5Mi
  189. 1188 oc get pods
  190. 1189 oc describe pod nee-7f547f8764-n7vx4
  191. 1190 oc set resources deploy nee --requests cpu=0m,memory=0Mi --limits cpu=0m,memory0Mi
  192. 1191 oc set resources deploy nee --requests cpu=0m,memory=0Mi --limits cpu=0m,memory=0Mi
  193. 1192 oc get all
  194. 1193 oc login -u admin
  195. 1194 oc describe ns nee
  196. 1195 oc top pods
  197. 1196 oc describe node crc-9ltqk-master-0
  198. 1197 oc adm top
  199. 1198 oc adm top pod
  200. 1199 oc whoami
  201. 1200 oc login -u linda
  202. 1201 oc new-project quota-testg
  203. 1202 oc create quota qtest --hard pods=3,cpu=100m,memory=500Mi
  204. 1203 oc login -u admin
  205. 1204 oc create quota qtest --hard pods=3,cpu=100m,memory=500Mi
  206. 1205 oc describe quota
  207. 1206 oc login -u linda
  208. 1207 oc create deploy bitginx --image=bitnami/nginx --replicas=3
  209. 1208 oc get all
  210. 1209 oc describe rs bitginx-5844b655d9
  211. 1210 oc set resources deploy bitginx --requests cpu=100m,memory=5Mi --limits cpu=200m,memory=20Mi
  212. 1211 oc get all
  213. 1212 oc describe quota
  214. 1213 oc login -u admin
  215. 1214 oc edit quota
  216. 1215 oc get all
  217. 1216 oc describe pod bitginx-b99bcc6dc-6cv6b
  218. 1217 oc get all
  219. 1218 history
  220. 1219 oc login -u admin
  221. 1220 oc new-project limits
  222. 1221 oc login -u admin
  223. 1222 oc explain limitrange.spec.limits
  224. 1223 vim limits.yaml
  225. 1224 oc apply -f limits.yaml
  226. 1225 oc get limitranges
  227. 1226 oc get limitranges -o yaml
  228. 1227 oc create deploy limited --image=nginx
  229. 1228 oc get deploy limited -o yaml | less
  230. 1229 oc describe limitranges limit-limits
  231. 1230 oc login -u admin
  232. 1231 oc adm taint nodes crc-9ltqk-master-0 key1=value1:NoSchedule
  233. 1232 oc run newpod --image=bitnami/nginx
  234. 1233 oc new-project new
  235. 1234 oc run newpod --image=bitnami/nginx
  236. 1235 oc get pods
  237. 1236 oc describe pod newpod
  238. 1237 oc edit pod newpod
  239. 1238 oc get pods
  240. 1239 oc adm taint node crc-9ltqk-master-0 key1-
  241. 1240 history
  242.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement