Istio: Part 2 – Surviving the Documentation

It’s been just over a week since I blogged my first Istio article: Part 1 – The Journey Begins. It’s unreal how much I now know about containerization and deployments versus a few days ago. It’s definitely been an interesting week.

Skills required to take on Istio

When I first looked at the documentation, most of it sounded Greek. I realized that I needed to backtrack a bit and get the required skills for the surrounding technologies in place. Don’t get me wrong, you can pretty much follow the instructions on the site and get the sample app working no problem. But will you understand what just happened?

Knowing what I know now, if you want to deploy the sample app to Bluemix and understand what’s happening, you need to have a good grasp on the following:

The documentation is well structured and caters for most scenarios when deploying to Bluemix. For example, if load balancing is running on your Bluemix cluster, you could access Grafana or Service Graph via an external IP. If load balancing is not running, you’ll need to access these via port-forwarding or service nodePort. The docs explain how to approach both.

One thing you’ll need to accept is that everything is done in the Terminal or Command Prompt. I actually prefer this to visual tools, but it does take getting used to if you’re not familiar with command line interfaces. Keep in mind also that you will be using the same environment for Docker, Kubernetes and other tools, so you might as well get used to it.

A lot of time was spent on showing off what Istio can do with just 1 sample app. Not only do they show you how to deploy the app to a Kubernetes cluster on Bluemix, but they also demonstrate features including:

Deploying updates to your Apps with absolutely no downtime

Dividing incoming traffic to certain app instances

Injecting faults and testing resiliency of your applications

Collecting metrics and logs and surfacing them through reporting tools like Grafana

By the time I was done with the documentation and tutorials, I found myself excited to get going with my own custom deployment.

Deploying my own app

Thanks to already having my own microservice ready to go, I took on the challenge of containerizing and deploying my app to a Kubernetes cluster on Bluemix and injecting Istio at the same time. Just one thing to note, which is a big Istio selling point: No changes are required to your actual code in order for Istio to work with it. For me, that’s huge!!!

Anyways, I containerized my app using Docker. I did this by grabbing an image from Docker Hub that already included Alpine Linux and Node.js. Within a few minutes my app was booting up inside the container. What’s even more impressive is that the total size of the uncompressed container was 54MB. I say uncompressed, because once I uploaded the container to Bluemix, it was compressed to 15MB 😱.

Next, I created a Kubernetes cluster on Bluemix. I then created a deployment file that would allow Kubernetes to set up pods for my app within the cluster. Some trial and error was needed here, but after a few attempts, my app was running on Bluemix and accessible via an external IP address.

Nearly there!

The next step was to reverse my deployment, because I need to re-deploy my container using Istio. This again took a few attempts, primarily because my app has an api that connects to an external service (MongoDB). Thankfully the documentation catered for this, explaining how to provide the necessary parameters to allow for external services. A few more attempts and my app was deployed.

Victory!!!

Well, at least I thought so. Whilst my app was running with Istio alongside it, I couldn’t get the additional features like reporting to work. I read the documentation multiple times, but unfortunately they don’t cover much troubleshooting when it comes to the metrics and logs. Thankfully my persistence paid off. After many tweaks to the deployment file, I was finally able to get the metrics showing up in Grafana. What a feeling!

Closing

All in all, I’m very impressed with Istio. I truly believe it to be a powerful tool. I already have plans to deploy a few apps for production use on Bluemix and will definitely be making use of Istio. There is still a lot to learn, but I’ve seen enough to know that this is a worthwhile investment.