OpenStaticFish MicroServices
Basic local Kubernetes development setup using Nix, Kind, Tilt, Docker, and a small Go hello-world service.
Requirements
- Nix with flakes enabled
- Docker running and reachable by your user
- Git
All project CLI dependencies are provided by flake.nix, including:
tiltkindkubectldockerhelmgo
Quick Start
Create or select the local Kind cluster:
nix run .#setup-kind
Start Tilt:
nix run .#tilt -- up
Open the Tilt UI:
http://localhost:10350
Test the hello-world service:
curl http://localhost:8080
Stop Tilt resources:
nix run .#tilt -- down
Dev Shell
You can also enter the Nix development shell and run commands directly:
nix develop
Inside the shell:
setup-kind
tilt up
tilt down
kubectl get pods
docker ps
Project Commands
Nix Commands
nix develop
Enter the dev shell with all dependencies on PATH.
nix run .#setup-kind
Create the openstaticfish Kind cluster if needed, select the kind-openstaticfish Kubernetes context, and print cluster info.
nix run .#tilt -- up
Run Tilt with the required runtime tools available, including kind, kubectl, and docker.
nix run .#tilt -- down
Tear down Kubernetes resources managed by Tilt.
nix flake show
Validate and display flake outputs.
Tilt Commands
tilt up
Build images, deploy Kubernetes manifests, start file watching, and open the Tilt UI.
tilt down
Remove deployed Tilt resources from the current Kubernetes context.
tilt logs
Stream aggregated logs from Tilt resources.
tilt status
Show current resource status.
tilt ui
Open the Tilt web UI.
Kubernetes Commands
kubectl config use-context kind-openstaticfish
Select the project Kind cluster.
kubectl cluster-info
Verify Kubernetes connectivity.
kubectl get pods
List running pods.
kubectl logs -f deployment/hello-world-deployment
Stream logs from the hello-world deployment.
kubectl get svc
List Kubernetes services.
Docker Commands
docker ps
List running containers, including Kind node containers.
docker build -t hello-world ./services/hello-world
Build the hello-world image manually outside Tilt.
Layout
.
├── flake.nix
├── Tiltfile
├── k8s/
│ └── hello-world.yaml
├── scripts/
│ └── setup-kind
└── services/
└── hello-world/
├── Dockerfile
├── go.mod
└── main.go
Notes
Nix flakes only see files that are tracked by Git. If nix run says a path is not visible to Nix, stage the file:
git add <file>
For this repo setup, staging all project files is usually enough:
git add -A
The Tiltfile allows only the kind-openstaticfish Kubernetes context to avoid accidentally deploying to another cluster.
If Tilt reports that it cannot connect to Kubernetes, rerun:
nix run .#setup-kind
Then restart Tilt.