-
Notifications
You must be signed in to change notification settings - Fork 1.6k
multicluster traffic management #10486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
82627ab
multicluster traffic management
5da67fa
restructure
8890deb
locality section
51d5ff4
restructure #2
1f2c246
remove locality
f18964b
top level headers
b986db5
touchup
54893f0
s/subsettings/subset/
stevenctl b9d4379
blanks
stevenctl fe45fe2
Update content/en/docs/ops/configuration/traffic-management/multiclus…
f1e173d
Update content/en/docs/ops/configuration/traffic-management/multiclus…
4d40b03
Update content/en/docs/ops/configuration/traffic-management/multiclus…
744f94d
Update content/en/docs/ops/configuration/traffic-management/multiclus…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -570,6 +570,7 @@ mysql | |
mysqldb | ||
Nambiar | ||
namespace | ||
namespaced | ||
namespaces | ||
Naser | ||
natively | ||
|
124 changes: 124 additions & 0 deletions
124
content/en/docs/ops/configuration/traffic-management/multicluster/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
--- | ||
title: Multi-cluster Traffic Management | ||
description: How to configure how traffic is distributed among clusters in the mesh. | ||
weight: 70 | ||
keywords: [traffic-management,multicluster] | ||
owner: istio/wg-networking-maintainers | ||
test: no | ||
--- | ||
|
||
Within a multicluster mesh, traffic rules specific to the cluster topology may be desirable. This document describes | ||
a few ways to manage traffic in a multicluster mesh. Before reading this guide: | ||
|
||
1. Read [Deployment Models](/docs/ops/deployment/deployment-models/#multiple-clusters) | ||
1. Make sure your deployed services follow the concept of {{< gloss "namespace sameness" >}}namespace sameness{{< /gloss >}}. | ||
|
||
## Keeping traffic in-cluster | ||
|
||
In some cases the default cross-cluster load balancing behavior is not desirable. To keep traffic "cluster-local" (i.e. | ||
traffic sent from `cluster-a` will only reach destinations in `cluster-a`), mark hostnames or wildcards as `clusterLocal` | ||
using [`MeshConfig.serviceSettings`](/docs/reference/config/istio.mesh.v1alpha1/#MeshConfig-ServiceSettings-Settings). | ||
|
||
For example, you can enforce cluster-local traffic for an individual service, all services in a particular namespace, or globally for all services in the mesh, as follows: | ||
|
||
{{< tabset category-name="meshconfig" >}} | ||
|
||
{{< tab name="per-service" category-value="service" >}} | ||
|
||
{{< text yaml >}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should give more context. What CRD is this, and were is it applied? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will do. |
||
serviceSettings: | ||
- settings: | ||
clusterLocal: true | ||
hosts: | ||
- "mysvc.myns.svc.cluster.local" | ||
{{< /text >}} | ||
|
||
{{< /tab >}} | ||
|
||
{{< tab name="per-namespace" category-value="namespace" >}} | ||
|
||
{{< text yaml >}} | ||
serviceSettings: | ||
- settings: | ||
clusterLocal: true | ||
hosts: | ||
- "*.myns.svc.cluster.local" | ||
{{< /text >}} | ||
|
||
{{< /tab >}} | ||
|
||
{{< tab name="global" category-value="global" >}} | ||
|
||
{{< text yaml >}} | ||
serviceSettings: | ||
- settings: | ||
clusterLocal: true | ||
hosts: | ||
- "*" | ||
{{< /text >}} | ||
|
||
{{< /tab >}} | ||
|
||
{{< /tabset >}} | ||
|
||
## Partitioning Services {#partitioning-services} | ||
|
||
[`DestinationRule.subsets`](/docs/reference/config/networking/destination-rule/#Subset) allows partitioning a service | ||
by selecting labels. These labels can be the labels from Kubernetes metadata, or from [built-in labels](/docs/reference/config/labels/). | ||
One of these built-in labels, `topology.istio.io/cluster`, in the subset selector for a `DestinationRule` allows | ||
creating per-cluster subsets. | ||
|
||
{{< text yaml >}} | ||
apiVersion: networking.istio.io/v1beta1 | ||
kind: DestinationRule | ||
metadata: | ||
name: mysvc-per-cluster-dr | ||
spec: | ||
host: mysvc.myns.svc.cluster.local | ||
subsets: | ||
- name: cluster-1 | ||
labels: | ||
topology.istio.io/cluster: cluster-1 | ||
- name: cluster-2 | ||
labels: | ||
topology.istio.io/cluster: cluster-2 | ||
{{< /text >}} | ||
|
||
Using these subsets you can create various routing rules based on the cluster such as [mirroring](/docs/tasks/traffic-management/mirroring/) | ||
or [shifting](/docs/tasks/traffic-management/traffic-shifting/). | ||
|
||
This provides another option to create cluster-local traffic rules by restricting the destination subset in a `VirtualService`: | ||
|
||
{{< text yaml >}} | ||
apiVersion: networking.istio.io/v1beta1 | ||
kind: VirtualService | ||
metadata: | ||
name: mysvc-cluster-local-vs | ||
spec: | ||
hosts: | ||
- mysvc.myns.svc.cluster.local | ||
http: | ||
- name: "cluster-1-local" | ||
match: | ||
- sourceLabels: | ||
topology.istio.io/cluster: "cluster-1" | ||
route: | ||
- destination: | ||
host: mysvc.myns.svc.cluster.local | ||
subset: cluster-1 | ||
- name: "cluster-2-local" | ||
match: | ||
- sourceLabels: | ||
topology.istio.io/cluster: "cluster-2" | ||
route: | ||
- destination: | ||
host: mysvc.myns.svc.cluster.local | ||
subset: cluster-2 | ||
{{< /text >}} | ||
|
||
Using subset-based routing this way to control cluster-local traffic, as opposed to | ||
[`MeshConfig.serviceSettings`](/docs/reference/config/istio.mesh.v1alpha1/#MeshConfig-ServiceSettings-Settings), | ||
has the downside of mixing service-level policy with topology-level policy. | ||
For example, a rule that sends 10% of traffic to `v2` of a service will need twice the | ||
number of subsets (e.g., `cluster-1-v2`, `cluster-2-v2`). | ||
This approach is best limited to situations where more granular control of cluster-based routing is needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: Namespace Sameness | ||
test: n/a | ||
--- | ||
|
||
Within a multicluster mesh, [namespace sameness](https://github.com/kubernetes/community/blob/master/sig-multicluster/namespace-sameness-position-statement.md) | ||
applies and all namespaces with a given name are considered to be the same namespace. If multiple clusters contain a | ||
`Service` with the same namespaced name, they will be recognized as a single combined service. By default, traffic is | ||
load-balanced across all clusters in the mesh for a given service. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.