Building and Deploying a Flask Microservice  on Kubernetes❄

Building and Deploying a Flask Microservice on Kubernetes❄

Deployment of a Flask Microservice

Installation

To get started with our microservice application, follow these installation steps:

  1. Clone the Repository: Begin by cloning the repository to your local machine. You can do this using the following command:

     git clone https://github.com/your-username/your-microservice.git
    

  2. Navigate to the Project Directory: Move to the project's root directory:

     cd your-microservice
    

  3. Create Kubernetes Deployment and Service: Deploy the microservice on your Kubernetes cluster by applying the provided kubernetes yaml file:

     kubectl apply -f kubernetes.yaml
    

  4. Verify Deployment: Confirm that the deployment and service have been created successfully by running the following command:

     kubectl get deployments,services
    

    If everything is set up correctly, you should see your deployment and service listed in the output.

    To check mongo DB is running or not (On Worker )

    After setting up outbound rules on the EC2 instance dashboard, we can now access the deployed flask app

  5. Now that your Flask microservice is up and running on Kubernetes, you can start using it. Here's how you can interact with the microservice

  6. Sending HTTP Requests: To utilize the microservice, you can send HTTP requests to its endpoint. For example, to retrieve tasks from the microservice, use a tool like curl with the following command:

     curl http://<service-ip>:<service-port>/tasks
    

    This will send a request to the microservice and return a JSON response containing a greeting message or relevant data.

With these installation and usage instructions, you've successfully deployed a Flask-based microservice on a Kubernetes cluster. This serves as a foundational example of how to build and deploy microservices in a containerized environment, making it easier to manage and scale your applications.

🚀 Stay tuned for more insightful Kubernetes blogs in the days ahead! 🎉

Thank you for joining us on completing this assignment in the 90 Days of DevOps challenge. I hope you found the information helpful and insightful.

So please keep yourself updated with my latest insights and articles on DevOps 🚀 by following me on :

Hashnode: vishaltoyou.hashcode.dev

LinkedIn: linkedin.com/in/vishalphadnis