https://github.com/bsctl/go-web-app
A simple web app written in GO. For demo only.
https://github.com/bsctl/go-web-app
Last synced: 8 months ago
JSON representation
A simple web app written in GO. For demo only.
- Host: GitHub
- URL: https://github.com/bsctl/go-web-app
- Owner: bsctl
- Created: 2020-01-24T10:25:55.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-19T21:55:51.000Z (almost 3 years ago)
- Last Synced: 2024-12-27T21:44:42.473Z (over 1 year ago)
- Language: Go
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# A simple demo webapp
Clone this repo on a local machine where `kubectl` is configured against the target Kubernetes cluster. The image is built from the provided `Dockerfile`:
```
docker build -t go-web-app:latest .
Once the image is built, push it on your preferred repository.
```
## Deployment
Use this webapp to demostrate the deployment strategies in Kubernetes.
The app exposes ports:
- 8080 for http requests on the "/" path.
- 8080 for readiness and liveness probes on the "/ready", and "live" paths, respectively.
- 9090 for Prometheus metrics on "/metrics" path.
The exposed metrics are the http_requests_total counter.
Deploy multiple instances in Kubernetes through a deployment
kubectl apply -f webapp-deploy-rolling.yaml
and expose the webapp through an ingress
kubectl apply -f webapp-svc.yaml
kubectl apply -f webapp-ingress.yaml
Update the webapp by setting a new version string
kubectl set env deploy webapp VERSION=v2.0.0
During the update access the webapp multiple times and see different answers coming from different versions of the application.
Then use Prometheus and Grafana to display the number of http requests received and ordered by versions.
In Grafana, add a Prometheus data source url
http://prometheus-server
And use the following query to see the requests ordered by `{{version}}`
sum(rate(http_requests_total{run="webapp"}[5m])) by (version)
## Horizontal Pod Autoscaler Walkthrough
Use this webapp for an introduction to the HPA - Horizontal Pod Autoscaler. Refer to [autoscaler walkthrough](./autoscaler/README.md).