{"id":19143237,"url":"https://github.com/devenes/kubernetes-microservice-app","last_synced_at":"2025-05-07T00:14:21.198Z","repository":{"id":107131228,"uuid":"492083671","full_name":"devenes/kubernetes-microservice-app","owner":"devenes","description":"Phonebook Microservice Web Application aims to create a web application with MySQL Database using Docker and Kubernetes to have the understanding of Microservice architecture.","archived":false,"fork":false,"pushed_at":"2022-05-15T10:44:23.000Z","size":440,"stargazers_count":7,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T00:14:05.948Z","etag":null,"topics":["backend","cloudformation","cloudformation-template","docker","docker-hub","flask","github","kubernetes","microservice","microservice-architecture","mysql","python","volume-claim"],"latest_commit_sha":null,"homepage":"https://devenes.github.io/kubernetes-microservice-app/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devenes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-14T01:31:11.000Z","updated_at":"2025-05-05T03:36:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"82181ecf-6566-4e68-8cae-418fde900a81","html_url":"https://github.com/devenes/kubernetes-microservice-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenes%2Fkubernetes-microservice-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenes%2Fkubernetes-microservice-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenes%2Fkubernetes-microservice-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenes%2Fkubernetes-microservice-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devenes","download_url":"https://codeload.github.com/devenes/kubernetes-microservice-app/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252788535,"owners_count":21804284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","cloudformation","cloudformation-template","docker","docker-hub","flask","github","kubernetes","microservice","microservice-architecture","mysql","python","volume-claim"],"created_at":"2024-11-09T07:30:04.027Z","updated_at":"2025-05-07T00:14:21.170Z","avatar_url":"https://github.com/devenes.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Docker Deployment for Web Server](https://github.com/devenes/kubernetes-microservice-app/actions/workflows/dockerx_web.yml/badge.svg)](https://github.com/devenes/kubernetes-microservice-app/actions/workflows/dockerx_web.yml) [![Docker Deployment for Result Server](https://github.com/devenes/kubernetes-microservice-app/actions/workflows/dockerx_result.yml/badge.svg)](https://github.com/devenes/kubernetes-microservice-app/actions/workflows/dockerx_result.yml)\n\n# Microservice Architecture for Python Flask Phonebook Web Application with MySQL using Kubernetes\n\n## Description\n\nPhonebook Microservice Web Application aims to create a web application with MySQL Database using Docker and Kubernetes to have the understanding of Microservice architecture. In this application, we have a frontend service and a backend service to interact with database service. Each service will be managed by a Kubernetes deployment. The backend service will be a gateway for the application and it will serve the necessary web pages for create, delete and update operations while the frontend service will serve a search page in order to conduct read operations. To preserve the data in the database, persistent volume and persistent volume claim concepts should be adopted.\n\n## Project Architecture\n\n![Project](./readme/microservice_structure.jpg)\n\n## Case Study Details\n\n- Your team has started working on a project to create a `Phonebook` Application as Web Service.\n\n- Software Developers in your team have already developed first version of `Phonebook` application. They have designed a database to keep phonebook records with following fields.\n\n| Field    | Description                                                                       |\n| -------- | --------------------------------------------------------------------------------- |\n| `id`     | Unique identifier for records, data type is integer and it will be auto increment |\n| `name`   | Name of record, data type is string                                               |\n| `number` | Phone number belonging to the recorded person                                     |\n\n- Your teammates also created the RESTful web service as given in [Phonebook API](./web_server/app.py) using Python Flask Framework. Below table shows how the HTTP methods are designed to affect the given resources identified by URIs.\n\n| HTTP Method | Action                    | Example                            |\n| ----------- | ------------------------- | ---------------------------------- |\n| `GET`       | Read the records          | http://[ec2-hostname]:30001/       |\n| `POST`      | Create a new record       | http://[ec2-hostname]:30001/add    |\n| `POST`      | Update an existing record | http://[ec2-hostname]:30001/update |\n| `POST`      | Delete an existing record | http://[ec2-hostname]:30001/delete |\n| `POST`      | Delete a resource         | http://[ec2-hostname]:30002        |\n\n- As a DevOps engineer, you're requested to deploy the app on an AWS EC2 Instance using Docker and Kubernetes to showcase your project. In order to achieve this goal, you need to;\n\n  - Pull the application code from GitHub repo of your team.\n\n  - Create two docker images for create/update/delete and search pages using `Dockerfile`s.\n\n  - Deploy the app using `Kubernetes`. To do so;\n\n    - Create a database service using MySQL.\n\n    - Use a custom network for the services.\n\n- In the Kubernetes environment, you will configure three deployements with their services and a persistent volume for MySQL deployments. You can find the definitions below for the objects you should create:\n\n1. 1. CREATE-DELETE-UPDATE DEPLOYMENT\n\n- Deployment definition file should configure create/delete/update operations with one or more replicas.\n- Expose the container port on `port 80`.\n- Deployment definition file should set the proper Environmental Variables for the db connection.\n- Passwords should be protected by kubernetes-secrets.\n- Database Host's value should be defined in the deployment using Kubernetes-ConfigMap.\n\n1. 2. CREATE/DELETE/UPDATE SERVICE\n\n- This service should be attached to `CREATE/DELETE/UPDATE Deployment`.\n- Service type should be NodePort published on `port:30001`.\n- Expose the port and target port on port `80`.\n\n2. 1. SEARCH DEPLOYMENT\n\n- Deployment definition file should configure search operations with one or more replicas.\n- Expose the container port on `port 80`.\n- Deployment definition file should set the proper Environmental Variables for the db connection.\n- Passwords should be protected by kubernetes-secrets.\n- Database Host's value should be defined in the deployment using Kubernetes-ConfigMap.\n\n2. 2. SEARCH SERVICE\n\n- This service should be attached to `SEARCH Deployment`.\n- Service type should be NodePort published on `port:30002`.\n- Expose the port and target port on port `80`.\n\n3. 1. DATABASE DEPLOYMENT\n\n- Deployment should use mysql:5.7 image pulled from Docker hub.\n- Expose the container port on `port 3306`.\n- Deployment definition file should set the proper Environmental Variables.\n- Persistent volume should be attached to this deployment.\n- Passwords should be protected by kubernetes-secrets.\n\n3. 2. DATABASE SERVICE\n\n- This service should be attached to `DATABASE Deployment`.\n- Service type should be ClusterIP.\n- Expose the port and target port on port `3306`.\n\n3. 3. Persistent Volume\n\n- Volume capacity should be set as `20Gi`.\n- Access Mode should be set as `ReadWriteOnce`.\n- Host path should be set as `/mnt/data`.\n- To be able to attache this volume, a persistent volume claim should be defined.\n\n4. 1. Kubernetes Environment\n\n- Assign two EC2 machines as the project's infrastructure. One should be configured as the master and the other should be configured as the worker.\n\n- Minimum `t2.medium` instance type should be selected.\n\n- The Web Application should be accessible via web browser from anywhere.\n\n- The Application files should be downloaded from Github repo and deployed on EC2 Instance using user data script within CloudFormation Template.\n\n## DockerHub Repository\n\n![DockerHub](./readme/docker_hub1.jpg)\n\n![DockerHub](./readme/docker_hub2.jpg)\n\n### At the end of the project, following topics are to be covered;\n\n- MySQL Database Configuration\n\n- Docker Images\n\n- Kubernetes architecture configuration\n\n- AWS EC2 Service\n\n- AWS Security Group Configuration\n\n- Git \u0026 GitHub for Version Control System\n\n- AWS CloudFormation Service\n\n### At the end of the project, you will be able to;\n\n- configure a connection to the `MySQL` database.\n\n- build Docker images.\n\n- configure Kubernetes to run Python Flask app.\n\n- improve network skills using `service` objects in Kubernetes\n\n- configure AWS EC2 Instance and Security Groups.\n\n- use git commands (push, pull, commit, add etc.) and Github as Version Control System.\n\n- run the web application on AWS EC2 instance using the GitHub repo as codebase.\n\n- build a Kubernetes infrastructure using CloudFormation.\n\n## Resources\n\n- [Kubernetes Documentations](https://kubernetes.io/docs/home/)\n\n- [Docker Hub](https://hub.docker.com/)\n\n- [Docker](https://www.docker.com/)\n\n- [Helm](https://helm.sh/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevenes%2Fkubernetes-microservice-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevenes%2Fkubernetes-microservice-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevenes%2Fkubernetes-microservice-app/lists"}