owned this note
owned this note
Published
Linked with GitHub
# Gateway API
https://github.com/kubernetes-sigs/gateway-api/tree/master/examples/v1alpha2
https://github.com/kubernetes-sigs/gateway-api/tree/master/site-src/geps
gateway.networking.k8s.io/v1alpha2
- GatewayClass
- Gateway
- HTTPRoute
## Apache APISIX
https://apisix.apache.org/docs/ingress-controller/aeps/gateway-api/
https://apisix.apache.org/plugins
## Contour
https://projectcontour.io/guides/gateway-api/
examples:
- https://github.com/projectcontour/contour-operator/tree/main/examples/gateway
## Kong
https://docs.konghq.com/kubernetes-ingress-controller/2.2.x/guides/using-gateway-api/
with chart version 2.7 or higher:
ingressController.env.feature_gates: Gateway=true
## Traefik
https://doc.traefik.io/traefik/routing/providers/kubernetes-gateway/
+ TCPRoute, TLSRoute
---
### Kong
On WC:
```bash
kubectl kustomize "github.com/kubernetes-sigs/gateway-api/config/crd?ref=v0.4.2" \
| kubectl apply -f -
```
On MC
kubectl apply -f app.yaml
```yaml=
apiVersion: v1
data:
values: |
image:
tag: "2.8.0"
admin:
enabled: true
autoscaling:
enabled: false
env:
admin_access_log: /dev/stdout json_log
admin_error_log: /dev/stdout
admin_gui_access_log: /dev/stdout
admin_gui_error_log: /dev/stdout
database: 'off'
headers: 'off'
nginx_http_log_format: json_log escape=json '{"message":{"remote_addr":"$remote_addr","remote_user":"$remote_user","host":"$http_host","request":"$request","req_method":"$request_method","req_time":"$request_time","status":"$status","size":"$body_bytes_sent","user_agent":"$http_user_agent","cookie":"$http_cookie","uri":"$uri","http_referer":"$http_referer","upstream_status":"$upstream_status","upstream_addr":"$upstream_addr","upstream_connect_time":"$upstream_connect_time","upstream_header_time":"$upstream_header_time","upstream_response_time":"$upstream_response_time","x-api-key":"$http_x_api_key","api-key":"$http_api_key","x-forwarded-for":"$http_x_forwarded_for","true-client-ip":"$http_true_client_ip","upstream_cache_status":"$upstream_cache_status"},"@timestamp":"$time_iso8601","labels":{"env":"stg"},"service":{"name":"Kong"},"level":"info"}'
nginx_http_lua_shared_dict: kong_proxy_cache 5m
nginx_worker_processes: '1'
portal_api_access_log: /dev/stdout
portal_api_error_log: /dev/stdout
prefix: /kong_prefix/
proxy_access_log: /dev/stdout json_log
proxy_error_log: /dev/stdout
real_ip_header: X-Forwarded-For
real_ip_recursive: 'on'
ingressController:
admissionWebhook:
enabled: true
enabled: true
env:
kong_admin_tls_skip_verify: true
feature_gates: "Gateway=true"
rbac:
create: true
serviceAccount:
annotations: {}
create: true
name: null
watchNamespaces: []
replicaCount: 1
terminationGracePeriodSeconds: 30
kind: ConfigMap
metadata:
name: kong-app-userconfig-f9o7a
namespace: f9o7a
---
apiVersion: application.giantswarm.io/v1alpha1
kind: App
metadata:
name: kong-app
namespace: f9o7a
spec:
catalog: giantswarm
kubeConfig:
inCluster: false
name: kong-app
namespace: kong-app
userConfig:
configMap:
name: kong-app-userconfig-f9o7a
namespace: f9o7a
version: 2.7.2
---
apiVersion: application.giantswarm.io/v1alpha1
kind: App
metadata:
name: hello-world-app
namespace: f9o7a
spec:
catalog: giantswarm
kubeConfig:
inCluster: false
name: hello-world-app
namespace: hello-world-app
version: 0.3.0
```
On WC:
apply GatewayAPI stuff on top
```yaml=
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: GatewayClass
metadata:
name: kong
namespace: hello-world-app
spec:
controllerName: konghq.com/kic-gateway-controller
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: Gateway
metadata:
annotations:
konghq.com/gateway-unmanaged: kong-app/kong-app-kong-app-proxy
name: kong
namespace: hello-world-app
spec:
gatewayClassName: kong
listeners:
- name: proxy
port: 80
protocol: HTTP
- name: proxy-ssl
port: 443
protocol: HTTPS
---
apiVersion: gateway.networking.k8s.io/v1alpha2
kind: HTTPRoute
metadata:
name: echo
namespace: hello-world-app
spec:
parentRefs:
- group: gateway.networking.k8s.io
kind: Gateway
name: kong
hostnames:
- "gateway.rulez"
rules:
- backendRefs:
- group: ""
kind: Service
name: hello-world-app-service
port: 8080
weight: 1
matches:
- path:
type: PathPrefix
value: /
```
```
curl -H "Host: gateway.rulez" 20.82.78.77
```