Create an ingress gateway
Create an ingress gateway to manage ingress traffic with the Kubernetes Gateway API.
Creating an ingress gateway with Calico Ingress Gateway
Calico Ingress Gateway is based on Envoy Gateway, an open-source implementation of the Gateway API. Calico provides a simple, convenient way to deploy and manage this implementation.
Creating an ingress gateway with Calico Ingress Gateway involves only a few steps. You need to do the following:
- Enable Calico Ingress Gateway by creating a
GatewayAPIresource. - Create a
Gatewayresource that referencestigera-gateway-class, the name of theGatewayClassresource created by the Tigera Operator. - When you create your gateway routing resources, you refer to this
Gatewayresource.
Limitations
- Calico Ingress Gateway is not supported on Windows nodes.
Prerequisites
- You have an understanding of the Kubernetes Gateway API and know how you want to configure it for your system.
- Calico was installed on your cluster using the Tigera Operator.
- Your cluster is provisioned to support services of type
LoadBalancer.
Create an ingress gateway
-
To enable Gateway API support, create a
GatewayAPIresource with the namedefault:kubectl apply -f - <<EOFapiVersion: operator.tigera.io/v1kind: GatewayAPImetadata:name: defaultEOFThe Tigera Operator pulls and sets up the hardened Envoy Gateway images. This gives you a set of Gateway API resources, including the
GatewayClassresource you need to create your gateway.To verify, you can check to see if the
GatewayClassresource is available:kubectl get gatewayclassExpected outputNAME CONTROLLER ACCEPTED AGEtigera-gateway-class gateway.envoyproxy.io/gatewayclass-controller True 4mtiptigera-gateway-classis the name of the single defaultGatewayClassresource that is created when you enable Gateway API support. You can define additional gateway classes, along with other customizations, in theGatewayAPIresource. -
Create a
Gatewayresource that is linked totigera-gateway-class, in the namespace where you want its proxy to run.Example snippet of a Gateway resource with default gatewayClassNameapiVersion: gateway.networking.k8s.io/v1kind: Gatewaymetadata:name: <gateway-name>namespace: <gateway-namespace>spec:gatewayClassName: tigera-gateway-class...Replace
<gateway-name>with a name for your gateway, and<gateway-namespace>with the namespace where you want the gateway to run. You will refer to this gateway name for all services you want to use the gateway.The proxy, its
Service, and its load balancer are created in the same namespace as thisGateway. To check that the proxy is running, list the pods in that namespace:kubectl get pods -n <gateway-namespace> -
If your cluster enforces a global default deny policy, apply a network policy in the
Gatewaynamespace that lets the proxy pods reach the gateway controller and DNS. Without it, the proxy cannot start.apiVersion: projectcalico.org/v3kind: NetworkPolicymetadata:name: allow-tigera-gateway-proxynamespace: <gateway-namespace>spec:selector: 'app.kubernetes.io/name == "envoy"'types: [Ingress, Egress]ingress:- action: Allowegress:- action: Allow # DNSprotocol: UDPdestination:namespaceSelector: 'projectcalico.org/name == "kube-system"'selector: 'k8s-app == "kube-dns"'ports: [53]- action: Allow # configuration from the gateway controllerprotocol: TCPdestination:namespaceSelector: 'projectcalico.org/name == "calico-system"'selector: 'app.kubernetes.io/name == "gateway-helm"'ports: [18000]Replace
<gateway-namespace>with the namespace where you created theGateway. Add egress rules for your own backends as needed. -
Create a gateway routing resource that refers to your
Gatewayresource as.spec.parentRefs:Example snippet of an HTTPRoute resourceapiVersion: gateway.networking.k8s.io/v1kind: HTTPRoutemetadata:name: example-httproutespec:parentRefs:- name: <gateway-name>...Replace
<gateway-name>with the name of yourGatewayresource.