This repository contains a simple Flask application that returns the current server time. The application is containerized using Docker, making it easy to deploy to Kubernetes.
- Language: Python 3
- Framework: Flask
- Docker Base Image: python:3.5
These instructions will cover usage information and for the docker container
In order to run this container you'll need docker installed.
To build the image from the Dockerfile:
docker build -t USERNAME/sample-timeapp:latest .
Replace USERNAME
with your Docker Hub username.
Run the image from the Docker registry:
docker run --name sample-time-app -p 8080:8080 -d USERNAME/sample-timeapp:latest
Visit http://localhost:8080/time
to view the current time.
PORT
- The port the server listens to (default8080
)
To deploy this application to a Kubernetes cluster, use the following commands:
kubectl create deployment sample-time-app --image=docker.io/USERNAME/sample-timeapp:latest
kubectl expose deployment sample-time-app --type="NodePort" --port 8080
Check the deployment and service:
kubectl get deployments
kubectl get services
Access the application via http://<IP>:<NodePort>
.