Skip to main content

Tutorial series

Ship a Go API to Kubernetes

Take a small Go API from a distroless image to a production-like Kubernetes deployment: Kustomize overlays, PostgreSQL in a StatefulSet, probes, the Gateway API with TLS, autoscaling, network policies and safe releases.

  1. Package the Snip Go API in a distroless container image

    You will write Snip, a small Go 1.27 link-shortener API with health and readiness endpoints and a clean drain on SIGTERM, build it as a static binary, package it in a two-stage Dockerfile on a distroless non-root base, and load the image into a kind cluster.

    Intermediate · 22 min

  2. Keep Snip healthy with probes and graceful shutdown

    You will give the Snip Deployment startup, readiness and liveness probes with timings you can explain, a preStop pause and a grace period that let in-flight requests finish during a rollout, and watch readiness take a pod out of service when PostgreSQL stops while liveness leaves it running.

    Intermediate · 17 min