Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI Weather Service - Debugging Challenge

Overview

This repository contains a FastAPI weather service that needs to be containerized and deployed to Kubernetes. However, there are several issues throughout the codebase that are preventing it from working correctly.

Your task is to:

  1. Write a Dockerfile, and build a docker image for the application
  2. Deploy it to a local Kubernetes cluster (minikube)
  3. Debug any issues you encounter
  4. Fix the problems
  5. Successfully deploy a working version of the application
  6. Debug the deployment if any issues arise

Prerequisites

Getting Started

File Structure

fastapi-weather-app/
├── README.md
├── app/
│   ├── main.py
│   ├── weather_data.py
│   └── requirements.txt
├── Dockerfile [missing]
└── kubernetes/
    └── deployment.yaml [with bugs]

Clone this repository and examine the code. The application is a simple weather API that provides forecasts for different cities.

Local Development

python -m venv venv
source venv/bin/activate
pip install -r app/requirements.txt
export DB_CONNECTION_STRING="postgresql://user:password@localhost:5432/weather_db"
cd app && python main.py

Challenges

1. Write a Dockerfile for the application

Create a Dockerfile in the root of the repository.

2. Deploying to minikube

  1. Start minikube:
minikube start
  1. Use minikube's Docker daemon:
eval $(minikube docker-env)  # On Windows: minikube docker-env | Invoke-Expression
  1. Build the image in minikube's environment:
docker xxx xxxxxx
  1. Deploy to Kubernetes:
kubectl xxx xxxxxx
  1. Check the deployment:
kubectl xxx xxxxxx
kubectl xxx xxxxxx

3. Debugging, Fix and redeploy

kubectl xxx xxxxxx

4. Test the application

curl $(minikube service weather-api-service --url)/health
curl $(minikube service weather-api-service --url)/weather/new%20york

5. Bonus

  1. Can you create a public namespace and deploy the application there? Instead of the default namespace.
  2. Can you use Helm & Helm Charts to deploy the application? If so, how?

Good luck!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages