If you are interested in Cloud Native Technologies you must have heard about Istio already. Istio had been making its way into the hearts of developers and DevOps alike. Due to its ability to provide resiliency, security, observability to services with little to no changes to the code makes our lives easier.

However, I will not be going into Istio concepts in this blog post. Instead, this will be focussed on those of you who are trying to extend Istio and had been having no luck finding proper instructions on building Istio. This post will walk you through building Istio and Istio proxy from source.

Prerequisites

The following prerequisites need to be met before proceeding with building Istio.

  • Git
  • GoLang
  • Docker
  • kubectl installed and configured to access your Kubernetes cluster

Before getting started the following environment variables should be set to configure the development environment for the build scripts.

  • export HUB=<Docker Hub username>
  • export TAG=<The tag to be used in the images>
  • export USE_LOCAL_PROXY=1
  • export GOOS=linux

We can skip the step exporting USE_LOCAL_PROXY if you do not wish to build Istio proxy and would like to use the one provided Istio.

Cloning the Repositories

We will be cloning the Istio main repository and the Istio Proxy repository. These repositories need to be cloned in the same directory level because Istio’s build depends on the directory structure to use the custom built Proxy.

Note: Since Istio is under active development the current repository might not be working as intended. Therefore, you can consider checking out a tag or a branch as per your requirements.

The Istio main repository contains most of the core components of Istio. By building this we can get the CRDs, istio.yaml and other artifacts that istio offers in their default distribution. The istio-proxy sidecar is not included in this repository and it is fetched from docker (we can also configure the build to fetch a locally built proxy) during the build process.

  • Navigate to the <GO_PATH>/src/istio.io/ directory
  • Run git clone https://github.com/istio/istio.git to clone the repository

The Istio Proxy repository contains the Envoy proxy that istio uses as a sidecar to provide security, observability and other advantages. Istio had some done some changes to the original Envoy proxy to improve it and make it work with Istio.

We can skip this step and use the pre-built docker image during the Istio build if we do not intend to do any changed to the Proxy.

Building Istio Proxy

We will now build the Istio Proxy repository. As mentioned before we can skip this step if you do not want to build your own Istio Proxy. This will build the artifacts required to run the Proxy. However, the istio-proxy docker image will be created in the next step while Building Istio.

  • Install the pre-requisites for building Envoy Proxy
  • Navigate to <GO_PATH>/src/istio.io/proxy directory
  • Run make

Building Istio

We can now finally build Istio. Building istio involves several steps in which we will generate the docker images (in the local docker registry) and then push them to docker hub. Then the last step involves building the yaml files which contains the images that was generated during the build.

  • Navigate to <GO_PATH>/src/istio.io/istio directory
  • Run make dockerto build the docker images
  • Run make push to push the docker images to Docker Hub
  • Run make generate_yaml to generate the K8s yaml files for Istio

Using Istio

We can now use what we built. The following steps involves applying the CRDs and the istio.yaml (similar to what Istio has in their documentation). You can also use other resources generated in the install directory.

  • Navigate to <GO_PATH>/src/istio.io/istio
  • Run kubectl apply -f install/kubernetes/helm/istio/templates/crds.yaml
  • Runkubectl apply -f install/kubernetes/istio.yaml

Don’t forget to clap a few times if this was helpful!

Written by

Senior Software Engineer at WSO2

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store