Fully offline, in Kubernetes, with metrics
A cluster without internet access still needs addresses as points. Each image carries its country file and checks nothing outside; the Pro server adds who called, how often and how fast.
What you have
The chart in the repository, docker/helm/gridpin: one Deployment and one Service per country, the country's image from the release, a readiness probe on /health. Its values file:
# One Deployment and Service per country; each image carries its sheet (ghcr.io/gridpin/gridpin:<country>-<tag>,
# the tags the release pushes; linux/amd64 only).
image:
repository: ghcr.io/gridpin/gridpin
tag: "0.9.0"
pullPolicy: IfNotPresent
countries: [fr]
port: 8080
replicas: 1
resources:
requests: {cpu: 250m, memory: 512Mi}
limits: {memory: 2Gi}
Pull the images once where the cluster can reach them (a mirror registry inside the network) and set image.repository to it; nothing else leaves the cluster.
Steps
1. For keys and metrics, run the Pro server with a file of keys (each key 16 characters or more):
key,name,daily_limit k-dispatch-7f3a91d0c2,dispatch,0 k-website-91c24e8b07,website,5000
$ gridpin-pro serve usa.bin --keys keys.csv --port 8080
2. A request without a key is refused:
$ curl -s -o /dev/null -w "%{http_code}\n" "http://127.0.0.1:8080/v1/geocode?q=233+S+Wacker+Dr,+Chicago,+IL+60606"
401
3. With a key it is answered and counted under that key's name:
$ curl -s -H "Authorization: Bearer k-website-91c24e8b07" "http://127.0.0.1:8080/v1/geocode?q=233+S+Wacker+Dr,+Chicago,+IL+60606" | jq -c '.results[0] | {street, housenumber, lat, lon}'
{"street":"South WACKER Drive","housenumber":"233","lat":41.878658,"lon":-87.6358684}
4. /metrics needs no key and speaks the Prometheus text format:
$ curl -s http://127.0.0.1:8080/metrics | grep -E '^# TYPE|key="website"'
# TYPE gridpin_requests_total counter
gridpin_requests_total{key="website",status="200"} 1
# TYPE gridpin_request_ms histogram
What you get
A counter of requests by key name and status and a histogram of answer times in milliseconds, for Prometheus to scrape. A key's daily limit returns 429 when it is used up; --log writes a JSON line per request without the query text unless you ask for it.
Why it works
The country file is inside the image and read from local disk, so the server never needs the network: a NetworkPolicy that denies all egress does not change its answers. The open gridpin serve in the chart has no keys and no metrics; the Pro server adds them on the same engine.
Limits
- The chart and the 0.9.0 images arrive with release 0.9.0.
helmwas not run for this page: the files are shown as they are in the repository.- Keys and counts live in the process: a restart starts the day's counts again, and replicas count apart.
All its keys: command reference. The functions: research containers and Kubernetes, serve with keys, limits and metrics. Part of gridpin-pro, which comes with a Starter or Pro subscription: Free, Starter and Pro.