avatarArun Kumar Singh

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

6205

Abstract

</b>Istiod converts high level routing rules that control traffic behaviour into Envoy-specific configurations and propagates them to the sidecars at runtime.</li></ol><h2 id="3d5d">> — — — — — — Control Plane Components— — — — — -<</h2><p id="3d73">The control plane is shipped as a single binary Istiod<i> </i>and made of three components: <b>Pilot, Citadel, and Galley.</b></p><p id="9ece"><b>Pilot </b>Istio’s component that is responsible for configuring the data plane is called <a href="https://istio.io/docs/concepts/traffic-management/#pilot-and-envoy">Pilot</a>. It is responsible for communicating with the Envoy sidecars.</p><p id="a7a8"><b>Citadel <a href="https://istio.io/docs/concepts/security/"></a></b><a href="https://istio.io/docs/concepts/security/">Citadel</a> is the component that allows developers to build zero-trust environments based on service identity rather than network controls. It helps you in securing communication between k8s components.</p><p id="1bbc"><b>Galley </b>Galley provides configuration management services for Istio. It’s the interface for the underlying APIs with which the Istio control plane interacts. If new policies come in picture then Galley validates, process and deploy them.</p><p id="72a0" type="7">You would have heard about Mixer component as well. Mixer has been deprecated now. The functionality provided by Mixer has been moved into the Envoy proxies. Use of Mixer with Istio will only be supported through the 1.7 release of Istio.</p><figure id="9422"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*V9dI6qemWF2GFsXJ7X47Dw.png"><figcaption>Istio control plane</figcaption></figure><h2 id="c25c">> — — — — — — Data Plane Components — — — — — -<</h2><p id="c81e">Istio Data plane components are made of Envoy Proxies. These are layer 7 proxy. All traffic moves through these Envoy proxies. Istio provides few addons for monitoring and visualising this data. Responsible for :</p><ol><li>Service Discovery</li><li>Health Checks</li><li>Routing</li><li>Load balancing</li><li>Authentication</li><li>Authorisation</li><li>Observability</li></ol><figure id="a373"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*rmiC-y-9S5R0WzyJWUfFHQ.png"><figcaption>Data Plane and Control Plane</figcaption></figure><h1 id="cffe">Part-7: Istio Installation</h1><p id="9372">Before you move on, I assume you have clear understanding of following concepts:</p><ol><li>Kubernetes</li><li>Operators</li><li>Kubernetes Objetcs</li></ol><p id="37d4">Installation of Istio can be achieved via multiple ways. I will cover it using <b><i>istioctl</i></b> utility. I assume you have working kubernetes cluster and cluster-admin privileges available with the user.</p><p id="edd0">Download and install the Istio <b><i>istioctl </i></b>client binary. This binary will take care rest of the configuration deployment for you. This library will be on client machine and can help you to manage Istio cluster.</p><p id="a064"><b><i>istioctl </i></b>utility deploys Istio operator in Kubernetes cluster. This operator will help you to manage Istio components.</p><div id="766a"><pre>arun<span class="hljs-variable">@ubuntu</span><span class="hljs-symbol">:/istio</span><span class="hljs-variable"> </span><span class="hljs-title class_">ISTIO_VERSION</span>=<span class="hljs-number">1.7</span>.<span class="hljs-number">3</span> arun<span class="hljs-variable">@ubuntu</span><span class="hljs-symbol">:~/istio</span><span class="hljs-variable"> </span> arun<span class="hljs-variable">@ubuntu</span><span class="hljs-symbol">:/istio</span><span class="hljs-variable"> </span>curl -sL <span class="hljs-string">"https://github.com/istio/istio/releases/download/ISTIO_VERSION/istioctl-ISTIO_VERSION-linux-amd64.tar.gz"</span> | tar xz arun<span class="hljs-variable">@ubuntu</span><span class="hljs-symbol">:~/istio</span><span class="hljs-variable"> </span>sudo mv ./istioctl /usr/local/bin/istioctl arun<span class="hljs-variable">@ubuntu</span><span class="hljs-symbol">:/istio</span><span class="hljs-variable"> </span>sudo chmod +x /usr/local/bin/istioctl arun<span class="hljs-variable">@ubuntu</span><span class="hljs-symbol">:~/istio</span></pre></div><p id="2eba">Once you have downloaded this <b>istioctl, </b>initialise it.</p><blockquote id="f28a"><p>Doubt !</p></blockquote><p id="2ee2">How <b><i>istioctl </i></b>is connecting to Kubernetes Cluster ?</p><blockquote id="f33e"><p>Explanation !</p></blockquote><p id="bde0">By default it is using kubeconfig file on your default location. You can pass custom config details as well. Refer the <a href="https://istio.io/latest/docs/reference/commands/istioctl">documentation</a>.</p><div id="4e28"><pre>arun<span class="hljs-variable">@ubuntu</span><span class="hljs-symbol">:/istio</span><span class="hljs-variable">$ </span>istioctl operator init</pre></div><figure id="2fab"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*xMoWs_0-sG2LbWvPmh5AYw.png"><figcaption><b>istioctl</b></figcaption></figure><p id="68c2">Once done, lets check the detail in kubernetes cluster. This utility will create required objects and operators in kubernetes to run Istio Service Mesh. Istio Operator is installed into the <code>istio-operator</code> namespace.</p><figure id="3885"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*O7paixDLLG_2blPUhvf1og.png"><figcaption></figcaption></figure><p id="0306">Now Operator is ready to manage/deploy Istio !</p><h2 id="1330">Istio components Deployment</h2><p id="dce1">Istio comes up with built-in configuration profiles that can be used while deploying Istio components.</p><ol><li>default</li><li>demo</li><li>minimal:</li><li>remote:</li><li>empty:</li><li>preview:</li></ol><p id="7472">For more details on profiles, visit Istio documentation. We will use default profile.</p><figure id="99ee"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*Kl4hlAuiHh_ZOohtSD7uwQ.png"><figcaption>Istio profile image from Istio documentation</figcaption></figure><p id="63fb">If you want to list what profiles are available, run following command;</p><div id="2758"><pre>arun<span c

Options

lass="hljs-variable">@ubuntu</span><span class="hljs-symbol">:/istio</span><span class="hljs-variable"> </span>istioctl profile list</pre></div><p id="5dbf">If you want to view the configuration for default profile, you can dump is using following command.</p><div id="c968"><pre>arun<span class="hljs-variable">@ubuntu</span><span class="hljs-symbol">:~/istio</span><span class="hljs-variable"> </span>istioctl profile dump default > profile.yaml</pre></div><p id="76b3">Let’s install default profile. Do you know we can customise the profile as well. We can customise what addons we want to install, configuration etc.</p><p id="bd45">Create a file with following customisation details. [<a href="https://istio.io/latest/docs/reference/config/istio.operator.v1alpha1/">https://istio.io/latest/docs/reference/config/istio.operator.v1alpha1/</a>]</p><p id="d424">(IstioOperatorSpec defines the desired installed state of Istio components. Optionally you can install add-ons as well.)</p><div id="b225"><pre><span class="hljs-comment">#istio_default.yaml</span> <span class="hljs-attr">apiVersion:</span> <span class="hljs-string">install.istio.io/v1alpha1</span> <span class="hljs-attr">kind:</span> <span class="hljs-string">IstioOperator</span> <span class="hljs-attr">metadata:</span> <span class="hljs-attr">name:</span> <span class="hljs-string">istio-cp</span> <span class="hljs-attr">spec:</span> <span class="hljs-attr">profile:</span> <span class="hljs-string">default</span> <span class="hljs-attr">addonComponents:</span> <span class="hljs-attr">grafana:</span> <span class="hljs-attr">enabled:</span> <span class="hljs-literal">true</span> <span class="hljs-attr">prometheus:</span> <span class="hljs-attr">enabled:</span> <span class="hljs-literal">true</span> <span class="hljs-attr">tracing:</span> <span class="hljs-attr">enabled:</span> <span class="hljs-literal">true</span> <span class="hljs-attr">kiali:</span> <span class="hljs-attr">enabled:</span> <span class="hljs-literal">true</span> <span class="hljs-attr">values:</span> <span class="hljs-attr">kiali:</span> <span class="hljs-attr">dashboard:</span> <span class="hljs-attr">auth:</span> <span class="hljs-attr">strategy:</span> <span class="hljs-string">anonymous</span></pre></div><p id="9883">Once you are ready with the file, apply it via using kubectl utility.</p><div id="5da9"><pre>arun<span class="hljs-variable">@ubuntu</span><span class="hljs-symbol">:/istio</span><span class="hljs-variable"> </span>kubectl create ns istio-system</pre></div><div id="933b"><pre>arun<span class="hljs-variable">@ubuntu</span><span class="hljs-symbol">:~/istio</span><span class="hljs-variable"> </span>kubectl apply -f istio_default.yaml -n istio-system</pre></div><p id="e4de">It will start deploying Istio components. Once it is done, you are ready with Istio ! You can list all deployments in namespace <b>istio-system.</b></p><figure id="5029"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*Ow9pS6nWM6i3xSuTbeWHOw.png"><figcaption></figcaption></figure><figure id="9c65"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*PsJUTrTZbytx9mQFAv358w.png"><figcaption></figcaption></figure><p id="926c">You should verify logs as well.</p><figure id="6fc5"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*k7DF-x2soU-pOoMd2j9jgg.png"><figcaption></figcaption></figure><p id="2f62">To access the addons which we deployed (remember the config file) use istioctl utility. Let’s test grafana dashboard.</p><div id="c3ad"><pre>arun<span class="hljs-variable">@ubuntu</span><span class="hljs-symbol">:~/istio</span><span class="hljs-variable">$ </span>istioctl dashboard grafana</pre></div><figure id="1231"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*ApBMe7-CcYv8e1X661inlg.png"><figcaption></figcaption></figure><p id="4ec3">Utility will port-forward the connection to dashboard on 3000. You can access it now on localhost.</p><figure id="50c4"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*3oO5s4znbyexXJQXhuBI0g.png"><figcaption></figcaption></figure><p id="787f">This is the way, you can access other add-on as well. The next step will be to deploy your application and manage communication via Istio, that I will cover in upcoming posts.</p><p id="3c7d">If you want to remove everything :-</p><div id="7c2c"><pre>kubectl <span class="hljs-keyword">delete</span> istiooperator istio-cp -n istio-<span class="hljs-keyword">system</span> istioctl <span class="hljs-keyword">operator</span> remove kubectl <span class="hljs-keyword">delete</span> ns istio-<span class="hljs-keyword">system</span> kubectl <span class="hljs-keyword">delete</span> ns istio-<span class="hljs-keyword">operator</span></pre></div><p id="3cd6">Keep learning ! Stay safe.</p><div id="6a1d" class="link-block"> <a href="https://arunksingh16.medium.com/l4-and-l7-load-balancer-in-bullet-points-335defd76afb"> <div> <div> <h2>L4 and L7 Load Balancer in Bullet Points</h2> <div><h3>Load balancing can be performed at various layers in the Open Systems Interconnection (OSI) Reference Model.</h3></div> <div><p>arunksingh16.medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*Qt1c9ifpqnlnv3sxXwh2DQ.png)"></div> </div> </div> </a> </div><div id="2567" class="link-block"> <a href="https://istio.io/latest/docs/reference/commands/istioctl/"> <div> <div> <h2>istioctl</h2> <div><h3>Istio configuration command line utility for service operators to debug and diagnose their Istio mesh. Analyze Istio…</h3></div> <div><p>istio.io</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/)"></div> </div> </div> </a> </div></article></body>

TECH BASICS, CODEX

Getting Started with Service Mesh and Istio

Service Mesh and Istio

Part-1: Communication

If you are in modern software design field, you might have heard of service mesh architectures primarily in the context of Microservices. In this post my target is to give you basic understanding of Service Mesh and a popular Service Mesh solution Istio.

Let’s get started now. In all computing services, systems interact with each other to perform specific function or job. This communication may have certain specifications like encryption, protocol, ports, load balancing etc. This creates a sort of architectural challenge, that how all these components interact with each other and how should they communicate ? And the most prominent one, how we are going to manage this ? This gets pretty complex if you put Microservices or SOA (Service Oriented Architecture) based architecture in between.

Part-2: Monolithic Applications

Monolithic applications followed 3 tiered architecture and all components tend to tightly coupled with each other. Most of the time you will find all modules are packaged together as a single deployable unit of execution. These systems start small but tend to grow over time to meet business needs and eventually becoming very huge. Single package deployment, tightly coupled components etc create huge overload on Application Build, Management, Maintenance and DevOps cycle. To sort these issues modern systems have started looking at Microservices based Architecture. The system with multiple smaller components allowed IT Teams to handle requirements more gracefully.

Part-3: Microservices based Architecture

Large monolith applications are being decomposed into number of individual services to adapt Microservices based architecture, more suitable for modern deployment.

Microservice

It creates network of services, each performing a specific business function. In order to execute its function, one service might need to request data from several other services. Microservices are built independently, communicate with each other, and can individually fail without escalating into an application-wide outage. The exponential growth in Microservices create challenges like routing between multiple services/versions, authentication, authorization, encryption, and load balancing etc within a Kubernetes cluster. At the end, this operational overhead has ability to sink the Microservices ship as well.

Part-4: Service Mesh

Before we proceed let’s ask few questions first ?

Who has helped to manage Microservices deployment workload ? What Service Mesh is doing in Microservices based deployment ?

Containers/Container Orchestrator became the primary way to handle Microservices workload and Service Mesh sorted the inter-process communications challenges. In simple statement, Service Mesh manages the network traffic between services. Think of Service Mesh as a courier service who handles shipment for components. Now replace components with PODs and shipment with Data Packets.

Service mesh is the component or architecture pattern which separates this communication from components and abstracts it to a layer of infrastructure. Service mesh was born to improve agility in Microservices and are designed to solve the many challenges faced by Developers/DevOps. Service mesh has gained popularity since 2017, and it is still evolving.

How Service Mesh can help:

  1. Traffic Management
  2. Security — Authentication/Auth Encryption
  3. Monitoring

We can view service mesh as a decoupling agent. E.g.: Consider a situation, where there are multiple services which have to interact with each other. All communication need to be secure and encrypted. In this scenario, instead of Developer writing lines of code to work on SSL or identity, you can implement all of it using Service Mesh. So OPs can handle the security /identity part and Dev can work on other features. This is pretty common scenario in cloud-native deployments.

Doubt !

In Kubernetes, Service object provide similar kind of features like service to service communication out of the box, then why we need Service Mesh ?

Explanation

Actually Service Object in Kubernetes is kind of basic Service Mesh with limited capabilities. It has few features which can help in small deployments but we can not solely depend on K8s Service object for large scale deployments.

Part-5: Istio

Istio is an open source service mesh designed to help in maintaining reliable service-to-service connections. Istio is by far the most popular service mesh that works with Kubernetes very well.

  • Open Source
  • first release in 2017
  • platform agnostic

Part-6: Istio Architecture

An Istio service mesh can be logically split into two components, a data plane and a control plane.

  1. Data Plane — The Istio data plane is typically composed of Envoy proxies that are deployed as sidecars within each container on the Kubernetes pod.
  2. Control plane — The control plane manages and configures the proxies to route traffic. It also stores and manages the Istio configuration.

Istio has 2 core component -

  1. Envoy- Proxy Component, deployed as sidecar to interact with interact with data plane traffic.
  2. Istiod- Istiod converts high level routing rules that control traffic behaviour into Envoy-specific configurations and propagates them to the sidecars at runtime.

> — — — — — — Control Plane Components— — — — — -<

The control plane is shipped as a single binary Istiod and made of three components: Pilot, Citadel, and Galley.

Pilot Istio’s component that is responsible for configuring the data plane is called Pilot. It is responsible for communicating with the Envoy sidecars.

Citadel Citadel is the component that allows developers to build zero-trust environments based on service identity rather than network controls. It helps you in securing communication between k8s components.

Galley Galley provides configuration management services for Istio. It’s the interface for the underlying APIs with which the Istio control plane interacts. If new policies come in picture then Galley validates, process and deploy them.

You would have heard about Mixer component as well. Mixer has been deprecated now. The functionality provided by Mixer has been moved into the Envoy proxies. Use of Mixer with Istio will only be supported through the 1.7 release of Istio.

Istio control plane

> — — — — — — Data Plane Components — — — — — -<

Istio Data plane components are made of Envoy Proxies. These are layer 7 proxy. All traffic moves through these Envoy proxies. Istio provides few addons for monitoring and visualising this data. Responsible for :

  1. Service Discovery
  2. Health Checks
  3. Routing
  4. Load balancing
  5. Authentication
  6. Authorisation
  7. Observability
Data Plane and Control Plane

Part-7: Istio Installation

Before you move on, I assume you have clear understanding of following concepts:

  1. Kubernetes
  2. Operators
  3. Kubernetes Objetcs

Installation of Istio can be achieved via multiple ways. I will cover it using istioctl utility. I assume you have working kubernetes cluster and cluster-admin privileges available with the user.

Download and install the Istio istioctl client binary. This binary will take care rest of the configuration deployment for you. This library will be on client machine and can help you to manage Istio cluster.

istioctl utility deploys Istio operator in Kubernetes cluster. This operator will help you to manage Istio components.

arun@ubuntu:~/istio$ ISTIO_VERSION=1.7.3
arun@ubuntu:~/istio$ 
arun@ubuntu:~/istio$ curl -sL "https://github.com/istio/istio/releases/download/$ISTIO_VERSION/istioctl-$ISTIO_VERSION-linux-amd64.tar.gz" | tar xz
arun@ubuntu:~/istio$ sudo mv ./istioctl /usr/local/bin/istioctl
arun@ubuntu:~/istio$ sudo chmod +x /usr/local/bin/istioctl
arun@ubuntu:~/istio$

Once you have downloaded this istioctl, initialise it.

Doubt !

How istioctl is connecting to Kubernetes Cluster ?

Explanation !

By default it is using kubeconfig file on your default location. You can pass custom config details as well. Refer the documentation.

arun@ubuntu:~/istio$ istioctl operator init
istioctl

Once done, lets check the detail in kubernetes cluster. This utility will create required objects and operators in kubernetes to run Istio Service Mesh. Istio Operator is installed into the istio-operator namespace.

Now Operator is ready to manage/deploy Istio !

Istio components Deployment

Istio comes up with built-in configuration profiles that can be used while deploying Istio components.

  1. default
  2. demo
  3. minimal:
  4. remote:
  5. empty:
  6. preview:

For more details on profiles, visit Istio documentation. We will use default profile.

Istio profile image from Istio documentation

If you want to list what profiles are available, run following command;

arun@ubuntu:~/istio$ istioctl profile list

If you want to view the configuration for default profile, you can dump is using following command.

arun@ubuntu:~/istio$ istioctl profile dump default > profile.yaml

Let’s install default profile. Do you know we can customise the profile as well. We can customise what addons we want to install, configuration etc.

Create a file with following customisation details. [https://istio.io/latest/docs/reference/config/istio.operator.v1alpha1/]

(IstioOperatorSpec defines the desired installed state of Istio components. Optionally you can install add-ons as well.)

#istio_default.yaml
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
  name: istio-cp
spec:
  profile: default
  addonComponents:
    grafana:
      enabled: true
    prometheus:
      enabled: true
    tracing:
      enabled: true
    kiali:
      enabled: true
  values:
    kiali:
      dashboard:
        auth:
          strategy: anonymous

Once you are ready with the file, apply it via using kubectl utility.

arun@ubuntu:~/istio$ kubectl create ns istio-system
arun@ubuntu:~/istio$ kubectl apply -f istio_default.yaml -n istio-system

It will start deploying Istio components. Once it is done, you are ready with Istio ! You can list all deployments in namespace istio-system.

You should verify logs as well.

To access the addons which we deployed (remember the config file) use istioctl utility. Let’s test grafana dashboard.

arun@ubuntu:~/istio$ istioctl dashboard grafana

Utility will port-forward the connection to dashboard on 3000. You can access it now on localhost.

This is the way, you can access other add-on as well. The next step will be to deploy your application and manage communication via Istio, that I will cover in upcoming posts.

If you want to remove everything :-

kubectl delete istiooperator istio-cp -n istio-system
istioctl operator remove
kubectl delete ns istio-system 
kubectl delete ns istio-operator

Keep learning ! Stay safe.

Service Mesh
Istio
Kubernetes
Microservices
Monolith
Recommended from ReadMedium