Nrejve

Lab2soln

Jan 5th, 2021
30
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Deploying a Microservice Application to Kubernetes
  2. Introduction
  3. Microservice applications can be quite complex but that complexity can offer many benefits. Kubernetes can help you take advantage of those benefits by making these complex infrastructures easier to manage through automation. In this hands-on lab, you will see the value of Kubernetes firsthand as you deploy a complex microservice architecture to the cluster and then independently scale some of its components.
  4.  
  5. Solution
  6. Begin by logging in to the lab server using the credentials provided on the hands-on lab page:
  7.  
  8. ssh cloud_user@PUBLIC_IP_ADDRESS
  9. Deploy the Stan's Robot Shop app to the cluster
  10. Clone the Git repo that contains the pre-made descriptors:
  11.  
  12. cd ~/
  13. git clone https://github.com/linuxacademy/robot-shop.git
  14. Since this application has many components, it is a good idea to create a separate namespace for the app:
  15.  
  16. kubectl create namespace robot-shop
  17. Deploy the app to the cluster:
  18.  
  19. kubectl -n robot-shop create -f ~/robot-shop/K8s/descriptors/
  20. Check the status of the application's pods:
  21.  
  22. kubectl get pods -n robot-shop
  23. You should be able to reach the robot shop app from your browser using the Kube master node's public IP:
  24. http://$kube_master_public_ip:30080
  25.  
  26. Scale up the MongoDB deployment to two replicas instead of just one
  27. Edit the deployment descriptor:
  28.  
  29. kubectl edit deployment mongodb -n robot-shop
  30. You should see some YAML describing the deployment object.
  31.  
  32. Under spec:, look for the line that says replicas: 1 and change it to replicas: 2.
  33. Save and exit.
  34. Check the status of the deployment with:
  35.  
  36. kubectl get deployment mongodb -n robot-shop
  37. After a few moments, the number of available replicas should be 2.
  38.  
  39. Conclusion
  40. Congratulations — you've completed this hands-on lab!
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×