{"id":16895896,"url":"https://github.com/stevenacoffman/flask_kubernetes_example","last_synced_at":"2026-04-09T08:02:01.524Z","repository":{"id":91320986,"uuid":"105309528","full_name":"StevenACoffman/flask_kubernetes_example","owner":"StevenACoffman","description":"Simple Kubernetes Flask application","archived":false,"fork":false,"pushed_at":"2023-08-25T00:39:52.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T05:40:08.575Z","etag":null,"topics":["docker","flask","kubernetes","prometheus","python"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/stevenacoffman/flask_kubernetes_example/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StevenACoffman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-09-29T19:29:17.000Z","updated_at":"2023-05-02T12:53:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"494611c3-402a-4111-9a66-b138593ee804","html_url":"https://github.com/StevenACoffman/flask_kubernetes_example","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/StevenACoffman%2Fflask_kubernetes_example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenACoffman%2Fflask_kubernetes_example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenACoffman%2Fflask_kubernetes_example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenACoffman%2Fflask_kubernetes_example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StevenACoffman","download_url":"https://codeload.github.com/StevenACoffman/flask_kubernetes_example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244592051,"owners_count":20477836,"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":["docker","flask","kubernetes","prometheus","python"],"created_at":"2024-10-13T17:26:50.884Z","updated_at":"2026-04-09T08:01:56.496Z","avatar_url":"https://github.com/StevenACoffman.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example Flask app with Prometheus on Kubernetes\n\nSee ``src`` for the application code.\n\nNote: Adapted for Kubernetes from Swarm example code here: [python-prometheus-demo](https://github.com/amitsaha/python-prometheus-demo/). Original [swarm prometheus article](https://blog.codeship.com/monitoring-your-synchronous-python-web-applications-using-prometheus/?utm_content=58060028\u0026utm_medium=social\u0026utm_source=twitter) here.\n\nRun this locally in docker:\n```bash\ndocker run -p 8888:8888 stevenacoffman/flask_kubernetes_example\n```\n\nApply this to your Kubernetes cluster (Note: cluster not included):\n```bash\nkubectl apply -f flask-example.yaml\n```\n\n## Building Docker image\n\nThe Python 3 based [Dockerfile](Dockerfile) uses an Alpine Linux base image\nand expects the application source code to be volume mounted at `/application`\nwhen run:\n\n```\nFROM python:3.6.1-alpine\nADD . /application\nWORKDIR /application\nRUN set -e; \\\n\tapk add --no-cache --virtual .build-deps \\\n\t\tgcc \\\n\t\tlibc-dev \\\n\t\tlinux-headers \\\n\t; \\\n\tpip install -r src/requirements.txt; \\\n\tapk del .build-deps;\nEXPOSE 8888\nVOLUME /application\nCMD uwsgi --http :8888  --manage-script-name --mount /application=flask_app:app --enable-threads --processes 5\n```\n\nThe last statement shows how we are running the application via `uwsgi` with 5\nworker processes.\n\nTo build the image:\n\n```\n$ docker build -t stevenacoffman/flask_kubernetes_example .\n```\n\n## Running the application\n\nWe can just run the web application as follows:\n\n```\n$ docker run  -ti -p 8888:8888 stevenacoffman/flask_kubernetes_example\n```\n\n## Running the application via Docker compose\n\nSee the compose directory for a way to run the flask app and a prometheus server locally via docker compose\n\n## Running the application via Kubernetes\n\n```\n$ kubectl apply -f flask-k8s.yaml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevenacoffman%2Fflask_kubernetes_example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevenacoffman%2Fflask_kubernetes_example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevenacoffman%2Fflask_kubernetes_example/lists"}