Deploying an HTTPS Website with Kubernetes, Istio, and cert-manager: Part 2

In this tutorial I’ll be walking you through you how to deploy an HTTPS microservice website using Kubernetes, Istio and Kubernetes cert-manager.

This is part 2 of a two-part series. The first part takes you through the Kubernetes cluster setup, installing and configuring Istio on that cluster, and deploying your first application on the cluster. In part 2 we’ll learn how to use Istio gateways, routes, and how to secure your website with Kubernetes cert-manager.


In order for our website to use HTTPS, we need to configure our Kubernetes cluster to use the plugin. This plugin allows you to generate SSL certificates for your website automatically. To install cert-manager we'll use our Kubernetes package manager and friend Helm. Run the following 3 commands:

$ helm repo add jetstack 
$ helm repo update
$ helm install cert-manager jetstack/cert-manager \
--namespace istio-system \
--set installCRDs=true

When successful you’ll see a message:

cert-manager has been deployed successfully!In order to begin issuing certificates, you will need to set up a ClusterIssuer or Issuer resource (for example, by creating a 'letsencrypt-staging' issuer).More information on the different types of issuers and how to configure them can be found in our documentation: information on how to configure cert-manager to automatically provision Certificates for Ingress resources, take a look at the `ingress-shim` documentation:


The cert-manager relies on a new Kubernetes api-resource called an to... well... issue certificates. It will then store the certificate inside of a Kubernetes Secret, defined in the YAML of the issuer (called in this example). Be sure to update your email address


Save the YAML and apply it:

$ kubectl apply -f my-issuer.yml created

You can verify the certificate was created by listing the secrets in the namespace. You should see an entry for :

$ kubectl -n istio-system get secrets NAME              TYPE    DATA  AGE 
[ ... ]
my-certificate-key Opaque 1 5s


We’ve finally made it to where we can get our SSL certificate. To do this, we’ll create a new Kubernetes API resource. This certificate resource will, in this example, be called and live in the namespace. It will save it's certificate's and files in a Kubernetes secret named . The name must match the we created above, and the certificate must live in the same namespace as the . Also don't forget to update your .


Before applying your certificate YAML, double check that your domain is resolvable to your Istio Ingress Gateway IP address

$ nslookup YOURDOMAIN.COM Non-authoritative answer: 

Once confirmed, apply your certificate:

$ kubectl apply -f my-certificate.yml created

Listing the secrets of namespace should now include the secret:

$ kubectl get secret -n istio-system NAME              TYPE                DATA  AGE 
[ ... ]
my-certificate-key Opaque 1 17m
my-ingress-cert 2 15s


With our SSL certificate in place, the last thing we need to do is route the incoming traffic to our pods. This is all done by Istio Gateways and VirtualServices. Let’s create our first Istio gateway. We’ll create a new Gateway named which will reside in the Kubernetes namespace. The gateway will listen on port 80 for and redirect traffic to HTTPS Port 443. The gateway will also be listening on HTTPS/443 for and use the certificate we created in the previous step,


Apply the gateway YAML file:

$ kubectl apply -f my-gateway.yml created

Virtual Services

The last component of this that we need to set up are the Virtual Services. Similar to those in NGINX or Apache, we need to configure the routes that Istio will direct traffic that comes in on to. These routes are called "Virtual Services" and are defined by yet another YAML file. The virtual service will route all requests to , , , , and through the gateway we created above and route it to the service of the application. This service was created when we deployed the bookinfo application in part 1 of this tutorial.

Apply your virtual services:

$ kubectl apply -f my-virtualservice.yml created

Hooray! You’ve done it! You should be able to go to and see the beautiful bookinfo example application deployed!

Web Developer, Marathon Runner, Coffee Drinker.