{"componentChunkName":"component---src-pages-markdown-remark-fields-slug-js","path":"/engineering/istio-service-mesh/","result":{"data":{"markdownRemark":{"id":"63d288ed-cd2e-57db-911e-3f267b8ae61d","excerpt":"What is Istio? Istio is an Open Source service mesh (developed in partnership between teams from Google, IBM, and Lyft), providing a dedicated infrastructure…","html":"<h2 id=\"what-is-istio\" style=\"position:relative;\"><a href=\"#what-is-istio\" aria-label=\"what is istio permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is Istio?</h2>\n<p>Istio is an Open Source service mesh (developed in partnership between teams from Google, IBM, and Lyft), providing a dedicated infrastructure layer for creating service-to-service communication that is safe, fast, and reliable. Having such a fanatical communication layer can provide various advantages, like providing observability into communications, providing secure connections, or automating retries and backoff for failed requests.</p>\n<p>A service mesh also often has more complex operational requirements, like A/B testing, canary rollouts, rate limiting, access control, and end-to-end authentication.</p>\n<p>Istio does this by adding a sidecar proxy which intercepts all network communication between microservices, then configures and manages Istio using its control plane functionality, which incorporates:</p>\n<ol>\n<li>Granular control over the service-to-service communication and its routing with the additional functionality of retries, fault injection, circuit breakers.</li>\n<li>Providing secure mTLS without any changes in the application code.</li>\n<li>Cluster to cluster communication using ingress and egress gateways.</li>\n</ol>\n<h2 id=\"istio-architecture\" style=\"position:relative;\"><a href=\"#istio-architecture\" aria-label=\"istio architecture permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Istio Architecture</h2>\n<p>An Istio service mesh is logically split into a data plane and a control plane.</p>\n<p>The data plane is composed of Envoy proxy deployed as sidecars. Envoy itself is an L7 proxy and communication bus designed for modern microservices-based architecture. These proxies intercept and control all network communication between microservices. They also collect and report telemetry on all mesh traffic.</p>\n<p>The control plane manages and configures the proxies to route traffic.</p>\n<p><img src=\"https://istio.io/latest/docs/ops/deployment/architecture/arch.svg\" alt=\"Istio Architecture\"></p>\n<h2 id=\"istio-core-components\" style=\"position:relative;\"><a href=\"#istio-core-components\" aria-label=\"istio core components permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Istio Core Components</h2>\n<h3 id=\"pilot\" style=\"position:relative;\"><a href=\"#pilot\" aria-label=\"pilot permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Pilot</h3>\n<p>Istio Pilot manages and configures all the Envoy proxy instances deployed. It takes the rules for traffic behavior provided by the control plane and converts them into configurations applied by Envoy.</p>\n<h3 id=\"citadel\" style=\"position:relative;\"><a href=\"#citadel\" aria-label=\"citadel permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Citadel</h3>\n<p>Responsible for controlling the authentication and identity management between services. Allow developers to build a zero-trust network based on service identity.</p>\n<h3 id=\"mixer\" style=\"position:relative;\"><a href=\"#mixer\" aria-label=\"mixer permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Mixer</h3>\n<p>Responsible for enforcing access control and usage policies across the service mesh and collects telemetry data from the Envoy proxy and other services.</p>\n<h2 id=\"istio-features\" style=\"position:relative;\"><a href=\"#istio-features\" aria-label=\"istio features permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Istio Features</h2>\n<h3 id=\"traffic-management\" style=\"position:relative;\"><a href=\"#traffic-management\" aria-label=\"traffic management permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Traffic Management</h3>\n<p>It is the basic feature of Istio, which facilitates the routing between services. Istio simplifies the configuration of service-level properties like circuit breakers, timeouts, and retries.\nAll traffic that your mesh services send and receive (data plane traffic) is proxied through Envoy, making it easy to direct and control traffic around your mesh without making any changes to your services.</p>\n<p>For discovering all the services in the ecosystem, Istio connects to the Service discovery System and populates its service registry. The Envoy sidecar proxy then uses this registry to route traffic to the correct service.</p>\n<p>Here are a few resources you can add for your deployment apart from the basic service discovery and load balancing:</p>\n<h3 id=\"virtual-services\" style=\"position:relative;\"><a href=\"#virtual-services\" aria-label=\"virtual services permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Virtual Services</h3>\n<p>Virtual services play a key role in making Istio's traffic management flexible and powerful. They do this by strongly decoupling where clients send their requests from the destination workloads that actually implement them.<br>\nSo, instead of sending requests directly to a service data plane, you send traffic through this virtual service. Using virtual service, you can route requests to different versions of the same service or different hostnames based on particular endpoints. This helps us to do various other things like A/B testing or doing canary rollouts.  </p>\n<p>A typical example:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"yaml\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">apiVersion</span><span class=\"mtk1\">: </span><span class=\"mtk8\">networking.istio.io/v1alpha3</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">kind</span><span class=\"mtk1\">: </span><span class=\"mtk8\">VirtualService</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">metadata</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">name</span><span class=\"mtk1\">: </span><span class=\"mtk8\">bookinfo</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">spec</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">hosts</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    - </span><span class=\"mtk8\">bookinfo.com</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">http</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  - </span><span class=\"mtk4\">match</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    - </span><span class=\"mtk4\">uri</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">prefix</span><span class=\"mtk1\">: </span><span class=\"mtk8\">/reviews</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">route</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    - </span><span class=\"mtk4\">destination</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">host</span><span class=\"mtk1\">: </span><span class=\"mtk8\">reviews  &lt;-- Resolves to reviews.&lt;namespace&gt;.svc.cluster.local</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  - </span><span class=\"mtk4\">match</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    - </span><span class=\"mtk4\">uri</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">prefix</span><span class=\"mtk1\">: </span><span class=\"mtk8\">/ratings</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">route</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    - </span><span class=\"mtk4\">destination</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">host</span><span class=\"mtk1\">: </span><span class=\"mtk8\">ratings</span></span></code></pre>\n<h3 id=\"destination-rule\" style=\"position:relative;\"><a href=\"#destination-rule\" aria-label=\"destination rule permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Destination Rule</h3>\n<p>We use destination rules to configure what happens to traffic for that destination. Destination rules are applied after virtual service routing rules are evaluated, so they apply to the traffic's real destination.<br>\nUsing destination rules, we specify the subsets of the service using labels, which are then used by the virtual service to route requests to a particular subset. In addition to that, we can also customize traffic policy, load balancing policy, connection pool settings, mTLS, etc.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"yaml\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">apiVersion</span><span class=\"mtk1\">: </span><span class=\"mtk8\">networking.istio.io/v1alpha3</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">kind</span><span class=\"mtk1\">: </span><span class=\"mtk8\">DestinationRule</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">metadata</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">name</span><span class=\"mtk1\">: </span><span class=\"mtk8\">my-destination-rule</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">spec</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">host</span><span class=\"mtk1\">: </span><span class=\"mtk8\">my-svc</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">trafficPolicy</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">loadBalancer</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk4\">simple</span><span class=\"mtk1\">: </span><span class=\"mtk8\">RANDOM</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">subsets</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk3\">#### This will work only if we have defined version label in the deployment</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  - </span><span class=\"mtk4\">name</span><span class=\"mtk1\">: </span><span class=\"mtk8\">v1</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">labels</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk4\">version</span><span class=\"mtk1\">: </span><span class=\"mtk8\">v1</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  - </span><span class=\"mtk4\">name</span><span class=\"mtk1\">: </span><span class=\"mtk8\">v2</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">labels</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk4\">version</span><span class=\"mtk1\">: </span><span class=\"mtk8\">v2</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">trafficPolicy</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk4\">loadBalancer</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">simple</span><span class=\"mtk1\">: </span><span class=\"mtk8\">ROUND_ROBIN</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  - </span><span class=\"mtk4\">name</span><span class=\"mtk1\">: </span><span class=\"mtk8\">v3</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">labels</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk4\">version</span><span class=\"mtk1\">: </span><span class=\"mtk8\">v3</span></span></code></pre>\n<p>Here we have defined destination rule for service <strong>my-svc</strong> and defined subsets and traffic policy global and per subset.</p>\n<h3 id=\"gateway\" style=\"position:relative;\"><a href=\"#gateway\" aria-label=\"gateway permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Gateway</h3>\n<p>It is used to manage inbound and outbound traffic for your mesh, letting you specify which traffic you want to enter or leave the mesh. Gateway configurations are applied to standalone Envoy proxies running at the edge of the mesh, rather than sidecar Envoy proxies running alongside your service workloads. Using this, we can expose our services to the internet.  </p>\n<p>A typical example would be:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"yaml\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">apiVersion</span><span class=\"mtk1\">: </span><span class=\"mtk8\">networking.istio.io/v1alpha3</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">kind</span><span class=\"mtk1\">: </span><span class=\"mtk8\">Gateway</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">metadata</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">name</span><span class=\"mtk1\">: </span><span class=\"mtk8\">my-svc-gateway</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">namespace</span><span class=\"mtk1\">: </span><span class=\"mtk8\">test</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">spec</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">selector</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">istio</span><span class=\"mtk1\">: </span><span class=\"mtk8\">ingressgateway</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">servers</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  - </span><span class=\"mtk4\">port</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk4\">number</span><span class=\"mtk1\">: </span><span class=\"mtk7\">80</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk4\">name</span><span class=\"mtk1\">: </span><span class=\"mtk8\">http</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk4\">protocol</span><span class=\"mtk1\">: </span><span class=\"mtk8\">HTTP</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">hosts</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    - </span><span class=\"mtk8\">my-svc.example.com</span></span></code></pre>\n<p><strong>istio: ingressgateway</strong> is the gateway which is enabled by default after installation. We can create our custom gateway. Here, the hosts <strong>my-svc.example.com</strong> will resolve to the load balancer provided by the Istio by default. To use this gateway, one has to add config in the virtual service like for example:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"yaml\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">apiVersion</span><span class=\"mtk1\">: </span><span class=\"mtk8\">networking.istio.io/v1alpha3</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">kind</span><span class=\"mtk1\">: </span><span class=\"mtk8\">VirtualService</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">metadata</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">name</span><span class=\"mtk1\">: </span><span class=\"mtk8\">my-svc</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">spec</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">hosts</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  - </span><span class=\"mtk8\">my-svc</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  - </span><span class=\"mtk8\">my-svc.example.com   &lt;-- The host should match</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">gateways</span><span class=\"mtk1\">:               </span><span class=\"mtk8\">&lt;--- gateway config</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    - </span><span class=\"mtk8\">my-svc-gateway</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">http</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  - </span><span class=\"mtk4\">route</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    - </span><span class=\"mtk4\">destination</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">host</span><span class=\"mtk1\">: </span><span class=\"mtk8\">my-svc.test.svc.cluster.local</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk4\">port</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">          </span><span class=\"mtk4\">number</span><span class=\"mtk1\">: </span><span class=\"mtk7\">80</span><span class=\"mtk1\"> </span></span></code></pre>\n<h3 id=\"network-resilience\" style=\"position:relative;\"><a href=\"#network-resilience\" aria-label=\"network resilience permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Network Resilience</h3>\n<p>This feature provides network configuration dynamically at runtime, which includes retries, fault injection, circuit breakers, and timeouts.</p>\n<h3 id=\"service-entries\" style=\"position:relative;\"><a href=\"#service-entries\" aria-label=\"service entries permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Service Entries</h3>\n<p>This object is used to add an external service as part of the service mesh, including a service running in a VM or other K8s cluster in case of multi-cluster installation.</p>\n<p>A typical example would be connecting a service to a database cluster that is not part of the mesh.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"yaml\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">apiVersion</span><span class=\"mtk1\">: </span><span class=\"mtk8\">networking.istio.io/v1alpha3</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">kind</span><span class=\"mtk1\">: </span><span class=\"mtk8\">ServiceEntry</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">metadata</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">name</span><span class=\"mtk1\">: </span><span class=\"mtk8\">elasticsearch</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">namespace</span><span class=\"mtk1\">: </span><span class=\"mtk8\">test</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">spec</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">hosts</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  - </span><span class=\"mtk8\">elasticsearch.elasticsearch.svc.cluster.local</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">location</span><span class=\"mtk1\">: </span><span class=\"mtk8\">MESH_INTERNAL</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">ports</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  - </span><span class=\"mtk4\">name</span><span class=\"mtk1\">: </span><span class=\"mtk8\">https</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">number</span><span class=\"mtk1\">: </span><span class=\"mtk7\">9200</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">protocol</span><span class=\"mtk1\">: </span><span class=\"mtk8\">TCP</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">resolution</span><span class=\"mtk1\">: </span><span class=\"mtk8\">DNS</span></span></code></pre>\n<p>The Service Entry should be in the same namespace as that of the calling service. This is helpful, especially in the case where the service is not exposed to a public endpoint and can be accessed using internal service DNS like the above example.</p>\n<h3 id=\"security\" style=\"position:relative;\"><a href=\"#security\" aria-label=\"security permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Security</h3>\n<p>Istio provides security features that will help us to establish a zero-trust network. Istio enables security by default and provides various authentication and authorization policy to regulate security.</p>\n<p>For example:</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"yaml\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">apiVersion</span><span class=\"mtk1\">: </span><span class=\"mtk8\">security.istio.io/v1beta1</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">kind</span><span class=\"mtk1\">: </span><span class=\"mtk8\">PeerAuthentication</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">metadata</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">name</span><span class=\"mtk1\">: </span><span class=\"mtk8\">dsl-es</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">namespace</span><span class=\"mtk1\">: </span><span class=\"mtk8\">pdp-test</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">spec</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">selector</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">matchLabels</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">      </span><span class=\"mtk4\">app</span><span class=\"mtk1\">: </span><span class=\"mtk8\">dsl-es</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk4\">mtls</span><span class=\"mtk1\">:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">mode</span><span class=\"mtk1\">: </span><span class=\"mtk8\">STRICT</span></span></code></pre>\n<p>Here we define a peer authentication object for a service labeled <strong>my-svc</strong>, which tells that any service that needs to talk to <strong>my-svc</strong> will communicate using mtls. The service will accept only TLS connection. By default, Istio enables <strong>PERMISSIVE</strong> mode, which accepts both plaintext and encrypted communication. </p>\n<p>We can define peer authentication on the mesh, namespace, and pod level.</p>\n<p>That is all for the introduction to Istio. In the next part, we will look at installing Istio and configuring services to use Istio.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n</style>","headings":[{"value":"What is Istio?","depth":2},{"value":"Istio Architecture","depth":2},{"value":"Istio Core Components","depth":2},{"value":"Pilot","depth":3},{"value":"Citadel","depth":3},{"value":"Mixer","depth":3},{"value":"Istio Features","depth":2},{"value":"Traffic Management","depth":3},{"value":"Virtual Services","depth":3},{"value":"Destination Rule","depth":3},{"value":"Gateway","depth":3},{"value":"Network Resilience","depth":3},{"value":"Service Entries","depth":3},{"value":"Security","depth":3}],"fields":{"slug":"/engineering/istio-service-mesh/"},"frontmatter":{"metatitle":null,"metadescription":null,"description":"This post will give a high-level introduction to Istio and its related concepts and terminologies.","title":"Istio Service Mesh: A Beginners Guide","canonical":null,"date":"December 07, 2020","updated_date":null,"tags":["Istio","Service Mesh"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/452f4d9f7cb358e3d6224ed3aba3d5d6/03979/Istio.png","srcSet":"/static/452f4d9f7cb358e3d6224ed3aba3d5d6/f5f11/Istio.png 200w,\n/static/452f4d9f7cb358e3d6224ed3aba3d5d6/6d133/Istio.png 400w,\n/static/452f4d9f7cb358e3d6224ed3aba3d5d6/03979/Istio.png 800w,\n/static/452f4d9f7cb358e3d6224ed3aba3d5d6/0d359/Istio.png 900w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Piyush Kumar","github":"kpiyush17","bio":"Software Engineer","avatar":null}}}},"pageContext":{"id":"63d288ed-cd2e-57db-911e-3f267b8ae61d","fields__slug":"/engineering/istio-service-mesh/","__params":{"fields__slug":"engineering"}}},"staticQueryHashes":["1171199041","1384082988","1711371485","1753898100","2100481360","229320306","23180105","528864852"]}