Helm-Istio-Microservice-App-deploy

πŸš€ Microservice Application with Helm, Istio, and Kubernetes

Welcome to the Microservice Application, a modern, cloud-native system featuring three interconnected services: order-service, payment-service, and user-service. Built with FastAPI 🐍, containerized using Docker 🐳, and deployed on Kubernetes ☸️ with Helm for package management and Istio for service mesh capabilities, this application showcases scalable microservice architecture with advanced traffic management, observability, and security.

πŸ“‹ Repository Structure

πŸ› οΈ Microservices Overview

  1. Order Service πŸ“¦:
    • Function: Manages order creation, retrieval, and updates.
    • Interactions: Communicates with payment-service for payment processing and user-service for user validation.
    • API: RESTful endpoints (e.g., /orders).
  2. Payment Service πŸ’³:
    • Function: Processes payments and tracks transaction status (mocked for demo purposes).
    • Interactions: Confirms payments with order-service.
    • API: RESTful endpoints (e.g., /payments).
  3. User Service πŸ‘€:
    • Function: Manages user profiles, authentication, and authorization.
    • Interactions: Provides user data to order-service.
    • API: RESTful endpoints (e.g., /users).

Each service is built with FastAPI, containerized with Docker, and deployed as Kubernetes pods managed by Helm charts.

🌐 System Architecture

The application leverages a microservice architecture where:

The Kiali console visualizes these interactions, showing traffic flow between services and MongoDB: image

βœ… Prerequisites

Ensure the following are set up before deployment:

πŸš€ Deployment Instructions

The deployment.sh script automates the setup and deployment process. Follow these steps:

  1. Clone the Repository:
    git clone <repository-url>
    cd <repository-directory>
    
  2. Make the Script Executable:
    chmod +x deployment.sh
    
  3. Run the Deployment Script:
    ./deployment.sh
    

What the Script Does

🌐 Accessing the Application

Example API Calls

Below are example API calls with their expected outputs, as shown in the provided screenshots.

  1. Create a User πŸ‘€:
    curl -X POST http://microservice-gateway.k8s.dns/users/ \
    -H "Content-Type: application/json" \
    -d '{"name":"John Doe","email":"john@example.com"}' | jq
    
    curl -X POST http://microservice-gateway.k8s.dns/users/ \
    -H "Content-Type: application/json" \
    -d '{"name":"Omkar","email":"shelke"}' | jq
    

    Output: Creates users and stores them in MongoDB. User Creation Output

  2. List Users πŸ“‹:
    curl -X GET http://microservice-gateway.k8s.dns/users/ | jq
    

    Output: Displays a list of created users. User List Output

  3. Create an Order πŸ“¦:
    curl -X POST http://microservice-gateway.k8s.dns/orders/ \
    -H "Content-Type: application/json" \
    -d '{"user_id":"686aa16b1858e2c497a1cd93","product":"Laptop","amount":999.99}' | jq
    

    Output: Creates an order linked to a user. Order Creation Output

  4. List Orders πŸ“‹:
    curl -X GET http://microservice-gateway.k8s.dns/orders/ | jq
    

    Output: Shows orders associated with user IDs. Order List Output

  5. Process a Payment πŸ’³:
    curl -X POST http://microservice-gateway.k8s.dns/payments/ \
    -H "Content-Type: application/json" \
    -d '{"order_id":"686aa21c9fb5eb202be21db8","amount":999.99,"status":"successful"}' | jq
    

    Output: Confirms payment for an order. Payment Creation Output

  6. List Payments πŸ“‹:
    curl -X GET http://microservice-gateway.k8s.dns/payments/ | jq
    

    Output: Displays payment records. Payment List Output

πŸ” Observability with Istio

Istio provides robust observability through integration with Kiali, Prometheus, and Jaeger. The Kiali console visualizes service-to-service communication and interactions with MongoDB in the mongo namespace, offering insights into traffic flow and dependencies.

image

βš™οΈ Customization

πŸ“œ License

This project is licensed under the MIT License. See the LICENSE file for details.

🎯 Conclusion

The Microservice Application demonstrates a robust, scalable, and secure cloud-native architecture, leveraging FastAPI, Docker, Kubernetes, Helm, and Istio. With automated deployment via deployment.sh, seamless service interactions, and powerful observability through Kiali, this project serves as an excellent foundation for building and deploying microservices. The included API examples and visualizations (via Kiali) showcase its functionality, making it ideal for developers exploring modern microservice patterns or deploying production-ready systems. Contributions and feedback are encouraged to further enhance this project! πŸš€