Monday, May 6, 2024
HomeGolangA tiny internet software Golang showcases finest practices of working microservices in...

A tiny internet software Golang showcases finest practices of working microservices in Kubernetes


Podinfo is a tiny internet software made with Go that showcases the perfect practices of working microservices in Kubernetes. Podinfo is utilized by CNCF initiatives like Flux and Flagger for end-to-end testing and workshops.

Golang Challenge Specs

  • Well being checks (readiness and liveness)
  • Sleek shutdown on interrupt indicators
  • File watcher for secrets and techniques and configmaps
  • Structured logging with zap
  • 12-factor app with viper
  • Fault injection (random errors and latency)
  • Instrumented with Prometheus and Open Telemetry
  • Swagger docs
  • CUE, Helm and Kustomize installers
  • Finish-to-Finish testing with Kubernetes Form and Helm
  • Kustomize testing with GitHub Actions and Open Coverage Agent
  • Multi-arch container picture with Docker buildx and Github Actions
  • Container picture signing with Sigstore cosign
  • CVE scanning with Trivy

Go Net API:

  • GET / prints runtime data
  • GET /model prints podinfo model and git commit hash
  • GET /metrics return HTTP requests length and Go runtime metrics
  • POST /readyz/allow indicators the Kubernetes LB that this occasion is able to obtain site visitors
  • POST /readyz/disable indicators the Kubernetes LB to cease sending requests to this occasion
  • GET /healthz utilized by Kubernetes liveness probe
  • GET /readyz utilized by Kubernetes readiness probe
  • GET /standing/{code} returns the standing code
  • GET /panic crashes the method with exit code 255
  • POST /echo forwards the decision to the backend service and echos the posted content material
  • GET /env returns the setting variables as a JSON array
  • GET /headers returns a JSON with the request HTTP headers
  • GET /delay/{seconds} waits for the desired interval
  • POST /token points a JWT token legitimate for one minute JWT=$(curl -sd 'anon' podinfo:9898/token | jq -r .token)
  • GET /token/validate validates the JWT token curl -H "Authorization: Bearer $JWT" podinfo:9898/token/validate
  • GET /configs returns a JSON with configmaps and/or secrets and techniques mounted within the config quantity
  • POST/PUT /cache/{key} saves the posted content material to Redis
  • GET /cache/{key} returns the content material from Redis if the important thing exists
  • DELETE /cache/{key} deletes the important thing from Redis if exists
  • POST /retailer writes the posted content material to disk at /information/hash and returns the SHA1 hash of the content material
  • GET /retailer/{hash} returns the content material of the file /information/hash if exists
  • GET /ws/echo echos content material through websockets podcli ws ws://localhost:9898/ws/echo
  • GET /chunked/{seconds} makes use of transfer-encoding sort chunked to offer a partial response after which waits for the desired interval
  • GET /swagger.json returns the API Swagger docs, used for Linkerd service profiling and Gloo routes discovery

Golang gRPC API

  • /grpc.well being.v1.Well being/Examine well being checking
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments