Skip to content

Latest commit

 

History

History
58 lines (32 loc) · 2.95 KB

Node_AmazonEks.md

File metadata and controls

58 lines (32 loc) · 2.95 KB

Logo

Node with Mongo in Kubernetes

Here we will see how to containerize Node and Mongo with persistent volume and communication between the containers on the Top of a Kubernetes Cluster.

Content

  1. Prerequisites
  2. Mongo with Amazon Eks
  3. Node with Amazon Eks

Prerequisites

  1. Docker
  2. Kubernetes CLI
  3. AWS CLI

Mongo with Amazon Eks

Make sure that you have kubernetes with Amazon Eks is ready to use.If not,use the previous document to setup the Amazon Eks.

Create a persistent volumes to avoid data loss that happens because of container's dead or stop.

To set up the persistent volume,create a mongo-persistentvolume.yaml file.

 $ kubectl apply -f mongo-persistentvolume.yaml

Kubernetes deployment is presented in a YAML format text file with all the configuration params that might be needed to run your application.

Create a mongo-deployment.yaml file, Let’s install the just created deployment into our Kubernetes cluster by using the specified command:

 $ kubectl apply -f mongo-deployment.yaml

In addition to pod creation via deployment, we need to create the Mongo service. The reason behind this is simple. To interact with a pod inside the Kubernetes cluster

Create a mongo-service.yaml file, you can run it inside the Kubernetes container by using this command:

 $ kubectl apply -f mongo-service.yaml

To check the installation by using this commands,

 $ kubectl get service

Node with Amazon Eks

Create a node-deployment.yaml file, Let’s install the just created deployment into our Kubernetes cluster by using the specified command:

 $ kubectl apply -f node-deployment.yaml

In addition to pod creation via deployment, we need to create the Node service. The reason behind this is simple. To interact with a pod inside the Kubernetes cluster

Create a mongo-service.yaml file, you can run it inside the Kubernetes container by using this command:

 $ kubectl apply -f node-service.yaml

To check the installation by using this commands,

 $ kubectl get service