Skip to content

Containerization of a Node Microservice using Docker engine and further deployment/Orchestration using Google Kubernetes Engine (GKE).

Notifications You must be signed in to change notification settings

adarsh-k27r/microservice-k8s

Repository files navigation

Containerization of a Web Microservice using Docker and Kubernetes Orchestration

Introduction

Containerized Node microservice using Docker and then deployed it on Google Kubernetes Engine using the provided manifest files. This setup includes configurations for Pods, Deployments, and Services (NodePort and LoadBalancer).

Table of Contents

Prerequisites

  • Kubernetes cluster
  • kubectl configured to interact with your cluster

Manifests

  • Pod Manifest
    • Single instance of the application
    • Container specification with image and ports
    • Liveness and readiness probes for health checks
  • Deployment Manifest
    • Replica sets for high availability and scalability
    • Rolling updates strategy
    • Resource requests and limits
    • Liveness and readiness probes
  • NodePort Service Manifest
    • Exposes service on a static port across all nodes
    • Access via <NodeIP>:<NodePort>
  • LoadBalancer Service Manifest
    • External load balancer creation
    • Cloud provider-specific (e.g., AWS, GCP, Azure)
    • Access via external IP provided by the load balancer

Deployment Instructions

  1. Apply the manifests:

    kubectl apply -f pod.yaml
    kubectl apply -f deployment.yaml
    kubectl apply -f svc_np.yaml
    kubectl apply -f svc_lb.yaml
  2. Verify deployments and services:

    kubectl get pods
    kubectl get deployments
    kubectl get services

Accessing the Application

  • NodePort
    • Access the application using <NodeIP>:<NodePort>
    • Example: http://<NodeIP>:30001
  • LoadBalancer
    • Access the application using the external IP assigned by the load balancer
    • Example: http://<External-IP>:4000

Health Checks

  • Liveness Probe: /healthz
  • Readiness Probe: /readiness
  • Ensures the application is running and ready to serve traffic

Clean Up

  1. Delete the resources:
    kubectl delete -f pod.yaml
    kubectl delete -f deployment.yaml
    kubectl delete -f svc_np.yaml
    kubectl delete -f svc_lb.yaml

Contact

Adarsh Kumar @ 21cs3060@rgipt.ac.in

Project Status

Completed ✌️

Alert

Due to high incurring charges for Google Kubernetes Engine service at Google Cloud, The Web page has been taken down. However, I have provided the link to Docker image of the API.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

Distributed under the MIT License. See LICENSE for more information.