Istio Setup — Part 1

Margaryta Chepiga
Open Source Adventure
7 min readJul 9, 2018
Photo by Joshua Earle on Unsplash

Istio is an open source platform to connect, manage, and secure micro-services.

Before we setup Istio, we need to install all the prerequisites.

What needs to be installed

  • Ansible 2.4 — powerful IT automation tool
  • Kubernetes 1.7.3 or newer — is an open-source system for automating deployment, scaling, and management of containerized applications

Installing Ansible

In order to set up Ansible, we have to make sure that we have Python 3.5 or newer installed.

Let’s check if we have a Python installed:

Now we can install Ansible and configure PPA. To do this I will run the following commands:

$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo apt-add-repository ppa:ansible/ansible
$ sudo apt-get update
$ sudo apt-get install ansible

So everything seems to be great so far. All the commands went through without any problems. Ansible installation went neat.

Coming back to Istio, besides Ansible we also need to install Kubernetes.

Installing Kubernetes

In order to install Kubernetes, we need to:

  • Install Dependencies
  • Install Docker — Docker provides a way to run applications securely isolated in a container, packaged with all its dependencies and libraries.
  • And only then, install Kubernetes itself :D

Installing Dependencies

$ sudo apt-get update && apt-get install -y apt-transport-https

Installing Docker

Next we need to install Docker. I found a great Medium article, which explains in details on how to do that. However, since we will use curl we need to install it first:

$ sudo apt install curl$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

By doing the above we are adding the GPG key for the official Docker repository to the system.

Next we need to add the Docker repository to APT sources:

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable edge"

Then following Grigor instructions, we need to make sure that we are about to install from the Docker repository instead of the default Ubuntu:

$ apt-cache policy docker-ce

Next step is to install Docker:

$ sudo apt-get install -y docker-ce

Now let’s hope that Docker got installed and everything went well. According to the article I found: “Docker should now be installed, the daemon started, and the process enabled to start on boot”. So now we can check if it is running, by typing the following:

$ sudo systemctl status docker

Now that we are done installing Docker, we can come back to the Kubenetes installation ( Thanks to Grigor, who happens to write an article on Kubernetes installation process too(!), most of the steps below were followed by his article).

Installing Kubernetes

First we need to install Kubernetes repository:

$ apt-get update && apt-get install -y apt-transport-https \
&& curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

Okay, so for some reasons running this gave me errors. After googling a little, and trying a couple of different things it got solved very easy & fast. Would be easier if the error message was a bit more descriptive, since the one I got was “(23) Failed writing body”. I don’t know how about you, but for me it’s not equal to “Hey! You are missing root access! Add sudo and your life will change! Yep, it’s that easy ;)”.

$ sudo apt update
$ sudo apt upgrade
$ sudo curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

Since, I already executed “apt-get install -y apt-transport-https \ “, I simply removed that part.

Next step:

$ sudo echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > sudo /etc/apt/sources.list.d/kubernetes.list

Now we need to update our packages:

$ sudo apt-get update

Now we need to install kubelet, kubeadm and kubernetes-cni.

$ sudo apt-get update
$ sudo apt-get install -y kubelet kubeadm kubernetes-cni

And when I tried to run the following commands, I failed.

Okay. What do we do next? We could sit and cry. We could complain about the world imperfections, guides, documentation and how everything keeps failing when you are trying to set up a software. Damn it, you can even complain on Windows! ( my personal favoirite haha). Or we could try to find a solution.

How? Simply start by googling the error message.

That’s what I did. I found a couple of solutions, but nothing worked for me. I was confused. Why does none of the solutions worked? Then I’ve decided to check the Ubuntu Package Search, where I’ve searched for kubelet, kubeadm, kebernetes-cni.

And found out that those packages are not available. Okay… Let’s check the official documentation of Kubernetes. According to the official documentation of Kubernetes and official documentation of Ubuntu, the easiest way to install Kubernetes is through conjure-up.

$ sudo snap install conjure-up --classic

Next step is to run:

$ conjure-up kubernetes

Running the above should display the following:

From the list, as you can see, I selected “Canonical Distribution of Kubernetes” and pressed Enter key.

Next screen is the selection of additional components:

I haven’t select any, and just pressed Enter key.

Next step is choosing a cloud:

I want to deploy on localhost. However, in order to do that, I need to install LXD. I followed the link that was provided, and according to the instructions provided, we need to run the following:

$ sudo snap install lxd

That worked great! Next step is:

$ /snap/bin/lxd init

That didn’t go that well though…

So I tried to run the same command with sudo. And that’s what happened:

To be honest, I had no idea which options to choose. I searched, but couldn’t find an answer. I was also limited in time, therefore, decided to go with defaults.

Next step is migration. According to the conjure-up docs, “Snaps are the recommended installation method. In upcoming Ubuntu releases the snap version of LXD will be the only recommended way of installing and using LXD. For the best experience, it is recommended to migrate from the deb LXD packaging” by running the following:

$ /snap/bin/lxd.migrate

It was a moment filled with pain. However, it was not the point when I got frustrated. I got frustrated when I searched for the solution, tried every suggestion I could find and there was still no progress made.

In situations like this, I always remember David’s Humphrey suggestion to walk away from the problem for some period of time. Therefore, my next decision was to drink a nice cup of coffee & have a great walk with my puppy in the park. To be continued…

--

--

Margaryta Chepiga
Open Source Adventure

Software Developer, known as overexcited girl who is passionate about technology