DevSecOps - Kubernetes DevOps & Security

DevOps Pipeline

Understanding the Course Usecase

In this lesson, we’ll walk through our example architecture and the HTTP endpoints each service exposes. We have two simple Dockerized microservices:

  1. A Node.js service (runs on port 5000)
  2. A Spring Boot service (runs on port 8080)

Both services communicate via REST APIs, demonstrating best practices for containerization and orchestration.


Node.js Microservice (Port 5000)

This lightweight Node.js application is packaged in Docker and listens on port 5000. It offers a single endpoint:

GET /plusone/{number}

  • Function: Takes an integer and returns its value plus one.

  • Example Request:

    curl http://localhost:5000/plusone/41
    # 42
    

Note

Ensure Docker is running and the container is listening on port 5000 before invoking this endpoint.


Spring Boot Microservice (Port 8080)

The Spring Boot application exposes three REST endpoints on port 8080. It illustrates service-to-service calls and conditional logic.

EndpointDescriptionExample
GET /Returns a welcome messagecurl http://localhost:8080/
GET /increment/{number}Forwards {number} to Node.js /plusone endpoint and returns the incremented resultcurl http://localhost:8080/increment/4142
GET /compare/{number}Compares {number} against 50 and returns a descriptive messagecurl http://localhost:8080/compare/77"77 is greater than 50"

1. GET /

Returns a simple greeting from the Spring Boot service:

curl http://localhost:8080/
# "Welcome to the Spring Boot service!"

2. GET /increment/{number}

This endpoint demonstrates inter-service communication. It sends the provided number to the Node.js /plusone service and returns the incremented result.

curl http://localhost:8080/increment/41
# 42

3. GET /compare/{number}

Performs a conditional check on the input number:

  • If number ≤ 50: returns "{number} is less than or equal to 50".
  • If number > 50: returns "{number} is greater than 50".
curl http://localhost:8080/compare/50
curl http://localhost:8080/compare/77
# "77 is greater than 50"

Warning

Port conflicts can occur if other services use ports 5000 or 8080. Always verify available ports before starting the containers.


Course Roadmap

Throughout this course, you will:

  • Containerize and Dockerize the Spring Boot application.
  • Deploy Spring Boot securely on Kubernetes with best practices.
  • Leverage an existing Docker image for the Node.js service.
  • Explore service-to-service REST communication and error handling.

By the end, you’ll have a fully functioning microservices demo running on Kubernetes, complete with automated builds and deployments. Let’s dive in!


Watch Video

Watch video content

Previous
Demo Jenkins Pipeline Checking Versions