You have already used APIRules to expose your services to the outside world. To secure, connect, and monitor the services, you want to use Istio and learn more about its features and mechanisms.
Objectives
You have already used APIRules to expose your services to the outside world. To secure, connect, and monitor the services, you want to use Istio and learn more about its features and mechanisms.
Traffic management, in a nutshell, is the ability to take control of the flow of traffic in your service mesh. Without traffic management, requests are routed to any available service instance. In many cases, this is not desirable. For example, you want to redirect traffic based on rules, such as to forward only a certain percentage of traffic over to a new version of a service (a.k.a canary deployment). Or, before you let customers consume the new version of a service, you want to test it internally. So you can only route traffic to the latest service version for internal users (a.k.a dogfooding). Traffic management enables you to implement these scenarios.
The image depicts a scenario where you route only a fraction of the traffic to a new version of a backend service. Traffic is split up between the service's previous and the new version. With such a setup, you can test the new version of the service in production only on a subset of the users and roll back quickly if something goes wrong.
If the new version of the service works as expected, you can increase the percentage of traffic routed to the new version of the service.
But how does this work? Istio has a set of CRDs (Custom Resource Definitions) that you can use to define traffic rules.
In Istio, you have several resources that you can use for traffic management:
For a complete list of Istio's traffic management resources, see Traffic Management.
With an installation of Istio on Kubernetes, an Ingress Gateway is installed by default. This gateway is exposed through your cluster's external IP address.
With Gateway resources, you can configure the default Istio Ingress Gateway to expose your services using a custom domain name. You can also configure multiple Gateway resources to expose your services through different domains. In Kyma, the API Gateway module configures the Gateway kyma-gateway, which is enabled by default. This gateway is used to expose your services when you use a Kyma domain.
A Gateway resource looks like this:
1234567891011121314apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: foo-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*.foo.com"
You can use VirtualService resources to define the routing rules for your services based on the HTTP request path, headers, or query parameters.
A VirtualService resource looks like this:
12345678910111213141516171819apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: shop-route
spec:
gateways:
- foo-namespace/foo-gateway
hosts:
- shop.foo.com
http:
- route:
- destination:
host: shop
subset: v1
weight: 90
- destination:
host: shop
subset: v2
weight: 10
This VirtualService resource defines a routing rule for the shop service. The rule routes 90% of the traffic to version v1 of the service and 10% to the v2 version.
Istio supports way more features to define routing rules. You can find more information about it in the VirutalService documetnation.
You can use DestinationRule to group your Kubernetes service by subsets and define rules for each subset.
A DestinationRule resource looks like this:
12345678910111213apiVersion: networking.istio.io/v1beta1
kind: DestinationRule
metadata:
name: shop-route
spec:
host: shop
subsets:
- name: v1
labels:
version: v1
- name: v2
labels:
version: v2
The shop service is grouped into two subsets based on versions in the example above.
To learn more, see the DestinationRules documentation.
Istio's security features allow you to control the service mesh's security. With Istio, you don't have to implement security features such as traffic encryption by yourself. Istio enables you to secure the service-to-service communication in your service mesh by encrypting the traffic. These security features are essential to defend yourself against man-in-the-middle-attacks and prevent unauthorized access to your services by validating the caller's identity.
Securing the communication between services in your cluster is one of the primary use cases for Istio. Istio provides traffic encryption with mutual TLS (mTLS) and allows you to authenticate the caller's identity. Mutual TLS is a protocol that allows the client and the server to authenticate each other. Unlike TLS, which only allows the server to authenticate the client, mTLS allows both parties to authenticate each other. This is done by presenting certificates to each other.
To learn more about Istio's security features, see Security.
Since Istio intercepts all the traffic in your service mesh, it can provide you with detailed telemetry data for all service communication. This telemetry provides observability into the service mesh. To provide observability based on the collected telemetry data, Istio offers the following types:
To learn more about Istio's observability features, see Observability.
In SAP BTP, Kyma runtime, the Telemetry module provides observability features that can help you collect all relevant data in a Kyma cluster, for example, those provided by the Istio service mesh. The telemetry module also enriches the data and ships to a backend for further analysis. You'll learn more about observability in one of the future lessons.
In this lesson, you expanded your knowledge of Istio: you discovered how Istio helps with traffic management, security, and observability.
Log in to track your progress & complete quizzes