Local Run Tutorial — Ingress Info Service

Local Run Tutorial

This guide walks you through running the service locally against a Kubernetes cluster using a kubeconfig file.

Prerequisites

  • Go toolchain (for building) or a prebuilt binary/container
  • Access to a Kubernetes cluster and a valid KUBECONFIG
  • curl for basic requests

Environment

  • LISTEN_ADDR: HTTP listen address (default :8080)
  • KUBECONFIG: Path to kubeconfig file for out-of-cluster runs
  • INGRESS_INFO_KEYS_FILE: Optional file with one API key per line (overrides Secret for local runs)

Steps

  1. Build and run
# From repo root
GO111MODULE=on go build -o bin/ingress-info ./cmd/ingress-info
KUBECONFIG=$HOME/.kube/config \
LISTEN_ADDR=:8080 \
INGRESS_INFO_KEYS_FILE=$(pwd)/.devkeys \
./bin/ingress-info
  1. Verify health/readiness
curl -sS http://localhost:8080/healthz
curl -sS http://localhost:8080/readyz
  1. Try the API without auth (expect 401)
curl -i http://localhost:8080/v1/ingresses
  1. Try with a valid key
KEY=$(head -n1 .devkeys)
curl -i -H "Authorization: Bearer $KEY" http://localhost:8080/v1/ingresses
  1. ETag / conditional GET
ETAG=$(curl -si -H "Authorization: Bearer $KEY" http://localhost:8080/v1/ingresses | awk -F': ' 'tolower($1)=="etag"{print $2}' | tr -d '\r')
curl -i -H "Authorization: Bearer $KEY" -H "If-None-Match: $ETAG" http://localhost:8080/v1/ingresses

Troubleshooting

  • If you see kubeconfig-related warnings in logs, ensure KUBECONFIG points to a valid file.
  • For missing keys, create .devkeys with a test key (one per line).
  • Startup may delay until informers sync; check /readyz for readiness.