Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is spec/selector label in an Istio Gateway configuration?

I am new to Istio Gateway and my goal is to create a Ingress Gateway for a service deployed on K8s.

I am a bit confused with the Gateway example in the official document: https://istio.io/latest/docs/concepts/traffic-management/#gateway-example.

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: ext-host-gwy
spec:
  selector:
    app: my-gateway-controller
  servers:
  - port:
      number: 443
      name: https
      protocol: HTTPS
    hosts:
    - ext-host.example.com
    tls:
      mode: SIMPLE
      credentialName: ext-host-cert

In this example, what is app: my-gateway-controller under spec/selector? Is there additional configuration/deployment needed for this my-gateway-controller?

I tried searching "my-gateway-controller" in the rest of the document, but didn't find further explanation.

like image 829
Dooora Avatar asked Dec 06 '25 20:12

Dooora


1 Answers

Like the others have mentioned in the answers, the selector key looks for labels. In this case, it's looking for an istio label to associate the Gateway object with.

The value of this istio label for your Gateway definition should match the value of the istio label of the current Istio Gateway pod that should be running.

Assuming that you've deployed Istio in a Kubernetes cluster already, the Istio Gateway is stood up via a Deployment object. You could find what this istio value must be as follows:

Step #1: Find out what deployed the Istio Gateway pod.

kubectl get deployments -n '<namespace where Istio is deployed>'

You should see some table output with the deployments for that namespace.

For example:

> kubectl get deployment istio-system

NAME            READY   UP-TO-DATE   AVAILABLE   AGE
istio-gateway   1/1     1            1           24m
istiod          1/1     1            1           24m
jaeger          1/1     1            1           24m
kiali           1/1     1            1           21m

In my case, the Deployment is called istio-gateway.

Step #2: Find what's the value of the istio label.

If you run:

kubectl get deployment -n '<namespace where Istio is deployed>' '<name of your Istio deployment>' -o yaml

You should see some output like this:

> kubectl get deployment -n istio-system istio-gateway -o yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: istio-gateway
    istio: gateway # <- this is what you want!
  name: istio-gateway
  namespace: istio-system
like image 54
Pablo Alexis Domínguez Grau Avatar answered Dec 11 '25 00:12

Pablo Alexis Domínguez Grau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!