Working with Istio as a Cluster Add-on to implement Kubernetes Gateway API
Find out how to install, configure, and use the Istio cluster add-on to implement the Kubernetes Gateway API in clusters you've created using Kubernetes Engine (OKE).
The Kubernetes Gateway API (Gateway API) is the next generation standard for managing ingress and network traffic in Kubernetes clusters, succeeding the Ingress API. For more information about the Gateway API, see Gateway API in the Kubernetes documentation, and the Gateway API documentation.
The Istio cluster add-on is an Oracle-managed extension for Kubernetes Engine that deploys and manages the Istio control plane in a cluster. It enables advanced service mesh and Gateway API support for ingress and traffic management.
By enabling the Istio cluster add-on, you can use Istio as the underlying controller to manage Gateway, HTTPRoute, and other Gateway API resources.
Using Istio as a cluster add-on (the Istio cluster add-on) simplifies the lifecycle management of the control plane (istiod). You can more simply:
- Enable or disable the Istio control plane.
- Opt into, and out of, automatic version updates by Oracle.
- Manage add-on specific customizations using approved key/value pair configuration arguments.
These sections describe how to work with the Istio cluster add-on to configure Gateway API networking:
- Setting Up the Istio Cluster Add-on as a Gateway API Controller
- Disabling (and removing) the Istio cluster add-on
Prerequisites
Before setting up the Istio cluster add-on to support the Kubernetes Gateway API:
- You must have
kubectlaccess to the cluster created by Kubernetes Engine. - You must have cluster-admin privileges to install custom resource definitions (CRDs) and controllers.
Setting Up the Istio Cluster Add-on as a Gateway API Controller
High level steps to set up the Istio cluster add-on as a Gateway API controller
At a high-level, the steps to set up the Istio cluster add-on to serve as the Gateway API controller are as follows:
Step 1: Install Gateway API CRDs
The Gateway API Custom Resource Definitions (CRDs) are not installed by default in clusters you create using Kubernetes Engine. Before using Istio as a Gateway API controller, you must install the CRDs.
-
Install the standard Gateway API CRDs (v1.2.0) by entering:
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.0/standard-install.yaml -
Verify that the CRD is installed by entering:
kubectl get crd gateways.gateway.networking.k8s.io - Confirm that the CRD is listed in the output.
- Confirm that the Kubernetes Gateway API release is compatible with the Istio add-on version supported by Kubernetes Engine for the version of Kubernetes running on the cluster (see Comparisons - v1.2 in the Gateway API documentation, and Cluster Add-on Supported Versions).
Step 2: Create the Istio cluster add-on configuration file
Create an Istio cluster add-on configuration file for use with the OCI CLI.
-
Create a JSON file (for example,
enableistio.json). -
Add the following content to enable the add-on.
Note: Unlike the standard Service Mesh use case, you do not strictly need to set the legacy
enableIngressGatewaybecause the Gateway API can dynamically provision gateway infrastructure. However, setting it provides a default fallback.{ "addonName": "Istio", "configurations": [ { "key": "enableIngressGateway", "value": "false" } ] }Note the following points:
- If you set
valueto"true", the Istio cluster add-on provisions the classicistio-ingressgatewaydeployment and service alongside the control plane. - If you set
valueto"false", only the control plane (istiod) is installed. You can then createGatewayresources that Istio will automatically provision as needed.
- If you set
-
Save and close the file.
Step 3: Deploy the Istio cluster add-on on the cluster and confirm successful deployment
Deploy the Istio cluster add-on.
-
Deploy the add-on using the OCI CLI by entering:
oci ce cluster install-addon --addon-name Istio --cluster-id <cluster-ocid> --from-json file://enableistio.json -
Verify successful deployment:
-
Enter:
oci ce cluster list-addons --cluster-id <cluster-ocid> -
Confirm that the lifecycle state of the Istio cluster add-on is
ACTIVE.
-
-
Verify that the Istio control plane is running:
-
Enter:
kubectl get pods -n istio-system -
Confirm that the
istiodpod is in theRunningstate.
-
Step 4: Create a Gateway
Create the Gateway resource.
- Create a new namespace (for example, test-gateway) by entering:
kubectl create namespace test-gateway -
Create a file named
gateway.yamlwith the following content.apiVersion: gateway.networking.k8s.io/v1 kind: Gateway metadata: name: my-gateway namespace: test-gateway annotations: # OCI specific annotation for Network Load Balancer (Layer 4) oci.oraclecloud.com/load-balancer-type: "nlb" spec: gatewayClassName: istio listeners: - name: http port: 80 protocol: HTTP allowedRoutes: namespaces: from: SameNote the
gatewayClassName: istioline, which tells the Istio cluster add-on to manage this gateway. -
Create the
Gatewayby entering:kubectl apply -f gateway.yaml -
Get the external IP address by entering:
kubectl get gateway -n test-gatewayIt might take a few minutes for OCI to provision the load balancer.
Wait until the
PROGRAMMEDcolumn containsTrueand an IP address appears in theADDRESScolumn.
Step 5: Deploy a sample application
Deploy a sample application into the new namespace.
-
Deploy a sample application (for example, httpbin) by entering:
kubectl apply -f https://raw.githubusercontent.com/istio/istio/master/samples/httpbin/httpbin.yaml -n test-gateway
Step 6: Create an HTTPRoute
Create an HTTPRoute to direct traffic from the Gateway to the httpbin service.
-
Create a file named
route.yamlwith the following content:apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: name: httpbin-route namespace: test-gateway spec: parentRefs: - name: my-gateway rules: - matches: - path: type: PathPrefix value: /get backendRefs: - name: httpbin port: 8000 -
Create the
HTTPRouteby entering:kubectl apply -f route.yaml
Step 7: Verify connectivity
Verify connectivity by sending a request to the external IP address of the Gateway.
-
Retrieve the public IP address of the gateway and save it as an environment variable by entering:
export GATEWAY_IP=$(kubectl get gateway my-gateway -n test-gateway -o jsonpath='{.status.addresses[0].value}') -
Use
curlto send a request to the Gateway external IP address by entering:curl -i http://$GATEWAY_IP/get -
Confirm that you receive a
200 OKresponse from the httpbin application.
Disabling (and removing) the Istio cluster add-on
These instructions describe how to disable and remove the Istio cluster add-on.
-
Disable and remove the add-on using the OCI CLI by entering:
oci ce cluster disable-addon --addon-name Istio --cluster-id <cluster-ocid> --is-remove-existing-add-on true -
(Optional) Remove Gateway API resources.
The add-on removal process does not automatically delete the
GatewayorHTTPRouteresources you created. Manually remove them to clean up the associated load balancers by entering:kubectl delete -f gateway.yamlkubectl delete -f route.yaml -
(Optional) Remove Gateway API CRDs.
If you no longer need the Gateway API on this cluster, you can remove the CRDs by entering:
kubectl delete -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.0/standard-install.yaml