k8s-click-counter

module
v0.0.0-...-37b0da2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2019 License: Apache-2.0

README

k8s-click-counter

K8s-click-counter is a demo application, can be used for the Kubernetes workshops.

This demo app runs across two containers:

  • backend - a Go REST API which serves the click's count.
  • fronend - a simple Go web application calls the backend REST API /api/counter

Running

Docker
  • click-counter-backend
cd backend

docker build -t click-counter-backend .

docker run -it -p 9001:9001 click-counter-backend
  • click-counter-frontend
cd frontend

docker build -t click-counter-frontend .

docker run -it -p 9000:9000 --env BACKEND_SERVICE=http://localhost:9001/api/counter click-counter-frontend

You can access the frontend on: http://localhost:9000

Kubernetes

Deploy it on Kubernetes cluster:

kubectl apply -f https://raw.githubusercontent.com/C123R/k8s-click-counter/master/k8s-click-counter.yaml -n $(whoami)

# it will create a namespace with your userid(whoami)

Since we are creating service as cluster type, we cant access it from outside our cluster. Still you can do it using kubectl port-forward.

kubectl port-forward service/click-counter-frontend-svc :80 -n $(whoami)

Directories

Path Synopsis
backend
frontend

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL