Get Started with Istio Ambient Mesh
Step by step guide to get started with Istio ambient mesh.
Ambient mesh is a new data plane mode for Istio introduced today. Following this getting started guide, you can experience how ambient mesh can simplify your application onboarding, help with ongoing operations, and reduce service mesh infrastructure resource usage.
Install Istio with Ambient Mode
- Download the preview version of Istio with support for ambient mesh.
- Check out supported environments. We recommend using a Kubernetes cluster that is version 1.21 or newer that has two nodes or more. If you don’t have a Kubernetes cluster, you can set up using locally (e.g. using kind as below) or deploy one in Google or AWS Cloud:
The ambient
profile is designed to help you get started with ambient mesh.
Install Istio with the ambient
profile on your Kubernetes cluster, using the istioctl
downloaded above:
After running the above command, you’ll get the following output that indicates these four components are installed successfully!
By default, the ambient profile has the Istio core, Istiod, ingress gateway, zero-trust tunnel agent (ztunnel) and CNI plugin enabled. The Istio CNI plugin is responsible for detecting which application pods are part of the ambient mesh and configuring the traffic redirection between the ztunnels. You’ll notice the following pods are installed in the istio-system namespace with the default ambient profile:
The istio-cni and ztunnel components are deployed as Kubernetes DaemonSets
which run on every node.
Each Istio CNI pod checks all pods co-located on the same node to see if these pods are part of the ambient mesh.
For those pods, the CNI plugin configures traffic redirection so that all incoming and outgoing traffic to the pods are redirected to the co-located ztunnel first.
As new pods are deployed or removed on the node, CNI plugin continues to monitor and update the redirection logic accordingly.
Deploy Your Applications
You’ll use the sample bookinfo application, which is part of your Istio download from previous steps. In ambient mode, you deploy applications to your Kubernetes cluster exactly the same way you would without Istio. This means you can have your applications running in your Kubernetes before you enable ambient mesh, and have them join the mesh without needing to restart or reconfigure your applications.
Note: sleep
and notsleep
are two simple applications that can serve as curl clients.
Connect productpage
to the Istio ingress gateway so you can access the bookinfo app from outside of the cluster:
Test your bookinfo application, it should work with or without the gateway. Note: you can replace istio-ingressgateway.istio-system
below with its load balancer IP (or hostname) if it has one:
Adding your application to the ambient mesh
You can enable all pods in a given namespace to be part of the ambient mesh by simply labeling the namespace:
Congratulations! You have successfully added all pods in the default namespace to the ambient mesh. The best part is that there is no need to restart or redeploy anything!
Send some test traffic:
You’ll immediately gain mTLS communication among the applications in the Ambient mesh.
If you are curious about the X.509 certificate for each identity, you can learn more about it by stepping through a certificate:
For example, the output shows the certificate for the sleep principle that is valid for 24 hours, issued by the local Kubernetes cluster.
Note: If you don’t get any output, it may mean ds/ztunnel
has selected a node that doesn’t manage any certificates. You can specify a specific ztunnel pod (e.g. istioctl pc secret ztunnel-tcn4m -n istio-system
) that manages either one of the sample application pods instead.
Secure application access
After you have added your application to ambient mesh, you can secure application access using L4 authorization policies.
This lets you control access to and from a service based on client workload identities, but not at the L7 level, such as HTTP methods like GET
and POST
.
L4 Authorization Policies
Explicitly allow the sleep
service account and istio-ingressgateway
service accounts to call the productpage
service:
Confirm the above authorization policy is working:
Layer 7 Authorization Policies
Using the Kubernetes Gateway API, you can deploy a waypoint proxy for the productpage
service that uses the bookinfo-productpage
service account. Any traffic going to the productpage
service will be mediated, enforced and observed by the Layer 7 (L7) proxy.
Note the gatewayClassName
has to be istio-mesh
for the waypoint proxy.
View the productpage
waypoint proxy status; you should see the details of the gateway resource with Ready
status:
Update our AuthorizationPolicy
to explicitly allow the sleep
service account and istio-ingressgateway
service accounts to GET
the productpage
service, but perform no other operations:
Confirm the above authorization policy is working:
With the productpage
waypoint proxy deployed, you’ll also automatically get L7 metrics for all requests to the productpage
service:
You’ll notice the metric with response_code=403
and some metrics response_code=200
, like below:
The metric shows two 403
responses when the source workload (notsleep
) calls the destination workload(productpage-v1
) along with source and destination principals via mutual TLS connection.
Control Traffic
Deploy a waypoint proxy for the review
service, using the bookinfo-review
service account, so that any traffic going to the review
service will be mediated by the waypoint proxy.
Apply the reviews
virtual service to control 90% traffic to reviews v1 and 10% traffic to reviews v2.
Confirm that roughly 10% traffic from the 100 requests go to reviews-v2
:
Wrapping up
The existing Istio resources continue to work, regardless if you choose to use the sidecar or ambient data plane mode.
Take a look at the short video to watch Lin run through the Istio ambient mesh demo in 5 minutes:
What’s next
We are super excited about the new Istio ambient data plane with its simple “ambient” architecture. Onboarding your applications onto a service mesh with ambient mode is now as easy as labeling a namespace. Your applications will gain instant benefits such as mTLS with cryptographic identity for mesh traffic and L4 observability. If you need to control access or routes or increase resiliency or gain L7 metrics among your applications in ambient mesh, you can apply waypoint proxies to your applications as needed. We’re big fans of paying for only what we need, as it not only saves resources but also saves operation cost from constantly updating many proxies! We invite you to try the new Istio ambient data plane architecture to experience how simple it is. We look forward to your feedback in the Istio community!