chrisluiz16

Day 14

Jun 6th, 2023
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.14 KB | None | 0 0
  1.  
  2.  
  3.  
  4. -------------------------------------------------------------- Task -1 -------------------------------------------
  5.  
  6.  
  7. [ec2-user@master ~]$ docker node ls
  8. ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
  9. pm6boa3ibinv3kmxkg0ac1v0x * master.ap-south-1.compute.internal Ready Active Leader 20.10.23
  10. 2r4aabr22xsqrouc0fp6266gg worker1.ap-south-1.compute.amazonaws.com Ready Active 20.10.23
  11. i6amddzp81hfg3gjxa1dbs4e2 worker2.ap-south-1.compute.amazonaws.com Ready Active 20.10.23
  12. j7p4b6wyarft4ml82f8plt7yl worker3.ap-south-1.compute.amazonaws.com Ready Active 20.10.23
  13. [ec2-user@master ~]$
  14. [ec2-user@master ~]$
  15. [ec2-user@master ~]$ docker service create \
  16. > --name web \
  17. > --replicas 4 \
  18. > -p 80:80 \
  19. > fujiclado/rolling-hello:green
  20. mc04i7wbvwfmi2u073d7zfauq
  21. overall progress: 4 out of 4 tasks
  22. 1/4: running [==================================================>]
  23. 2/4: running [==================================================>]
  24. 3/4: running [==================================================>]
  25. 4/4: running [==================================================>]
  26. verify: Service converged
  27.  
  28.  
  29.  
  30. -------------- Draining master ------------------
  31.  
  32.  
  33. [ec2-user@master ~]$ docker node update --availability drain master.ap-south-1.compute.internal
  34. master.ap-south-1.compute.internal
  35. [ec2-user@master ~]$
  36. [ec2-user@master ~]$
  37. [ec2-user@master ~]$ docker service ps web
  38. ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
  39. jmmvaalf62yw web.1 fujiclado/rolling-hello:green worker2.ap-south-1.compute.amazonaws.com Running Running about a minute ago
  40. mixkeb7o3zqr web.2 fujiclado/rolling-hello:green worker3.ap-south-1.compute.amazonaws.com Running Running about a minute ago
  41.  
  42. m4jvnl1vgfw6 web.3 fujiclado/rolling-hello:green worker1.ap-south-1.compute.amazonaws.com Running Running 5 seconds ago
  43.  
  44. l3tb58sm543c \_ web.3 fujiclado/rolling-hello:green master.ap-south-1.compute.internal Shutdown Shutdown 6 seconds ago
  45.  
  46. zmfeqbn1t3ur web.4 fujiclado/rolling-hello:green worker1.ap-south-1.compute.amazonaws.com Running Running about a minute ago
  47.  
  48.  
  49.  
  50.  
  51. --------------Pausing one worker --------------------
  52.  
  53.  
  54.  
  55. [ec2-user@master ~]$ docker node update --availability pause worker3.ap-south-1.compute.amazonaws.com
  56. worker3.ap-south-1.compute.amazonaws.com
  57. [ec2-user@master ~]$
  58. [ec2-user@master ~]$
  59. [ec2-user@master ~]$
  60. [ec2-user@master ~]$ docker service ps web
  61. ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
  62. jmmvaalf62yw web.1 fujiclado/rolling-hello:green worker2.ap-south-1.compute.amazonaws.com Running Running 3 minutes ago
  63. mixkeb7o3zqr web.2 fujiclado/rolling-hello:green worker3.ap-south-1.compute.amazonaws.com Running Running 3 minutes ago
  64. m4jvnl1vgfw6 web.3 fujiclado/rolling-hello:green worker1.ap-south-1.compute.amazonaws.com Running Running 2 minutes ago
  65. l3tb58sm543c \_ web.3 fujiclado/rolling-hello:green master.ap-south-1.compute.internal Shutdown Shutdown 2 minutes ago
  66. zmfeqbn1t3ur web.4 fujiclado/rolling-hello:green worker1.ap-south-1.compute.amazonaws.com Running Running 3 minutes ago
  67.  
  68. [ec2-user@master ~]$ docker service update --replicas 6 web
  69. web
  70. overall progress: 6 out of 6 tasks
  71. 1/6: running [==================================================>]
  72. 2/6: running [==================================================>]
  73. 3/6: running [==================================================>]
  74. 4/6: running [==================================================>]
  75. 5/6: running [==================================================>]
  76. 6/6: running [==================================================>]
  77. verify: Service converged
  78.  
  79. [ec2-user@master ~]$ docker service ps web
  80. ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
  81. jmmvaalf62yw web.1 fujiclado/rolling-hello:green worker2.ap-south-1.compute.amazonaws.com Running Running 5 minutes ago
  82. mixkeb7o3zqr web.2 fujiclado/rolling-hello:green worker3.ap-south-1.compute.amazonaws.com Running Running 5 minutes ago
  83. m4jvnl1vgfw6 web.3 fujiclado/rolling-hello:green worker1.ap-south-1.compute.amazonaws.com Running Running 4 minutes ago
  84. l3tb58sm543c \_ web.3 fujiclado/rolling-hello:green master.ap-south-1.compute.internal Shutdown Shutdown 4 minutes ago
  85. zmfeqbn1t3ur web.4 fujiclado/rolling-hello:green worker1.ap-south-1.compute.amazonaws.com Running Running 5 minutes ago
  86. 6wfngvpdif0f web.5 fujiclado/rolling-hello:green worker2.ap-south-1.compute.amazonaws.com Running Running 53 seconds ago
  87. muy48n3dledx web.6 fujiclado/rolling-hello:green worker2.ap-south-1.compute.amazonaws.com Running Running 53 seconds ago
  88.  
  89.  
  90.  
  91.  
  92. ----------- Removing service web -----------
  93.  
  94.  
  95. [ec2-user@master ~]$ docker service ls
  96. ID NAME MODE REPLICAS IMAGE PORTS
  97. mc04i7wbvwfm web replicated 6/6 fujiclado/rolling-hello:green *:80->80/tcp
  98. [ec2-user@master ~]$
  99. [ec2-user@master ~]$
  100. [ec2-user@master ~]$ docker service rm web
  101. web
  102. [ec2-user@master ~]$
  103. [ec2-user@master ~]$ docker service ls
  104. ID NAME MODE REPLICAS IMAGE PORTS
  105. [ec2-user@master ~]$
  106. [ec2-user@master ~]$
  107. [ec2-user@master ~]$
  108. [ec2-user@master ~]$ docker service ps web
  109. no such service: web
  110. [ec2-user@master ~]$
  111.  
  112.  
  113.  
  114.  
  115. ------------------------------------------------------- Task 2 --------------------------------------------------
  116.  
  117.  
  118.  
  119.  
  120. ----------Network Creation----------
  121.  
  122. [ec2-user@master ~]$ docker network create ip-geo --driver=overlay
  123. 1oem7xmo605s5zeyodt8l9hvo
  124. [ec2-user@master ~]$
  125. [ec2-user@master ~]$
  126. [ec2-user@master ~]$ docker network ls
  127. NETWORK ID NAME DRIVER SCOPE
  128. 0a310b2284e5 bridge bridge local
  129. fe1a0db7f8fa docker_gwbridge bridge local
  130. 47b7ee1d22f6 host host local
  131. q6xptqrcxmym ingress overlay swarm
  132. 1oem7xmo605s ip-geo overlay swarm
  133. 57cc6a515219 none null local
  134. [ec2-user@master ~]$
  135.  
  136.  
  137.  
  138. -------- Label ---------
  139.  
  140. [ec2-user@master ~]$ docker node ls
  141. ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
  142. pm6boa3ibinv3kmxkg0ac1v0x * master.ap-south-1.compute.internal Ready Drain Leader 20.10.23
  143. 2r4aabr22xsqrouc0fp6266gg worker1.ap-south-1.compute.amazonaws.com Ready Active 20.10.23
  144. i6amddzp81hfg3gjxa1dbs4e2 worker2.ap-south-1.compute.amazonaws.com Ready Active 20.10.23
  145. j7p4b6wyarft4ml82f8plt7yl worker3.ap-south-1.compute.amazonaws.com Ready Active 20.10.23
  146. [ec2-user@master ~]$
  147. [ec2-user@master ~]$
  148. [ec2-user@master ~]$ docker node update --label-add service=api-service worker1.ap-south-1.compute.amazonaws.com
  149. worker1.ap-south-1.compute.amazonaws.com
  150. [ec2-user@master ~]$
  151. [ec2-user@master ~]$
  152. [ec2-user@master ~]$ docker node update --label-add service=api-service worker2.ap-south-1.compute.amazonaws.com
  153. worker2.ap-south-1.compute.amazonaws.com
  154. [ec2-user@master ~]$
  155. [ec2-user@master ~]$
  156. [ec2-user@master ~]$ docker node update --label-add service=redis worker3.ap-south-1.compute.amazonaws.com
  157. worker3.ap-south-1.compute.amazonaws.com
  158. [ec2-user@master ~]$
  159. [ec2-user@master ~]$
  160.  
  161.  
  162. ---------- Service Creation ------------
  163.  
  164. [ec2-user@master ~]$ docker service create \
  165. > --name redis \
  166. > --network ip-geo \
  167. > --constraint node.labels.service==redis \
  168. > --replicas 1 \
  169. > redis:latest
  170. 39ya5gqbn3cnf5gtwvmqervoc
  171. overall progress: 1 out of 1 tasks
  172. 1/1: running [==================================================>]
  173. verify: Service converged
  174.  
  175.  
  176. [ec2-user@master ~]$ docker service create \
  177. > --name ip-api1 \
  178. > -p 8080:8080 \
  179. > --network ip-geo \
  180. > --constraint node.labels.service==api-service \
  181. > --replicas 4 \
  182. > -e REDIS_PORT="6379" \
  183. > -e REDIS_HOST="redis" \
  184. > -e APP_PORT="8080" \
  185. > -e API_KEY="48c444472b0840848c261f62abe32b0d" \
  186. > fujikomalan/ipgeolocation-api-service:latest
  187. overall progress: 4 out of 4 tasks
  188. 1/4: running [==================================================>]
  189. 2/4: running [==================================================>]
  190. 3/4: running [==================================================>]
  191. 4/4: running [==================================================>]
  192. verify: Service converged
  193.  
  194.  
  195. [ec2-user@master ~]$ docker service create \
  196. > --name ipip-frontend \
  197. > -p 9090:8080 \
  198. > --network ip-geo \
  199. > --constraint node.labels.service==api-service \
  200. > --replicas 4 \
  201. > -e API_SERVER="ip-api1" \
  202. > -e API_SERVER_PORT="8080" \
  203. > -e APP_PORT="8080" \
  204. > fujikomalan/ipgeolocation-frontend:latest
  205. g2s4vrkhyofeb3iv74p77u39f
  206. overall progress: 4 out of 4 tasks
  207. 1/4: running [==================================================>]
  208. 2/4: running [==================================================>]
  209. 3/4: running [==================================================>]
  210. 4/4: running [==================================================>]
  211. verify: Service converged
  212.  
  213.  
  214. [ec2-user@master ~]$ docker service ls
  215. ID NAME MODE REPLICAS IMAGE PORTS
  216. kn3jjpa9wfa3 ip-api1 replicated 4/4 fujikomalan/ipgeolocation-api-service:latest *:8080->8080/tcp
  217. g2s4vrkhyofe ip-frontend replicated 4/4 fujikomalan/ipgeolocation-frontend:latest *:9090->8080/tcp
  218. 39ya5gqbn3cn redis replicated 1/1 redis:latest
  219.  
  220.  
  221.  
Advertisement
Add Comment
Please, Sign In to add comment