Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Gateway API over HTTPS: serving a cert-manager certificate

By updated

Improve this page

To serve an application over HTTPS through an Istio Gateway, you declare an HTTPS listener that reads its certificate from a Secret, and you let cert-manager write and renew that Secret. This lesson shows the wiring between the two, on Istio 1.32.0 in ambient mode, with the certificate of an internal name, vitrine.formation.test. A listener is the listening point of a Gateway: a port, a protocol and a host name. The lesson is for readers who already know how to write a Gateway and an HTTPRoute and want to serve their applications over TLS.

What you will learn

  • Install Istio 1.32.0 in ambient mode with an IstioOperator, and check that its components are running.
  • Say where a Gateway looks for its certificate, and ask cert-manager for the Certificate that produces this Secret.
  • Declare the listener (protocol: HTTPS, tls.mode: Terminate, certificateRefs) and attach a route to it.
  • Read the Gateway conditions then the listener conditions, where a refused Secret shows up, and allow it with a ReferenceGrant.
  • Read the issuer, the SAN and the dates of the certificate the listener presents, then prove it with a curl that only trusts the internal certificate authority (CA).
  • Diagnose a listener that is not programmed.

Prerequisites

  • The Gateway API lesson, which defines Gateway, HTTPRoute and ReferenceGrant. It runs on Traefik; this lesson reuses the same objects with the Istio Gateway.
  • The cert-manager lesson, which has you write a Certificate and read a ClusterIssuer. It is not repeated here: only the link between the certificate and the Gateway is taught.
  • The section on Istio's ambient mode of the mTLS lesson, to know what Istio in ambient mode is.
  • A three-node kubeadm cluster, kubectl and istioctl 1.32.0 on the control node, and cluster administrator rights.

Which versions does the demonstration use?

The demonstration runs on the three-node kubeadm cluster of the lab catalog, where cert-manager and the Gateway API CRDs are already installed. Istio is installed on it in the next section. The two commands below give the versions measured on 2026-11-15, once Istio was installed and the lesson's Gateway created.

Terminal window
kubectl version
istioctl version
Client Version: v1.37.2
Kustomize Version: v5.8.1
Server Version: v1.37.2
client version: 1.32.0
control plane version: 1.32.0
data plane version: 1.32.0 (4 proxies)

Check that Istio's control plane and data plane are both on 1.32.0, and that the Kubernetes client and server are on 1.37.2. The behaviors described here hold for this combination of versions. The data plane counts four proxies, one more than right after installation: it is the Gateway's. The installed Gateway API CRDs carry version v1.6.1 in the Standard channel, and the cert-manager controller is version 1.21.3 (quay.io/jetstack/cert-manager-controller:v1.21.3).

How do you install Istio 1.32 in ambient mode on the lab cluster?

In the lab, Istio is already installed: you have nothing to run here. On your own cluster, this section gives the installation to replay.

You install Istio 1.32.0 in ambient mode with an IstioOperator resource written in a file, applied with istioctl install -y -f. Ambient mode does not add a proxy in every Pod. Three components share the work:

  • ztunnel, one per node, encrypts and routes the Pods' traffic;
  • istio-cni-node, also one per node, installs in each Pod of the mesh the rules that redirect its traffic to its node's ztunnel;
  • istiod, the control plane, sends the ztunnel instances their configuration and provides them with the mTLS certificates of the Pods on their node.

The file below, /root/istio-ambient.yaml, chooses the ambient profile and reduces the requested resources to fit on a lab cluster.

# Istio 1.32.0 en mode ambient, posé par le lab.
# Réinstaller : istioctl install -y -f /root/istio-ambient.yaml
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
profile: ambient
components:
pilot:
k8s:
resources:
requests:
cpu: 100m
memory: 256Mi
values:
pilot:
autoscaleEnabled: false
ztunnel:
resources:
requests:
cpu: 50m
memory: 128Mi
cni:
resources:
requests:
cpu: 50m
memory: 64Mi

The file contains no image: Istio chooses those of its version itself. The requests are the only values the lab changes, and autoscaleEnabled: false keeps a single istiod. The installation is run on a cluster that does not have Istio yet.

Terminal window
istioctl install -y -f /root/istio-ambient.yaml
❗ detected Calico CNI with 'bpfConnectTimeLoadBalancing=TCP'; this must be set to 'bpfConnectTimeLoadBalancing=Disabled' in the Calico configuration
- Processing resources for Istio core.
✔ Istio core installed ⛵️
- Processing resources for CNI, Istiod.
- Processing resources for CNI, Istiod. Waiting for DaemonSet/istio-system/istio-cni-node
- Processing resources for CNI, Istiod. Waiting for DaemonSet/istio-system/istio-cni-node, Deploy...
✔ CNI installed 🪢
- Processing resources for Istiod, Ztunnel. Waiting for Deployment/istio-system/istiod
- Processing resources for Istiod, Ztunnel. Waiting for DaemonSet/istio-system/ztunnel, Deploymen...
✔ Ztunnel installed 🔒
✔ Istiod installed 🧠
- Pruning removed resources
✔ Installation completeThe ambient profile has been installed successfully, enjoy Istio without sidecars!

This output is shortened: the istioctl logo is removed. Look at the three ticks CNI installed, Ztunnel installed and Istiod installed, then the final Installation complete. The first line, ❗ detected Calico CNI, is a warning and not an error: it did not prevent the installation, and the Calico subsection below explains why you can set it aside on this cluster.

The ticks say that istioctl has finished, not that the Pods are ready. You check this in the istio-system namespace.

Terminal window
kubectl -n istio-system get pods -o wide ; istioctl version
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
istio-cni-node-9tlqf 1/1 Running 0 7s 10.244.38.89 k8s-w1.lab <none> <none>
istio-cni-node-fvj6p 1/1 Running 0 7s 10.244.223.6 k8s-w2.lab <none> <none>
istio-cni-node-lgnw2 1/1 Running 0 7s 10.244.163.54 k8s-cp.lab <none> <none>
istiod-85bb96f95f-x8bjh 1/1 Running 0 7s 10.244.38.95 k8s-w1.lab <none> <none>
ztunnel-4v2kk 1/1 Running 0 3s 10.244.223.7 k8s-w2.lab <none> <none>
ztunnel-d9whl 1/1 Running 0 3s 10.244.38.83 k8s-w1.lab <none> <none>
ztunnel-sv8hc 1/1 Running 0 3s 10.244.163.56 k8s-cp.lab <none> <none>
client version: 1.32.0
control plane version: 1.32.0
data plane version: 1.32.0 (3 proxies)

Expect one istio-cni-node Pod and one ztunnel Pod per node, so three of each on this cluster, plus a single istiod, all 1/1 Running. The last three lines are those of istioctl version: 1.32.0 for the client and for the control plane, and three proxies at this stage, before the Gateway is created.

This cluster does not run Cilium: it uses Calico, with kube-proxy. It is separate from the one used in the Cilium lessons because Cilium's egress gateway requires bpf.masquerade=true, which Istio's ambient mode does not currently support: the two do not coexist, so the lab has its own cluster.

Do you need to change the Calico configuration, as the warning asks?

No: the istioctl warning targets Calico's eBPF dataplane, and Calico runs here in iptables dataplane. The dataplane is the part of Calico that passes and filters packets, in iptables or in eBPF. The message asks you to set bpfConnectTimeLoadBalancing to Disabled, a setting that belongs to the eBPF dataplane. To check it, read the FelixConfiguration (the configuration of the Calico agent on each node), then the dataplane and the version in Calico's Installation.

Terminal window
kubectl get felixconfiguration default -o yaml
kubectl get installation default -o jsonpath='{.spec.calicoNetwork.linuxDataplane}'
kubectl get installation default -o jsonpath='{.status.calicoVersion}'

The output of the first command is shortened to the two fields that matter; the other two each return one value.

spec:
bpfConnectTimeLoadBalancing: TCP
bpfEnabled: false
linuxDataplane: Iptables
calicoVersion: v3.32.2

Look at bpfEnabled: false and linuxDataplane: Iptables: the eBPF dataplane is not active, so bpfConnectTimeLoadBalancing: TCP, the value istioctl reads, has no effect on this cluster. On a Calico cluster whose eBPF dataplane is active, however, follow the message's instruction.

How does the certificate reach the listener?

An HTTPS listener does not make its certificate: it reads a TLS-type Secret, in its own namespace. The Gateway has only one reference, certificateRefs, which names this Secret. It is cert-manager that writes the Secret, from a Certificate, and renews it before expiry. The diagram follows the certificate's path, from the request to the client.

Path of an HTTPS Gateway's certificate. A vitrine-tls Certificate, in the vitrine namespace, is handled by cert-manager, which signs it with the ca-formation ClusterIssuer and writes the vitrine-tls Secret in the same namespace. The vitrine Gateway, through its HTTPS listener on port 443, designates this Secret with certificateRefs. Istio creates an Envoy for the Gateway, and this Envoy presents the Secret's certificate to the HTTPS client.Certificate vitrine-tlsnamespace vitrinecert-managersigns with ca-formation     Secret vitrine-tls     namespace vitrine     Envoy created by Istio     presents the certificateGateway vitrineHTTPS listener 443 certificateRefs      HTTPS client
Source · SVG
Esc to close, + and − to zoom, scroll to move around. 100 %

The dotted line is the only thing you write on the Gateway side. The thick lines follow the certificate itself: from cert-manager to the Secret, then from the Secret to the Envoy, the proxy that Istio deploys for the Gateway. They happen by themselves once the Certificate is created. The two objects must therefore meet in the same place: the Certificate is created in the Gateway's namespace, and its secretName is the one that certificateRefs designates.

How do you request the certificate in the Gateway's namespace?

You create the Certificate in the Gateway's namespace, vitrine. The issuerRef field designates the ClusterIssuer named ca-formation, an internal authority already installed on the lab cluster. The kind field matters: an Issuer of the same name does not exist, and cert-manager does not look for it on your behalf.

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: vitrine-tls
namespace: vitrine
spec:
secretName: vitrine-tls
dnsNames:
- vitrine.formation.test
issuerRef:
group: cert-manager.io
kind: ClusterIssuer
name: ca-formation

Once the manifest is applied (kubectl apply -f), the following command must show READY True within a few seconds.

Terminal window
kubectl -n vitrine get certificate
NAME READY SECRET AGE
vitrine-tls True vitrine-tls 3s

The READY column says that cert-manager has signed the certificate, and the SECRET column gives the name of the Secret it wrote in vitrine. This is the name the listener will reference.

How do you declare an HTTPS listener on an Istio Gateway?

An Istio Gateway is declared like any other: gatewayClassName: istio, then a listener. Three fields make the HTTPS: protocol: HTTPS, tls.mode: Terminate, which means that the Gateway decrypts the TLS itself before passing the request to the Service, and tls.certificateRefs, which names the Secret.

apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
name: vitrine
namespace: vitrine
annotations:
networking.istio.io/service-type: ClusterIP
spec:
gatewayClassName: istio
listeners:
- name: https
port: 443
protocol: HTTPS
hostname: vitrine.formation.test
tls:
mode: Terminate
certificateRefs:
- kind: Secret
name: vitrine-tls
allowedRoutes:
namespaces:
from: Same

The networking.istio.io/service-type: ClusterIP annotation is due to this cluster, which has no load balancer. By default, Istio asks for a LoadBalancer Service for the Gateway. Without a load balancer, this Service never gets an address and the Gateway stays not programmed. The annotation asks for an internal address instead. On a cloud cluster with a load balancer, you do not need it.

How do you attach a route to the listener?

A Gateway without a route answers 404. The HTTPRoute is placed in vitrine, it targets the Gateway with parentRefs and the listener with sectionName, and it sends the host name to the vitrine Service, port 80. TLS stops at the Gateway: it then sends the request to the Service in HTTP, without re-encrypting it, since the Service's port 80 does not speak TLS.

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: vitrine
namespace: vitrine
spec:
parentRefs:
- name: vitrine
sectionName: https
hostnames:
- vitrine.formation.test
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: vitrine
port: 80

How do you know whether the Gateway is programmed?

The Programmed condition says that the controller has deployed the Gateway. It is read with kubectl get gateway, which shows the address and the PROGRAMMED column, then in the detailed conditions.

Terminal window
kubectl -n vitrine get gateway vitrine
NAME CLASS ADDRESS PROGRAMMED AGE
vitrine istio vitrine-istio.vitrine.svc.cluster.local True 3s

Look at PROGRAMMED True and the address: it is the name of the Service Istio created for the Gateway, in vitrine. The detail is read in the Gateway's status, with kubectl -n vitrine describe gateway vitrine. Summarized as type, status and reason, its three conditions are all True when everything is in order.

Accepted=True (Accepted)
Programmed=True (Programmed)
ResolvedRefs=True (ResolvedRefs)

These three conditions describe the Gateway, not its listener. The certificate is referenced by the listener, and its state is read one level down, in status.listeners[].conditions. On a Kubernetes v1.37.2 cluster, with Istio 1.32.0 in ambient mode, Gateway API v1.6.1 (standard channel) and cert-manager v1.21.3, the measurement of 2026-11-16 gives, for a Gateway whose Secret is in its namespace, four conditions of the https listener, all in order. This output comes from a test Gateway, b1-nominal, which has no route (attachedRoutes=0): with yours, run the same command changing the name.

Terminal window
kubectl -n vitrine get gateway b1-nominal -o yaml
listener https attachedRoutes=0
Accepted=True reason=Accepted message=No errors found
Conflicted=False reason=NoConflicts message=No errors found
Programmed=True reason=Programmed message=No errors found
ResolvedRefs=True reason=ResolvedRefs message=No errors found

Look at Conflicted=False: it is the only condition where False is the right state, it says that no other listener takes the same port and the same host name. The other three are good at True. The summary above is taken from status.listeners[].conditions; kubectl describe gateway displays the same fields.

How do you check the certificate the listener presents?

A programmed Gateway does not prove that the right certificate is served: only a real TLS handshake proves it. You connect to the ClusterIP address of the Service Istio created, giving the listener's host name. This name, which the client announces at the start of the handshake, is called the SNI (Server Name Indication): it lets the Gateway choose the right certificate.

Terminal window
kubectl -n vitrine get svc -l gateway.networking.k8s.io/gateway-name=vitrine

The CLUSTER-IP column of this command gives the address to contact. The following commands use 10.111.25.164, the address recorded during the measurement: replace it with yours. The openssl s_client below opens the TLS handshake to this address, with the listener's host name as SNI (-servername), then passes the received certificate to openssl x509.

Terminal window
timeout 15 openssl s_client -connect 10.111.25.164:443 -servername vitrine.formation.test < /dev/null | openssl x509 -noout -issuer -subject -ext subjectAltName -dates
issuer=O = Formation Kubernetes, CN = CA de la formation
subject=
X509v3 Subject Alternative Name: critical
DNS:vitrine.formation.test
notBefore=Nov 15 20:06:36 2026 GMT
notAfter=Feb 13 20:06:36 2027 GMT

The command's two additions have a reason. In interactive use, openssl s_client reads the keyboard and keeps the connection open until it receives an end of file. < /dev/null gives it one right away, and timeout 15 cuts the command after 15 seconds if it remains blocked anyway.

In the output, look for three things. The issuer is the internal CA, that of the ClusterIssuer ca-formation. The subjectAltName contains DNS:vitrine.formation.test. The dates give a validity of 90 days, the default lifetime of a cert-manager certificate, which it renews before expiry.

The subject is empty, and this is not an anomaly. The lab's Certificate only asks for a dnsNames field, and cert-manager then writes only the SAN (Subject Alternative Name, the list of names the certificate covers), with no name in the subject.

A certificate with an empty subject must mark its SAN as critical, hence critical on the X509v3 Subject Alternative Name line. A client therefore checks the host name in the SAN. The TLS diagnostics with openssl lesson details these options.

For the end-to-end proof, a client that only trusts the internal CA must reach the application without the -k option. You therefore first need to fetch this CA. It is stored in the ca-formation Secret of the cert-manager namespace, a kubernetes.io/tls Secret that carries three keys: ca.crt, tls.crt and tls.key. The CA certificate is read in tls.crt. The first command decodes it into a file, the second displays its subject, issuer, basic constraints and dates.

Terminal window
kubectl -n cert-manager get secret ca-formation -o jsonpath='{.data.tls\.crt}' | base64 -d > ca-formation.crt
openssl x509 -in ca-formation.crt -noout -subject -issuer -ext basicConstraints -dates
subject=O = Formation Kubernetes, CN = CA de la formation
issuer=O = Formation Kubernetes, CN = CA de la formation
X509v3 Basic Constraints: critical
CA:TRUE
notBefore=Nov 15 20:06:33 2026 GMT
notAfter=Nov 15 20:06:33 2027 GMT

The subject and the issuer are identical: the CA is self-signed. This name is also that of the issuer of the listener's certificate, read above. CA:TRUE, marked critical, says that this certificate is allowed to sign other certificates. It is valid for one year.

The ca-formation.crt file is ready. The first proof is the signature: openssl verify checks that the certificate received from the listener was indeed signed by this CA. The first command saves the presented certificate in presente.crt, the second verifies it.

Terminal window
timeout 15 openssl s_client -connect 10.111.25.164:443 -servername vitrine.formation.test < /dev/null | openssl x509 > presente.crt
openssl verify -CAfile ca-formation.crt presente.crt
/tmp/presente.crt: OK

The OK answer repeats the path of the file read: on your machine, it depends on the directory where you ran the command. The next curl goes further: it only trusts ca-formation.crt (--cacert), without -k, which would cut all verification, and it forces the resolution of the name to the Gateway's address (--resolve).

Terminal window
curl -sv --cacert ca-formation.crt --resolve vitrine.formation.test:443:10.111.25.164 https://vitrine.formation.test/

The output is shortened to the lines that matter.

* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / X25519 / RSASSA-PSS
* Server certificate:
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
< HTTP/2 200
vitrine

Look at two things: SSL connection using TLSv1.3 proves that the handshake succeeded with only the internal CA, with no certificate error, and HTTP/2 200 followed by the body vitrine proves that the request went through the Gateway to the application.

How do you use a Secret from another namespace?

A Gateway only reads a Secret in its own namespace, unless explicitly allowed. If the certificates live in a dedicated namespace, the Gateway refuses the reference until a ReferenceGrant exists in the Secret's namespace. Here is the vitrine-autre-ns Gateway, whose certificateRefs targets a Secret in autre-ns, with no authorization. Only the listener's reference changes: it also carries the namespace field.

tls:
mode: Terminate
certificateRefs:
- kind: Secret
name: b1-autre-tls
namespace: autre-ns

This refusal does not show in kubectl get gateway, which you usually look at first. The measurement of 2026-11-16 (Istio 1.32.0, Gateway API v1.6.1) gives the following.

NAME CLASS ADDRESS PROGRAMMED AGE
vitrine-autre-ns istio vitrine-autre-ns-istio.vitrine.svc.cluster.local True 30s

Look at PROGRAMMED True: the column shows a success although the certificate is not readable. That is the trap. The Gateway, meaning the Service and the proxy that Istio deploys, is indeed programmed; it is its listener that is in error. The Gateway's conditions (status.conditions) carry only one alert.

Accepted=False reason=ListenersNotValid message=None of the Gateway's listeners are valid
Programmed=True reason=Programmed message=Resource programmed, assigned to service(s) vitrine-autre-ns-istio.vitrine.svc.cluster.local:443
ResolvedRefs=True reason=ResolvedRefs message=All references resolved

Look at Accepted=False with the reason ListenersNotValid: it is the only warning signal at the Gateway level. Programmed and ResolvedRefs are True there. The cause is read in the conditions of the https listener, in status.listeners[].conditions, with kubectl -n vitrine get gateway vitrine-autre-ns -o yaml or with kubectl -n vitrine describe gateway vitrine-autre-ns.

listener https attachedRoutes=0
Accepted=False reason=NoValidCACertificate message=certificateRef b1-autre-tls/autre-ns not accessible to a Gateway in namespace "vitrine" (missing a ReferenceGrant?)
Conflicted=False reason=NoConflicts message=No errors found
Programmed=False reason=Invalid message=Bad TLS configuration
ResolvedRefs=False reason=RefNotPermitted message=certificateRef b1-autre-tls/autre-ns not accessible to a Gateway in namespace "vitrine" (missing a ReferenceGrant?)

The line that gives the cause is ResolvedRefs=False reason=RefNotPermitted, with its message missing a ReferenceGrant?: the Secret may exist, but the Gateway is not allowed to read it. Note that the listener's Accepted reason is NoValidCACertificate under Istio, and not RefNotPermitted: it is a reason specific to Istio 1.32.0, which repeats the same message. The listener has no route attached (attachedRoutes=0).

So read the listener conditions, not the PROGRAMMED column: the listener's ResolvedRefs condition is the only one to carry the RefNotPermitted reason, which says that the certificate reference is refused. The message writes the Secret's name before its namespace, b1-autre-tls/autre-ns, the reverse of the usual order.

The authorization is placed in the Secret's namespace, on the target side. It says which kind of object, from which namespace, is allowed to read which Secret.

apiVersion: gateway.networking.k8s.io/v1
kind: ReferenceGrant
metadata:
name: autoriser-la-gateway-vitrine
namespace: autre-ns
spec:
from:
- group: gateway.networking.k8s.io
kind: Gateway
namespace: vitrine
to:
- group: ""
kind: Secret
name: b1-autre-tls

Once this ReferenceGrant is created in autre-ns, the same measurement shows Accepted=True on the Gateway and, on the listener, the four conditions in order: Accepted=True, Conflicted=False, Programmed=True and ResolvedRefs=True. The ReferenceGrant therefore fixes the problem, without touching the Gateway.

This lesson's lab does not need it: its Certificate is created in vitrine. When possible, it is the simplest path, because it avoids handing out read rights on Secrets.

Troubleshooting

The table starts from the symptom you see and goes back up to the cause. In every case, start with kubectl describe on the object concerned.

SymptomLikely causeFix
kubectl get certificate shows READY FalseissuerRef targets an Issuer that does not exist, while the issuer is a ClusterIssuerFix kind: ClusterIssuer and the name, then reread kubectl describe certificate
The Gateway stays not programmed, with no addressThe LoadBalancer Service created by Istio waits for a load balancer the cluster does not haveAdd the networking.istio.io/service-type: ClusterIP annotation on the Gateway
ResolvedRefs=False on the listener with RefNotPermitted, while kubectl get gateway shows PROGRAMMED True and the Gateway only has Accepted=False (ListenersNotValid)The Secret is in another namespace, without a ReferenceGrantCreate the ReferenceGrant in the Secret's namespace, or request the Certificate in vitrine
ResolvedRefs=False on the listener, the Secret does not existThe certificateRefs name is not the Certificate's secretNameAlign the two names, in the same namespace
The client receives 404No HTTPRoute is attached to the listener for this host nameCheck the route's parentRefs, sectionName and hostnames
curl returns code 000The TLS handshake failed, or nothing listens on port 443Check the port, the HTTPS protocol and the listener's hostname, then rerun openssl s_client
openssl s_client does not returnIn interactive use, it reads standard input and keeps the connection open until it gets an end of fileAdd < /dev/null and prefix the command with timeout 15
subject= is empty in the openssl x509 outputThe Certificate only asks for dnsNames: cert-manager fills in only the SANNothing to fix: read the host name in subjectAltName
istioctl install -y -f fails on daemonsets.apps "istio-cni-node" not found right after an uninstall with istioctl uninstall --purgeThe objects of the previous installation are still being deletedWait for the deletion to finish, 5 minutes in the lab's measurement, then rerun the installation

Hands-on practice

The lab replays the lesson on a cluster where Istio runs in ambient mode. The vitrine namespace and the vitrine application, behind a Service on port 80, already exist: the lab's fixtures/prepare.sh script creates them. On your own cluster, create them yourself before the Certificate. You ask cert-manager for a Certificate for vitrine.formation.test in the vitrine namespace, you declare a Gateway of class istio with an HTTPS listener on port 443, you attach a route to the application, then you prove the result.

The validation reads the listener's ResolvedRefs condition, compares the fingerprint of the certificate the listener presents with that of the Secret written by cert-manager, verifies its signature against the internal CA with openssl verify, and sends a real HTTPS request that must reach the application. A hand-made Secret, or a certificate signed by another authority, does not pass.

Key takeaways

  • An HTTPS listener reads its certificate from a TLS Secret in the Gateway's namespace, designated by tls.certificateRefs. cert-manager writes and renews this Secret: the Certificate is created in the same namespace, with the same secretName.
  • tls.mode: Terminate means that the Gateway decrypts the TLS; toward the Service, the request goes out in HTTP, with no new encryption by the Gateway.
  • A Secret from another namespace is only readable with a ReferenceGrant placed in the Secret's namespace. Without it, the PROGRAMMED column stays True: only the Gateway shows Accepted=False (ListenersNotValid), and the cause is read on the listener, ResolvedRefs=False (RefNotPermitted), whose Accepted carries the reason NoValidCACertificate under Istio.
  • Without a load balancer, the networking.istio.io/service-type: ClusterIP annotation makes the Gateway programmable.
  • Read the listener conditions in status.listeners[].conditions (kubectl get gateway <name> -o yaml), not the PROGRAMMED column, then the certificate actually presented: timeout 15 openssl s_client ... < /dev/null | openssl x509, with openssl verify for the signature.
  • An empty subject is normal when the Certificate only carries dnsNames: the name is read in the SAN, marked critical.
  • Istio 1.32.0 is installed in ambient mode with istioctl install -y -f and an IstioOperator of profile ambient: one istio-cni-node and one ztunnel per node, plus istiod.
  • The lab cluster runs Calico, not Cilium. Its Calico runs in iptables dataplane: the warning about bpfConnectTimeLoadBalancing does not apply.

Knowledge check

Eight prediction and diagnosis questions: a Secret read in another namespace, the Calico warning of an ambient installation, the role of tls.mode, the annotation of a Gateway without a load balancer, reading the presented certificate, a 404 after a successful handshake, the ReferenceGrant and what a programmed Gateway proves.

Knowledge check

Check what you have learned with this interactive quiz

8 questions
8 min
80% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer