Kubernetes Gateway API
Install the Gateway API CRDs:
Install Istio, or reconfigure an existing installation to enable the Gateway API controller:
Configuring a Gateway
See the documentation for information about the APIs.
Deploy a test application:
Deploy the Gateway API configuration:
$ kubectl apply -f - <<EOF
apiVersion: networking.x-k8s.io/v1alpha1
kind: GatewayClass
metadata:
name: istio
spec:
controller: istio.io/gateway-controller
---
apiVersion: networking.x-k8s.io/v1alpha1
kind: Gateway
metadata:
name: gateway
namespace: istio-system
gatewayClassName: istio
listeners:
- hostname: "*"
port: 80
routes:
namespaces:
from: All
selector:
matchLabels:
selected: "yes"
kind: HTTPRoute
---
apiVersion: networking.x-k8s.io/v1alpha1
kind: HTTPRoute
metadata:
name: http
namespace: default
labels:
selected: "yes"
spec:
allow: All
rules:
- matches:
- path:
type: Prefix
value: /get
filters:
- type: RequestHeaderModifier
requestHeaderModifier:
add:
my-added-header: added-value
forwardTo:
- serviceName: httpbin
port: 8000
EOF
Access the httpbin service using curl:
Access any other URL that has not been explicitly exposed. You should see an HTTP 404 error:
$ curl -s -I -HHost:httpbin.example.com "http://$INGRESS_HOST:$INGRESS_PORT/headers"
HTTP/1.1 404 Not Found