v1.0
Managed Kubernetes

How to deploy Istio as a Service Mesh for your Kubernetes Cluster

In this tutorial, you will learn step by step instructions to set up Istio as a service mesh for your Kubernetes cluster.

Overview

One of the challenges with a highly dynamic microservices architecture is creating and maintaining connections. As pods are updated, added, and removed, you need a mechanism to identify each pod and enable communication between them and other pods in the cluster. A service mesh is one way of managing the communications within your cluster. Network proxies are attached to each application container using the Sidecar pattern. Together these proxies operate and monitor communication within the Kubernetes cluster, and this is the service mesh. The service mesh manages security, works to optimize network performance within the cluster, and reports on the state of networking within the Kubernetes cluster.

Prerequisites

  • A valid Kubernetes cluster running a supported Kubernetes version (1.19, 1.20, 1.21, 1.22+). You can create one quickly for free using Platform9 Managed Kubernetes. Signup for a Free PMK Account Here and create your Kubernetes cluster using PMK. You can also use this guide on any other Kubernetes cluster you may have.
  • A Kubectl installation with your Kubernetes cluster from the step above configured as the primary cluster.
  • A single node master + worker cluster would be sufficient for this tutorial. We suggest a minimum of 4 VCPUS, 16 GB of RAM, and 30GB of HDD for each node of your Kubernetes cluster.

Step 1 - Install Istio

The first step is to log into the node and download Istio. We do that with the following command.

Bash
Copy

The command above will download the latest version of Istio to the current directory. At the time of writing, the newest version was 1.8.1. Navigate into the newly-created directory.

Bash
Copy

You’ll see the following content in this directory:

  • A LICENSE file
  • Sample applications in samples/ directory.
  • The istioctl client binary in the bin/ directory. istioctl is a helpful command line tool that enables you to install istio on your Kubernetes cluster node along with a set of other operations.

We need to add the bin directory to our path, so that we can invoke the istioctl CLI tool from anywhere on this node.

Bash
Copy

When you install Istio, you are able to choose from several configuration profiles. We will use the demo profile for this guide because it showcases the abilities of Istio with moderate resource usage. Other profiles are more appropriate for production deployments and custom configurations.

We will use istioctl to specify the demo profile and install the istio service.

Bash
Copy

The installation may take a few minutes to complete, but ultimately you’ll see output similar to that shown below.

Output
Copy

The final step is to add a namespace label to enable Istio to automatically inject Envoy sidecar proxies when you deploy your application pods later.

Bash
Copy

Istio is now deployed and configured on your Kubernetes cluster node. We are now ready to deploy a sample application and see Istio in action.

Step 2 - Deploy the BookInfo Application

Istio comes packaged with several sample applications in the sample directory under the installation folder. In this guide we will deploy the bookinfo application using kubectl. Run the following command from the root directory for the Istio installation.

Bash
Copy

The YAML configuration file creates several services for us. You can see a summary of all the installed services by running the following.

Bash
Copy
Output
Copy

We also need to ensure that all of the pods are ready to go, as this may take a little more time. We can see this on our node directly by executing kubectl get pods, or we can view their status on the Platform9 dashboard.

Bash
Copy

We need two (2) of each pod to have a status of running.

Output
Copy

Step 3 - Manage Istio Ingress

This configuration creates two resources in the cluster:

  • gateway.networking.istio.io/bookinfo-gateway
  • virtualservice.networking.istio.io/bookinfo

Istio includes an analysis tool that validates your istio installation. Now with everything we’ve completed deploying our application, we can use this tool to validate our namespace.

Bash
Copy
Output
Copy

For the next step, we need to determine if the environment has an internal or external load balancer. Execute the following command.

Bash
Copy

In the output, look for the EXTERNAL-IP. If the results show an IP Address or a Host Name, then you have an external load balancer. If the results show either or , you don’t have access to an external load balancer. Export the following Environment Variables (EVs) based on whether you have an external load balancer or not.

External Load Balancer

Bash
Copy

No External Load Balancer

Bash
Copy

With those EVs set, you can now set your Gateway URL.

Bash
Copy

Execute the following command to get the external address for the BookInfo application, and paste it into your web browser to access the application.

Bash
Copy

Monitoring Kubernetes and Istio

Bash
Copy

And now, let's deploy Kiali to view the dashboard.

Bash
Copy

We can open the dashboard using:

Bash
Copy

Further Reading

For more information on Istio as a Kubernetes service mesh, the latest documentation is available here If you’re looking for more information about service meshes, including tips on selecting and implementing a service mesh, the following articles have a great deal of helpful information. Comparing Kubernetes service mesh options and how to migrate between them

Next Steps

In this blog, we walked through a tutorial on setting up Istio as a Kubernetes service mesh using a PMK account. We hope you found this blog informative and engaging.

  Last updated