<p>Is there a common (or any) workflow to issue and renew LE certificates for apps configured in an Istio VirtualService &amp; Gateway? The Istio docs only cover an Ingress use case, and I don't think it covers handling renewals.</p>

<blockquote>
  <p>My real world use case is about making this work with a wildcard cert and custom applications, but for the sake of simplicity, I want to figure this out using the Prometheus service installed with the Istio demo. The VirtualService and Gateway are necessary for my real world use case.</p>
</blockquote>

<p>Here is how I am currently serving Prometheus over https with a self-signed cert. I am running Istio version <code>1.5.2</code> on GKE K8s version <code>1.15.11</code>. Cert Manager is installed as well.</p>

<p>So how would I adapt this to use Cert Manager for issuing and renewing an LE cert for <code>prom.example.com</code>?</p>

<pre><code>---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: prometheus-gateway
  #namespace: istio-system
spec:
  selector:
    istio: ingressgateway
  servers:
    - port:
        number: 443
        name: http-prom
        protocol: HTTPS
      hosts:
        - "prom.example.com"
      tls:
        mode: SIMPLE # enables HTTPS on this port
        serverCertificate: /etc/istio/ingressgateway-certs/tls.crt
        privateKey: /etc/istio/ingressgateway-certs/tls.key
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: prometheus-vs
spec:
  hosts:
    - "prom.example.com"
  gateways:
    - prometheus-gateway
  http:
    - match:
        - port: 443
      route:
        - destination:
            host: prometheus
            port:
              number: 9090
</code></pre>

Coder1
<p><strong>TL;DR</strong></p>

<p>Configure <code>cert-manager</code> with DNS domain verification to issue certificate, renewal is handled automatically. </p>

<p>Few notes on the example in Istio docs that hopefully will clarify the workflow:</p>

<ul>
<li><p><strong>cert-manager</strong> knows nothing about Istio, it is key role is to issue and renew certificate then save them to a secret object in kubernetes.</p>

<ul>
<li><p>LE ACME verification is typically done with DNS e.g. AWS Route53</p></li>
<li><p>Issued Certificate secret will be in <em>a specific</em> k8s namespace and not visible outside that.</p></li>
</ul></li>
<li><p><strong>Istio</strong> knows nothing about cert-manager, all what it needs is the issued certificate secrets which is configured in the gateway with SDS. This  means two things:</p>

<ul>
<li><p>The name of the SDS secret must match the one cert-manager produces (this is the only link between them)</p></li>
<li><p>The secret must be in the same namespace where the Istio gateway will be.</p></li>
</ul></li>
<li><p>Finally, your VirtualServices just need a gateway that is configured properly as above. The good news is, VirtualService can link to gateway in any namespace if you used the full qualified name. </p></li>
</ul>

<p>So you can have your gateway(s) in the same namespace where you issue the Certificate object to avoid copying secrets around, then your VirtualServices can be in any namespace just use the full gateway name.</p>
