sleeping-barber / k8s-emptyDir

simple emptyDir volume example using SSE

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple emptyDir volume example using SSE

Description

Example of emptyDir volume sharing between two containers within a Pod. A file will be created with the current timestamp by the producer and the consumer is a web server which is reading the file every second.

Through Server Sent Events and a basic web page the current value is show to the user and pushed on every change.

Running through Docker-Compose

Within the root folder simply run:

docker-compose up --build --detach consumer producer

The web server can now be reached through localhost:8080.

To shutdown the system run following command:

docker-compose down

Running within a local Kubernetes

  • Build both container images by running following commands from the root folder:
docker build -t consumer:latest consumer/.
docker build -t producer:latest producer/.

Apply the provided manifest files within the k8s folder:

kubectl apply -f k8s/

Forward the port to the created service:

kubectl port-forward svc/k8s-emptydir 8080:8080

The web server can now be reached through localhost:8080.

To shutdown the system run following command:

kubectl delete -f k8s/

About

simple emptyDir volume example using SSE


Languages

Language:Go 56.7%Language:HTML 28.0%Language:Dockerfile 15.3%