Over a million developers have joined DZone.

Ambassador and Istio: Edge Proxy and Service Mesh

DZone's Guide to

Ambassador and Istio: Edge Proxy and Service Mesh

Learn how to get Ambassador, a Kubernetes-native API Gateway, working with Istio, a service mesh for microservices designed for observability, routing, and resilience.

· Microservices Zone ·
Free Resource

Deploy commerce faster and keep pace with the demands of your customers and executives. Read this blueprint to learn how to create your own microservices-based commerce foundation so you can quickly move onto building innovative and unique shopping experiences for your customers.

Ambassador is a Kubernetes-native API Gateway for microservices. Ambassador is deployed at the edge of your network, and routes incoming traffic to your internal services (aka "north-south" traffic). Istio is a service mesh for microservices, and designed to add L7 observability, routing, and resilience to service-to-service traffic (aka "east-west" traffic). Both Istio and Ambassador are built using Envoy.

Ambassador and Istio can be deployed together on Kubernetes. In this configuration, incoming traffic from outside the cluster is first routed through Ambassador, which then routes the traffic to Istio. Ambassador handles authentication, edge routing, TLS termination, and other traditional edge functions.

This allows the operator to have the best of both worlds: a high performance, modern edge service (Ambassador) combined with a state-of-the-art service mesh (Istio). Istio's basic ingress controller, the ingress controller is very limited and has no support for authentication or many of the other features of Ambassador.

Getting Ambassador Working With Istio

Getting Ambassador working with Istio is straightforward. In this example, we'll use the bookinfo sample application from Istio.

  1. Install Istio on Kubernetes, following the default instructions.
  2. Next, install the Bookinfo sample application, following the instructions.
  3. Verify that the sample application is working as expected.

By default, the Bookinfo application uses the Istio ingress. To use Ambassador, we need to:

  1. Install Ambassador. See the quickstart guide.
  2. Update the bookinfo.yaml manifest to include the necessary Ambassador annotations. See below.
apiVersion: v1
kind: Service
  name: productpage
    app: productpage
    getambassador.io/config: |
      apiVersion: ambassador/v0
      kind: Mapping
      name: productpage_mapping
      prefix: /productpage/
      rewrite: /productpage
      service: productpage:9080
  - port: 9080
    name: http
    app: productpage
  1. Optionally, delete the Ingress controller from the bookinfo.yamlmanifest by typing kubectl delete ingress gateway.
  2. Test Ambassador by going to $AMBASSADOR_IP/productpage/. You can get the actual IP address for Ambassador by typing kubectl get services ambassador.

Automatic Sidecar Injection

Newer versions of Istio support Kubernetes initializers to automatically inject the Istio sidecar. With Ambassador, you don't need to inject the Istio sidecar -- Ambassador's Envoy instance will automatically route to the appropriate service(s). If you're using automatic sidecar injection, you'll need to configure Istio to not inject the sidecar automatically for Ambassador pods. There are several approaches to doing this that are explained in the documentation.

A commerce architecture built by microservices allows for agile development, shorter release cycles, and faster time-to-market. Read this helpful guide to learn more about how to structure your commerce architecture with microservices.

service mesh ,envoy proxy ,istio ,api gateway ,kubernetes ,microservices ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}