You are browsing documentation for an older version. See the latest documentation here.
Create a Gateway
Note:
Gateway
andControlPlane
controllers are stillalpha
so be sure to use the installation steps from this guide in order to get yourGateway
up and running.
Creating GatewayClass
and Gateway
resources in Kubernetes causes Kong Gateway Operator to create a Kong Ingress Controller and Kong Gateway deployment.
GatewayConfiguration
You can customize your Kong Ingress Controller and Kong Gateway deployments using the GatewayConfiguration
CRD. This allows you to control the image being used, and set any required environment variables.
The results should look like this:
gatewayconfiguration.gateway-operator.konghq.com/kong created
GatewayClass
To use the Gateway API resources to configure your routes, you need to create a GatewayClass
instance and create a Gateway
resource that listens on the ports that you need.
echo '
kind: GatewayClass
apiVersion: gateway.networking.k8s.io/v1
metadata:
name: kong
spec:
controllerName: konghq.com/gateway-operator
parametersRef:
group: gateway-operator.konghq.com
kind: GatewayConfiguration
name: kong
namespace: default
---
kind: Gateway
apiVersion: gateway.networking.k8s.io/v1
metadata:
name: kong
namespace: default
spec:
gatewayClassName: kong
listeners:
- name: http
protocol: HTTP
port: 80' | kubectl apply -f -
The results should look like this:
gatewayclass.gateway.networking.k8s.io/kong created
gateway.gateway.networking.k8s.io/kong created
You can verify that everything works by checking the Gateway
resource via kubectl
:
kubectl get gateway kong -o wide
You should see the following output:
NAME CLASS ADDRESS PROGRAMMED AGE
kong kong 172.18.0.102 True 9m5s
If the Gateway
has Programmed
condition set to True
then you can visit Konnect and see your configuration being synced by Kong Ingress Controller.