<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ravi Verma</title>
    <description>The latest articles on DEV Community by Ravi Verma (@raviverma).</description>
    <link>https://dev.to/raviverma</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1083664%2F5fe5cc53-b072-4269-9c98-ba4af18a2e91.jpg</url>
      <title>DEV Community: Ravi Verma</title>
      <link>https://dev.to/raviverma</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/raviverma"/>
    <language>en</language>
    <item>
      <title>How to Implement Istio Ambient Mesh in GKE or AKS</title>
      <dc:creator>Ravi Verma</dc:creator>
      <pubDate>Wed, 24 May 2023 17:02:07 +0000</pubDate>
      <link>https://dev.to/raviverma/how-to-implement-istio-ambient-mesh-in-gke-or-aks-3edk</link>
      <guid>https://dev.to/raviverma/how-to-implement-istio-ambient-mesh-in-gke-or-aks-3edk</guid>
      <description>&lt;h2&gt;
  
  
  Why do you need Istio Ambient mesh ?
&lt;/h2&gt;

&lt;p&gt;It is given that Istio is a bit resource intensive due to sidecar proxy. Although there are a lot of compelling security features that can be used, the whole Istio (the sidecar) has to be deployed from day-1. Recently, the Istio community has reimagined a new data plane – ambient mode – which will be far less resource intensive. Istio ambient mesh is a modified and sidecar less data plane developed for enterprises that want to deploy mTLS and other security features first, and seek to deploy an advanced network later. Read more on what is &lt;a href="https://imesh.ai/blog/what-is-istio-ambient-mesh/"&gt;Istio Ambient mesh&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Ambient mesh has two layers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;L4 secure overlay layer or ztunnel: for implementing mTLS for communication between (services) nodes. Note, ztunne is a rust-based proxy. &lt;/li&gt;
&lt;li&gt;L7 processing layer or waypoint proxy: for accessing advanced L7 processing for security and networking, thus unlock full range of Istio capabilities&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pWE5lTAK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/Ambient-Mesh-architechture.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pWE5lTAK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/Ambient-Mesh-architechture.jpg" alt="Ambient Mesh architechture" width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this blog, we will explain how to implement Isito ambient mesh (with L4 and L7 authorization policies) in Google Kubernetes Engine and/or Azure AKS. &lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisite
&lt;/h2&gt;

&lt;p&gt;Please ensure you have the following software or infrastructure in your machine (I’ve use the following):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Kubernetes 1.23 or later. Version used for implementation: 1.25.6&lt;/li&gt;
&lt;li&gt;Istio 1.18.0-alpha.0 (Link: &lt;a href="https://github.com/istio/istio/releases/"&gt;https://github.com/istio/istio/releases/&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The current version of Istio Ambient mesh (1.18.0v) is in alpha and a few features might not work and it may not 100% be stable for production. At this time of the blog, the current version of Ambient mesh is not working with Calico CNI for now, so accordingly make your change in Google Kubernetes and Azure Kubernetes (refer the image below).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_seSo6DF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/GKE-configuration-for-Istio-ambient-mesh-1024x805.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_seSo6DF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/GKE-configuration-for-Istio-ambient-mesh-1024x805.png" alt="GKE configuration for Istio ambient mesh" width="800" height="629"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bzKqTUts--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/AKE-configuration-for-Istio-ambient-mesh-749x1024.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bzKqTUts--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/AKE-configuration-for-Istio-ambient-mesh-749x1024.png" alt="AKE configuration for Istio ambient mesh" width="749" height="1024"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Webinar on steps implementing Istio Ambient Mesh
&lt;/h2&gt;

&lt;p&gt;If you want to skip the steps and watch the video for implementing Istio Ambient mesh in Google Cloud, here you go:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/KTFf0OkNiMg"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps to implement Istio ambient mesh
&lt;/h2&gt;

&lt;p&gt;We will achieve the implementation of Istio ambient mesh with five major steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Installation of Istio ambient mesh&lt;/li&gt;
&lt;li&gt;Creating and configuring services in Kubernetes cluster&lt;/li&gt;
&lt;li&gt;Implement Istio ambient mode and verify ztunnel and HBONE&lt;/li&gt;
&lt;li&gt;Enabling L4 authorization for services using ambient mesh&lt;/li&gt;
&lt;li&gt;Enabling L7 authorization for services using ambient mesh&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Steps for installing Istio ambient mesh
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Step-1: Download and extract Istio ambient mesh from the Git repo
&lt;/h4&gt;

&lt;p&gt;You can go to Git repo &lt;a href="https://github.com/istio/istio/releases/tag/1.18.0-alpha.0"&gt;https://github.com/istio/istio/releases/tag/1.18.0-alpha.0&lt;/a&gt; and download and extract the Istio ambient mesh set up in your local system. (I’ve used the Windows version). Add /bin path to the environment path variable. &lt;/p&gt;

&lt;h4&gt;
  
  
  Step-2: Install Istio ambient mesh
&lt;/h4&gt;

&lt;p&gt;Use the following command to install Istio ambient mesh to your cluster.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;istioctl install -set profile=ambient
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Istio will install the following components- Istio core, Istiod, Istio CNI, Ingress gateways, Ztunnel, &lt;/p&gt;

&lt;h4&gt;
  
  
  Step-3: Check if ztunnel and Istio CNI are installed at node level
&lt;/h4&gt;

&lt;p&gt;After installation there will be a new namespace created named &lt;code&gt;istio-system&lt;/code&gt;. You can check the pods by running the below command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get pods -n istio-system -o wide
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since I have created two nodes, there are two ztunnel pods (daemonset) running here. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_AtcUTmG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/Check-ztunnel-pods-per-nodes-1024x70.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_AtcUTmG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/Check-ztunnel-pods-per-nodes-1024x70.png" alt="Check-ztunnel-pods-per-nodes" width="800" height="55"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Similarly you can use the following command to verify if Istio CNI is installed at the node level, by using the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get pods -n kube-system
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XNLrwBiH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh4.googleusercontent.com/UKp6RrZcbnciPUyYgExf_wAYCiBXcwfUxTfPVyA8gALvUt9XUI_3dNB5XcqJiHNcM3Dttq-hbAwsV2bPuKp7RwXgJQvptNlaitE5KA5w7iCIRbbXUubP97k4LXHVWkjOfKa5l46kGCGrV4LPqngljSE" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XNLrwBiH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh4.googleusercontent.com/UKp6RrZcbnciPUyYgExf_wAYCiBXcwfUxTfPVyA8gALvUt9XUI_3dNB5XcqJiHNcM3Dttq-hbAwsV2bPuKp7RwXgJQvptNlaitE5KA5w7iCIRbbXUubP97k4LXHVWkjOfKa5l46kGCGrV4LPqngljSE" alt="" width="800" height="44"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note: &lt;code&gt;istio-cni&lt;/code&gt; is deployed in &lt;code&gt;istio-system&lt;/code&gt; namespace in case of AKS.&lt;/p&gt;

&lt;h3&gt;
  
  
  Steps to create and configure services in Kubernetes cluster
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Step-1: Create namespace, named ambient for deployments
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl create namespace ambient
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step-2: Create two services in separate nodes.
&lt;/h4&gt;

&lt;p&gt;I have used the following yaml for creating &lt;code&gt;deployment.yaml&lt;/code&gt;, &lt;code&gt;service.yaml&lt;/code&gt; and &lt;code&gt;service-account.yaml&lt;/code&gt;. You can refer to the files in the Github repo: &lt;a href="https://github.com/IMESHinc/webinar"&gt;https://github.com/IMESHinc/webinar&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Code for &lt;code&gt;demo-deployment-1.yaml&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: apps/v1  
kind: Deployment  
metadata:  
  name: echoserver-depl-1  
  namespace: ambient  
  labels:  
    app: echoserver-depl-1  
spec:  
  replicas: 2  
  selector:  
    matchLabels:  
      app: echoserver-app-1  
  template:  
    metadata:  
      labels:  
        app: echoserver-app-1  
    spec:  
      serviceAccountName: echo-service-account-1  
      containers:  
      – name: echoserver-app-1  
        image: imeshai/echoserver  
        ports:  
        – containerPort: 80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Code for &lt;code&gt;demo-service-1.yaml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1  
kind: Service  
metadata:  
  name: echoserver-service-1  
  namespace: ambient  
spec:  
  selector:  
    app: echoserver-app-1  
  ports:  
  – port: 80  
    targetPort: 80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Code for &lt;code&gt;demo-service-account-1.yaml&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1  
kind: ServiceAccount  
metadata:  
  name: echo-service-account-1  
  namespace: ambient  
  labels:  
    account: echo-one
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly you can create deployments, service and service-account files for creating the 2nd service. &lt;/p&gt;

&lt;p&gt;Deploy two services in the Kubernetes cluster by using the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f demo-service-account-1.yaml  
kubectl apply -f demo-deployment-1.yaml  
kubectl apply -f demo-service-1.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can verify if your pods and svc are running by executing the following commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get pods -n &amp;lt;&amp;lt;namespace&amp;gt;&amp;gt;
kubectl get svc -n &amp;lt;&amp;lt;namespace&amp;gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Since I have selected two replicas for each service, Kubernetes automatically created the pods in each node to balance the loads. However, you can explicitly mention in the deployment yaml to create pods in two different nodes as well. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GUtxaYDn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/pods-running-on-different-nodes-1024x100.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GUtxaYDn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/pods-running-on-different-nodes-1024x100.png" alt="Pods running on different nodes" width="800" height="78"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step-3: Create Istio gateway and virtual services to allow external traffic to the newly created services
&lt;/h4&gt;

&lt;p&gt;Once the two services are created, we can create an ingress gateway to allow internet traffic to the newly created services. ( The names of my services are &lt;code&gt;echoserver-service-1&lt;/code&gt; and &lt;code&gt;echoserver-service-2&lt;/code&gt; respectively).&lt;/p&gt;

&lt;p&gt;I have created a &lt;code&gt;demo-gateway.yaml&lt;/code&gt; file (code below) to link to Istio ingress gateway.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: networking.istio.io/v1alpha3  
kind: Gateway  
metadata:  
  name: echoserver-gateway  
  namespace: ambient  
spec:  
  selector:  
    istio: ingressgateway  
  servers:  
  – port:  
      number: 80  
      name: http  
      protocol: HTTP  
    hosts:  
    – “\*” 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Code for Istio &lt;code&gt;VirtualService&lt;/code&gt; yaml file to route the traffic to &lt;code&gt;service1&lt;/code&gt; and &lt;code&gt;service2&lt;/code&gt; if the URL would match &lt;code&gt;/echo1&lt;/code&gt; and &lt;code&gt;/echo2&lt;/code&gt; respectively.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: networking.istio.io/v1alpha3  
kind: VirtualService  
metadata:  
  name: echoserver-virtual-service  
  namespace: ambient  
spec:  
  hosts:  
  – “\*”  
  gateways:  
  – echoserver-gateway  
  http:  
  – match:  
    – uri:  
        exact: /echo1  
    route:  
    – destination:  
        host: echoserver-service-1  
        port:  
          number: 80  
  – match:  
    – uri:  
        exact: /echo2  
    route:  
    – destination:  
        host: echoserver-service-2  
        port:  
          number: 80
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Apply the yaml files in the Kubernetes cluster to create Istio ingress gateway and virtual service objects.&lt;/p&gt;

&lt;p&gt;You can check the status of Istio Ingress gateway resource in the &lt;code&gt;Istio-system&lt;/code&gt; namespace by running the command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get service -n istio-system
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---W87pjEe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh5.googleusercontent.com/nJ2UkJqRUh1kff5t9ZjY70tM_10RVLo3J0Y2fn5QbxeP_j2qRqyG2PlBa0Xy69nfsjJn4Elk13fGFuevyJRzZLogBLCqIs5R7zRYpXbX3FX14ghGVTQMnv-3_j2ca_QOiiZhi8XKXfdO_NNE4LEWtyY" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---W87pjEe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh5.googleusercontent.com/nJ2UkJqRUh1kff5t9ZjY70tM_10RVLo3J0Y2fn5QbxeP_j2qRqyG2PlBa0Xy69nfsjJn4Elk13fGFuevyJRzZLogBLCqIs5R7zRYpXbX3FX14ghGVTQMnv-3_j2ca_QOiiZhi8XKXfdO_NNE4LEWtyY" alt="" width="800" height="54"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step-4: Access the services from the browser
&lt;/h4&gt;

&lt;p&gt;You can use the external IP address of the Istio gateway to access the services. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CR38uln8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/check-services-911x1024.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CR38uln8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/check-services-911x1024.png" alt="check services" width="800" height="899"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By default the communication will not go through the ztunnel of Istio ambient mesh. So we have to make it active by applying certain commands. &lt;/p&gt;

&lt;h3&gt;
  
  
  Steps to verify communication through ztunnel (mTLS) in ambient mesh
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Step-0 (Optional): Log the ztunnel and Istio CNI
&lt;/h4&gt;

&lt;p&gt;This is an optional step you can use to observe the logs of ztunnel and Istio CNI while transitioning of service communication to Istio ambient mode, you can apply these commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl logs -f &amp;lt;&amp;lt;istio-cni-pod-name&amp;gt;&amp;gt; -n kube-system
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl logs -f &amp;lt;&amp;lt;ztunnel-pod-name&amp;gt;&amp;gt; -n istio-system
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step-1: Apply ambient mesh to the namespace
&lt;/h4&gt;

&lt;p&gt;You need to apply Istio Ambient mesh to the namespace by using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl label namespace ambient istio.io/dataplane-mode=ambient
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both the services would be a part of the Istio ambient service mesh now. You can verify by again accessing them from the browser. &lt;/p&gt;

&lt;h4&gt;
  
  
  Step-2: Verify the communication through ztunnel of external traffic
&lt;/h4&gt;

&lt;p&gt;If you login to the browser and try to access the services (&lt;code&gt;echoserver-service-1&lt;/code&gt; and 2 for me), you will see the communication is already happening through the ztunnel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--prKlH0-w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh5.googleusercontent.com/qbnvlW1dET4SU6i_NQc4frOv1E8L1lQIdYd2Kw5iD4bvp5FnCslsuWw2NRh4g6rk9waZ8lM4C0ZDyuhsreSjWxtAsZiZUz_yCxYKAvqAE3bhdi9yRMKpCNBvdMey-ouF5QV8fO-kR7DSyX5ikiT5Huk" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--prKlH0-w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh5.googleusercontent.com/qbnvlW1dET4SU6i_NQc4frOv1E8L1lQIdYd2Kw5iD4bvp5FnCslsuWw2NRh4g6rk9waZ8lM4C0ZDyuhsreSjWxtAsZiZUz_yCxYKAvqAE3bhdi9yRMKpCNBvdMey-ouF5QV8fO-kR7DSyX5ikiT5Huk" alt="" width="800" height="41"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step-3: Verify the HBONE of service-to-service communication
&lt;/h4&gt;

&lt;p&gt;You can also verify if your service-to-service communication is secured by letting one pod to communicate with another (and then check the logs of ztunnel pods). &lt;/p&gt;

&lt;p&gt;Log into one of the pods of a service (say &lt;code&gt;echoserver-service-1&lt;/code&gt;) and use bash to send requests to another service (say &lt;code&gt;echoserver-service-2&lt;/code&gt;). &lt;/p&gt;

&lt;p&gt;You can use the following command to go to bash of one pod:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl exec -it &amp;lt;&amp;lt;pod name of service-1&amp;gt;&amp;gt; -n &amp;lt;&amp;lt;namespace&amp;gt;&amp;gt; –- bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use curl to send request to another services&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl &amp;lt;&amp;lt;service-2&amp;gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will see the in the logs of one of ztunnel pods that the communication is already happening over the HBONE (a secure overlay tunnel for communication between two pods in different nodes). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fJ42LAUz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/curl-command-and-checking-HBONE-1024x52.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fJ42LAUz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/curl-command-and-checking-HBONE-1024x52.png" alt="curl command and checking HBONE" width="800" height="41"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Step-4: Verification of mTLS-based communication in service-to-service communication
&lt;/h4&gt;

&lt;p&gt;Connect to ssh of one of the nodes to dump TCP packets and analyze the traffic request; we will understand if the communication between two nodes is going through the secure channel or not. &lt;/p&gt;

&lt;p&gt;Execute the following command in the node-ssh: (15008 port is used for HBONE communication in Istio ambient mesh). We will write the logs into &lt;code&gt;node1.pcap&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo tcpdump -nAi ens4 port 9080 or port 15008 -w node1.pcap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can curl a service from one pod and check the node logs (download &lt;code&gt;node1.pcap&lt;/code&gt; file), and when you open the file in the network analyzer, it would show something like below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Knhs7SXZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/nod1_pcap_network-analyser-1024x530.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Knhs7SXZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/nod1_pcap_network-analyser-1024x530.png" alt="nod1 pcap network analyzer" width="800" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will observe that all the application data exchanged between the two nodes are secured and using mTLS encryption. &lt;/p&gt;

&lt;h3&gt;
  
  
  Steps to create L4 authorization policies in Istio ambient mesh
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Step-1: Create an authorization policy yaml in Istio
&lt;/h4&gt;

&lt;p&gt;Create a &lt;code&gt;demo-authorization-L4.yaml&lt;/code&gt; file to write policies that would allow the public traffic to the service-1 containers only, and not from any other services. We have mentioned in the rules to allow the traffic from Istio ingress controller.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: security.istio.io/v1beta1  
kind: AuthorizationPolicy  
metadata:  
  name: echoserver-policy  
  namespace: ambient  
spec:  
  selector:  
    matchLabels:  
      app: echoserver-app-1  
  action: ALLOW  
  rules:  
  – from:  
    – source:  
        principals: [“cluster.local/ns/istio-system/sa/istio-ingressgateway-service-account”]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use the command to apply the yaml file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f demo-authorization-L4.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: Once you try to reach our &lt;code&gt;service-1&lt;/code&gt; (&lt;code&gt;echoserver-service-1&lt;/code&gt;) from the browser then you can access it without any problem. But if you curl from one of the pod of &lt;code&gt;service-2&lt;/code&gt;, it would fail (refer the screenshot). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--odb6aoI0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh3.googleusercontent.com/m0XRzPOMKgAEi4n0cY9KiP1p9UuSjfnAaxKkL-ISTGc7hOfFato6imuWEK_gasFM92IeD5b1tl1V36oB9UHN7h-Fbyxus3ppa3-tyo3aJ2dGRiG8j3KlQmn-5o6MjOaFDW3xHaVrwuZ0l15IWqvekU4" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--odb6aoI0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://lh3.googleusercontent.com/m0XRzPOMKgAEi4n0cY9KiP1p9UuSjfnAaxKkL-ISTGc7hOfFato6imuWEK_gasFM92IeD5b1tl1V36oB9UHN7h-Fbyxus3ppa3-tyo3aJ2dGRiG8j3KlQmn-5o6MjOaFDW3xHaVrwuZ0l15IWqvekU4" alt="" width="685" height="90"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Steps to create L7 authorization policies using waypoint proxy
&lt;/h3&gt;

&lt;p&gt;For L7 authorization policies we have to create a way-point proxy. The waypoint proxy can be configured using K8s gateway API. Note, by default the gateway API CRDs might not be available in most of the cloud providers, so we need to install it. &lt;/p&gt;

&lt;h4&gt;
  
  
  Step-1: Download Kubernetes gateway API CRDs
&lt;/h4&gt;

&lt;p&gt;Use the command to download gateway API CRDs using Kustomize.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl kustomize “github.com/kubernetes-sigs/gateway-api/crd?ref=v0.6.1” &amp;gt; gateway-api.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step-2: Apply Kubernetes gateway API
&lt;/h4&gt;

&lt;p&gt;Use the command to apply gateway API CRDs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f gateway-api.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step-3: Create waypoint proxy of Kubernetes gateway API kind
&lt;/h4&gt;

&lt;p&gt;We can create a waypoint proxy of gateway API with a yaml file. You can use the &lt;code&gt;demo-waypoint-1.yaml&lt;/code&gt;. We have basically created a waypoint proxy for &lt;code&gt;service-1&lt;/code&gt; (&lt;code&gt;echoserver-service-1&lt;/code&gt;).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: gateway.networking.k8s.io/v1beta1  
kind: Gateway  
metadata:  
  name: echoserver-gtw-1  
  namespace: ambient  
  annotations:  
    istio.io/for-service-account: echo-service-account-1  
spec:  
  gatewayClassName: istio-waypoint  
  listeners:  
  – allowedRoutes:  
      namespaces:  
        from: Same  
    name: imesh.ai  
    port: 15008  
    protocol: ALL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And apply this to the K8s cluster.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f demo-waypoint-1.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step-4: Create L7 authorization policy to declare the waypoint proxy for traffic
&lt;/h4&gt;

&lt;p&gt;Create L7 authorization policy to define rules when to apply the waypoint proxy (&lt;code&gt;echoserver-gtw-1&lt;/code&gt;) for traffic. You can use the following &lt;code&gt;demo-authorization-L7.yaml&lt;/code&gt; file to write the policy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: security.istio.io/v1beta1  
kind: AuthorizationPolicy  
metadata:  
  name: echoserver-policy  
  namespace: ambient  
spec:  
  selector:  
    matchLabels:  
      istio.io/gateway-name: echoserver-gtw-1  
  action: ALLOW  
  rules:  
  – from:  
    – source:  
        principals: [“cluster.local/ns/istio-system/sa/istio-ingressgateway-service-account”]  
    to:  
    – operation:  
        methods: [“GET”]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use the command to apply the yaml file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f demo-authorization-L7.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step-5: Verify the L7 authorization policy
&lt;/h4&gt;

&lt;p&gt;As we have created a waypoint proxy for &lt;code&gt;service-1&lt;/code&gt; and applied a policy to allow all traffic from the Istio ingress gateway, you will see you can still access &lt;code&gt;service-1&lt;/code&gt; (&lt;code&gt;echoserver-service-1&lt;/code&gt;) from the browser. &lt;/p&gt;

&lt;p&gt;However, if you want to access &lt;code&gt;service-1&lt;/code&gt; from one of the pods of &lt;code&gt;service-2&lt;/code&gt; (&lt;code&gt;echoserver-service-2&lt;/code&gt;), the waypoint proxy will not allow the traffic as per the policy (refer the screenshot below).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---laMKHwq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/failure-of-pod-to-pod-communication-with-authorization-policy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---laMKHwq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://imesh.ai/blog/wp-content/uploads/2023/03/failure-of-pod-to-pod-communication-with-authorization-policy.png" alt="failure of pod to pod communication with authorization policy" width="439" height="57"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Ambient mesh is very cost-efficient and less resource intensive in applying Istio in a staggered manner. We feel there will be more implementation of Istio after the ambient version. &lt;/p&gt;

&lt;p&gt;If you want to adopt enterprise Istio for your project and adopt it without any operation hassle, please feel free to &lt;a href="https://imesh.ai/contact-us.html"&gt;talk to an Istio expert&lt;/a&gt; or book &lt;a href="https://imesh.ai/request-an-istio-service-mesh-demo.html"&gt;an Istio demo&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>istio</category>
      <category>kubernetes</category>
      <category>serverless</category>
      <category>networking</category>
    </item>
  </channel>
</rss>
