{"id":22428524,"url":"https://github.com/kwame-mintah/python-fastapi-azure-k8s-cluster","last_synced_at":"2026-04-11T19:04:06.721Z","repository":{"id":211982964,"uuid":"730425834","full_name":"kwame-mintah/python-fastapi-azure-k8s-cluster","owner":"kwame-mintah","description":"[[ 🔷 Mirrored from Azure DevOps 🔷]] Build and push a FastAPI docker image to Azures Container Registry (ACR) and deploy the application to Azure Kubernetes Cluster (AKS).","archived":false,"fork":false,"pushed_at":"2023-12-11T23:23:53.000Z","size":88,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T06:45:13.494Z","etag":null,"topics":["azure-devops","azure-pipeline","docker","fastapi","kubernetes","mirrored","python312"],"latest_commit_sha":null,"homepage":"","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/kwame-mintah.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2023-12-11T22:37:58.000Z","updated_at":"2024-01-17T06:03:44.000Z","dependencies_parsed_at":"2023-12-11T23:38:56.116Z","dependency_job_id":"518058c6-3980-4f3a-bf88-f8e9252fce62","html_url":"https://github.com/kwame-mintah/python-fastapi-azure-k8s-cluster","commit_stats":null,"previous_names":["kwame-mintah/python-fastapi-azure-k8s-cluster"],"tags_count":2,"template":false,"template_full_name":"kwame-mintah/python-fastapi-bigger-applications-template","purl":"pkg:github/kwame-mintah/python-fastapi-azure-k8s-cluster","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwame-mintah%2Fpython-fastapi-azure-k8s-cluster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwame-mintah%2Fpython-fastapi-azure-k8s-cluster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwame-mintah%2Fpython-fastapi-azure-k8s-cluster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwame-mintah%2Fpython-fastapi-azure-k8s-cluster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kwame-mintah","download_url":"https://codeload.github.com/kwame-mintah/python-fastapi-azure-k8s-cluster/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kwame-mintah%2Fpython-fastapi-azure-k8s-cluster/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275055096,"owners_count":25397578,"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","status":"online","status_checked_at":"2025-09-14T02:00:10.474Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["azure-devops","azure-pipeline","docker","fastapi","kubernetes","mirrored","python312"],"created_at":"2024-12-05T20:15:05.669Z","updated_at":"2025-12-30T21:24:28.151Z","avatar_url":"https://github.com/kwame-mintah.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python FastAPI Azure K8S Cluster\n\n![fastapi-0.103.2-informational](https://img.shields.io/badge/fastapi-0.103.2-informational)\n\u003ca href=\"https://github.com/new?template_name=python-fastapi-bigger-applications-template\u0026template_owner=kwame-mintah\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/use%20this-template-blue?logo=github\"\u003e\n\u003c/a\u003e\n[![Build Status](https://dev.azure.com/k-space/k/_apis/build/status%2Fdocker-k8s-cluster-deploy?branchName=main)](https://dev.azure.com/k-space/k/_build/latest?definitionId=10\u0026branchName=main)\n\nThis project demonstrates deploying a FastAPI application onto an Azure Kubernetes Cluster. Azure Pipelines\nhave been created to build and push the service docker image to an Azure Container Registry. And also deploy the service\nto a Kubernetes cluster. Azure resources created have been written in Terraform can be found in Azure DevOps repository\n[here](https://dev.azure.com/k-space/k/_git/k-infrastructure-terraform) [^1].\n\n\u003e [!NOTE]\n\u003e\n\u003e This repository was original created within Azure DevOps and is now being mirrored to this GitHub [repository](https://github.com/kwame-mintah/python-fastapi-azure-k8s-cluster).\n\u003e Source of truth will always be the Azure DevOps [repository](https://dev.azure.com/k-space/k/_git/python-fastapi-azure-k8s-cluster).\n\n## Usage\n\n1. Install python packages used for the service\n\n   ```console\n   pip install - requirements.txt\n   ```\n\n2. Run the FastAPI server, which will run on port 8000\n\n   ```console\n   python app/main.py\n   ```\n\n   Endpoint documentation are available on http://127.0.0.1:8000/docs\n\n## Docker\n\nRunning the `docker-compose.yml`, will build a new image python-fastapi-azure-k8s-cluster-fastapi:latest which will be used for the `fastapi` service\nwithin the container.\n\n```commandline\ndocker-compose up -d\n```\n\n## Tests\n\nUnit tests are located in `/tests` directory.\n\n```console\npytest tests/\n```\n\n## Azure Pipelines (CI/CD)\n\nThis project has two pipelines see files:\n- `/azure-pipelines-docker-k8s-deploy.yml`\n- `/azure-pipelines-run-unit-tests.yml`\n\nThe tables below detail pipeline variables required, most of the values required for deploying FastAPI to Azure Kubernetes cluster, can be found with\nthe terraform repository [here](https://dev.azure.com/k-space/k/_git/k-infrastructure-terraform). Additionally, as the orginasation / projected created,\nwithin Azure DevOps is private, these pipelines have been written to run on a [self-host build agent](https://github.com/kwame-mintah/azuredevops-selfhosted-agents-docker-compose) so YMMV.\n\n### Pipeline variables (docker-k8s-deploy)\n\n| Variable                               | Description                                                                   | Default value | Required? |\n|----------------------------------------|-------------------------------------------------------------------------------|---------------|-----------|\n| projectAzureSubscriptionConnection     | The Azure Resource Manager service connection ID                              | N/A           | Yes       |\n| projectAzureResourceGroup              | The Azure resource group were the cluster exists in                           | N/A           | Yes       |\n| projectKubernetesCluster               | The Azure kubernetes cluster name                                             | N/A           | Yes       |\n| projectImagePullSecret                 | The Kubernetes secret name to be generated / used for pulling images from ACR | N/A           | Yes       |\n| k8sNamespace                           | The Kubernetes name space to deploy the service                               | default       | No        |\n| projectPoolName                        | The Azure agent pool that the job will run on                                 | N/A           | Yes       |\n| projectContainerRegistry               | The Azure container registry login server                                     | N/A           | Yes       |\n| projectDockerRegistryServiceConnection | The service connection with Docker Registry (using basic authentication)      | N/A           | Yes       |\n| projectImageRepository                 | The docker image name to push to registry                                     | N/A           | Yes       |\n\n### Pipeline variables (run-unit-tests)\n\n| Variable        | Description                                   | Default value | Required? |\n|-----------------|-----------------------------------------------|---------------|-----------|\n| projectPoolName | The Azure agent pool that the job will run on | N/A           | Yes       |\n\n[^1]: My Azure DevOps organisation / project is private, terraform repository is mirrored [here](https://github.com/kwame-mintah/terraform-azurerm-kubernetes-cluster) in GitHub.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwame-mintah%2Fpython-fastapi-azure-k8s-cluster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkwame-mintah%2Fpython-fastapi-azure-k8s-cluster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkwame-mintah%2Fpython-fastapi-azure-k8s-cluster/lists"}