A MeshGatewayInstance
configures the pods
that will run the gateway.
Create it by running:
kubectl apply -f https://raw.githubusercontent.com/kumahq/kuma-counter-demo/refs/heads/main/kustomize/overlays/002-with-gateway/mesh-gateway-instance.yaml
The Kubernetes cluster needs to support LoadBalancer
for this to work.
If you are running minikube
you will want to open a tunnel with minikube tunnel -p mesh-zone
.
You may not have support for LoadBalancer
if you are running locally with kind
or k3d
.
When running kind
cluster you can try kubernetes-sigs/cloud-provider-kind.
MeshGateway
defines listeners for the gateway.
Define a single http listener on port 8080:
kubectl apply -f https://raw.githubusercontent.com/kumahq/kuma-counter-demo/refs/heads/main/kustomize/overlays/002-with-gateway/mesh-gateway.yaml
Notice how the selector selects the kuma.io/service
tag of the previously defined MeshGatewayInstance
.
Now look at the pods running in the namespace by running:
kubectl get pods -n kuma-demo
Observe the gateway pod:
NAME READY STATUS RESTARTS AGE
redis-5fdb98848c-5tw62 2/2 Running 0 5m5s
demo-app-c7cd6588b-rtwlj 2/2 Running 0 5m5s
edge-gateway-66c76fd477-ncsp5 1/1 Running 0 18s
Retrieve the public url for the gateway with:
export PROXY_IP=$(kubectl get svc -n kuma-demo edge-gateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo $PROXY_IP
Check the gateway is running:
Which outputs:
* Trying 127.0.0.1:8080...
* Connected to 127.0.0.1 (127.0.0.1) port 8080
> GET / HTTP/1.1ó
> Host: 127.0.0.1:8080
> User-Agent: curl/8.4.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< content-length: 62
< content-type: text/plain
< vary: Accept-Encoding
< date: Fri, 09 Feb 2024 10:07:26 GMT
< server: Kuma Gateway
<
This is a Kuma MeshGateway. No routes match this MeshGateway!
Notice the gateway says that there are no routes configured.