Skip to main content

Installing Microservices on a Kubernetes Cluster

Hands-On Lab

 

Photo of Matthew Pearson

Matthew Pearson

Linux Training Architect II in Content

Length

01:00:00

Difficulty

Intermediate

One of the biggest benefits of Kubernetes is the ability to quickly deploy containers and group them into their own namespaces. In this hands-on lab, we will install a group of microservices that mimics a real-life deployment stack. A working Kubernetes cluster has already been set up for us. We will use this cluster to install several microservices grouped into namespaces.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Installing Microservices on a Kubernetes Cluster

Introduction

One of the biggest benefits of Kubernetes is the ability to quickly deploy containers and group them into their own namespaces. In this hands-on lab, we will install a group of microservices that mimics a real-life deployment stack. A working Kubernetes cluster has already been set up for us. We will use this cluster to install several microservices grouped into namespaces.

Connecting to the Lab

  1. Open your terminal application, and run the following command (remember to replace <PUBLIC_IP> with the public IP you were provided on the lab instructions page):
    ssh cloud_user@<PUBLIC_IP>
  2. Type yes at the prompt.
  3. Enter your cloud_user password at the prompt.

Create Two Namespaces

  1. Create the dev namespace.
    kubectl create namespace dev
  2. Create the test namespace.
    kubectl create namespace test
  3. Verify that the two namespaces were successfully created.
    kubectl get namespaces

Install an Apache HTTP Server, an Apache Tomcat Server, and a MongoDB Database on the dev Namespace

  1. Install the Apache HTTP server on the dev namespace.
    kubectl create deployment httpd-dev --image=httpd -n dev
  2. Install the Apache Tomcat server on the dev namespace.
    kubectl create deployment tomcat-dev --image=httpd -n dev
  3. Install the MongoDB database on the dev namespace.
    kubectl create deployment mongo-dev --image=mongo -n dev
  4. Verify that the pods in the dev namespace are up and running.
    kubectl get pods -n dev
  5. Check the status of the pods in all namespaces.
    kubectl get pods --all-namespaces

Install an Apache HTTP Server, an Apache Tomcat Server, and a MongoDB Database on the test Namespace

  1. Install the Apache HTTP server on the test namespace.
    kubectl create deployment httpd-test --image=httpd -n test
  2. Install the Apache Tomcat server on the test namespace.
    kubectl create deployment tomcat-test --image=tomcat -n test
  3. Install the MongoDB database on the test namespace.
    kubectl create deployment mongo-test --image=mongo -n test
  4. Verify that the pods in the test namespace are up and running.
    kubectl get pods -n test
  5. Check the status of the pods in all namespaces.
    kubectl get pods --all-namespaces

Conclusion

Congratulations, you've successfully completed this hands-on lab!