Setup minikube and portainer
- Setup minikube:
minikube start
- 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
- 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
- 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
- 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
- Deploy an httpbin sample application:
kubectl apply -f https://raw.githubusercontent.com/kgateway-dev/kgateway/refs/heads/v2.3.x/examples/httpbin.yaml
- 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
- 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
- Start the tunnel:
minikube tunnel
- Get the load balancer's IP:
kubectl get svc -n kgateway-system http -o=jsonpath="{.status.loadBalancer.ingress[0]['hostname','ip']}"
- Make a request:
curl -i http://ADDRESS_GOES_HERE:8080/headers -H "host: www.example.com:8080"