kota's memex

Setup minikube and portainer

  1. Setup minikube: minikube start
  2. Connect portainer via an edge agent. You need portainer's IP from the perspective of your cluster; usually the default gateway of your cluster which you can find with minikube ssh and ip route. Make sure you set https and 9443 as the port when adding the cluster.

Setup kgateway as the gateway controller

  1. Deploy the gateway API custom resource definitions: kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.5.1/standard-install.yaml
  2. Deploy the kgateway CRDs using helm:
helm upgrade -i kgateway-crds oci://cr.kgateway.dev/kgateway-dev/charts/kgateway-crds \
--create-namespace --namespace kgateway-system \
--version v2.3.1 \
--set controller.image.pullPolicy=Always
  1. Install kgateway via helm:
helm upgrade -i kgateway oci://cr.kgateway.dev/kgateway-dev/charts/kgateway \
--namespace kgateway-system \
--version v2.3.1 \
--set controller.image.pullPolicy=Always

Setup basic sample app and gateway

  1. Deploy an httpbin sample application:
kubectl apply -f https://raw.githubusercontent.com/kgateway-dev/kgateway/refs/heads/v2.3.x/examples/httpbin.yaml
  1. Create the Gateway:
kubectl apply -f- <<EOF
kind: Gateway
apiVersion: gateway.networking.k8s.io/v1
metadata:
  name: http
  namespace: kgateway-system
spec:
  gatewayClassName: kgateway
  listeners:
  - protocol: HTTP
    port: 8080
    name: http
    allowedRoutes:
      namespaces:
        from: All
EOF
  1. Create Route to expose application on the gateway:
kubectl apply -f- <<EOF
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: httpbin
  namespace: httpbin
spec:
  parentRefs:
    - name: http
      namespace: kgateway-system
  hostnames:
    - "www.example.com"
  rules:
    - backendRefs:
        - name: httpbin
          port: 8000
EOF

Setup a tunnel into minikube

  1. Start the tunnel: minikube tunnel
  2. Get the load balancer's IP: kubectl get svc -n kgateway-system http -o=jsonpath="{.status.loadBalancer.ingress[0]['hostname','ip']}"
  3. Make a request:
curl -i http://ADDRESS_GOES_HERE:8080/headers -H "host: www.example.com:8080"