A simple In-Memory Key Value Store HTTP API Service using Golang.
Depending on the option you choose below; Go binary
, Docker
or Kind
must be installed on the machine.
curl -X POST -d "key=abc-1" -d "value=value1" http://localhost:8080/set
curl "http://localhost:8080/get/abc-1"
curl "http://localhost:8080/search?prefix=a"
curl "http://localhost:8080/get/search?suffix=1"
Prometheus Metrics: curl "http://localhost:8080/metrics"
go run main.go
docker build -t kvstore .
docker run -d -p 8080:8080 kvstore
- Remember ! Give the Docker Image a specific tag, for example
kvstore:0.1
in this case (required to work with kind). - alternatively, you can Push the Docker Image to a Registry (Online/Offline), just make make sure to update it in
/k8sManifests/kvstore.yml
file.
docker build -t kvstore:0.1 .
kind create cluster
kind load docker-image kvstore:0.1
- if Docker Image Tag is other than
kvstore:0.1
, make sure to update it in/k8sManifests/kvstore.yml
file.
kubectl apply -f kvstore.yml
kubectl get pods
kubectl port-forward svc/kvstore-service 8080
helm install -f ./prometheus-values.yml prometheus prometheus-community/prometheus
kubectl port-forward svc/prometheus-server 9090:80
Endpoint : http://localhost:9090
go test
go test -cover