|
1 | 1 | // Module included in the following assemblies:
|
2 | 2 | //
|
3 |
| -// * configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-ingress-controller.adoc |
4 | 3 | // * ingress-operator.adoc
|
| 4 | +// * networking/ingress-sharding.adoc |
5 | 5 |
|
| 6 | +:_content-type: CONCEPT |
6 | 7 | [id="nw-ingress-sharding_{context}"]
|
7 | 8 | = Ingress Controller sharding
|
8 | 9 |
|
9 |
| -As the primary mechanism for traffic to enter the cluster, the demands on the Ingress Controller, or router, can be significant. As a cluster administrator, you can shard the routes to: |
| 10 | +You can use Ingress sharding, also known as router sharding, to distribute a set of routes across multiple routers by adding labels to routes, namespaces, or both. The Ingress Controller uses a corresponding set of selectors to admit only the routes that have a specified label. Each Ingress shard comprises the routes that are filtered using a given selection expression. |
| 11 | + |
| 12 | +As the primary mechanism for traffic to enter the cluster, the demands on the Ingress Controller can be significant. As a cluster administrator, you can shard the routes to: |
10 | 13 |
|
11 | 14 | * Balance Ingress Controllers, or routers, with several routes to speed up responses to changes.
|
12 | 15 | * Allocate certain routes to have different reliability guarantees than other routes.
|
13 | 16 | * Allow certain Ingress Controllers to have different policies defined.
|
14 | 17 | * Allow only specific routes to use additional features.
|
15 | 18 | * Expose different routes on different addresses so that internal and external users can see different routes, for example.
|
| 19 | +* Transfer traffic from one version of an application to another during a blue green deployment. |
| 20 | +
|
| 21 | +When Ingress Controllers are sharded, a given route is admitted to zero or more Ingress Controllers in the group. A route's status describes whether an Ingress Controller has admitted it or not. An Ingress Controller will only admit a route if it is unique to its shard. |
| 22 | + |
| 23 | +An Ingress Controller can use three sharding methods: |
| 24 | + |
| 25 | +* Adding only a namespace selector to the Ingress Controller, so that all routes in a namespace with labels that match the namespace selector are in the Ingress shard. |
| 26 | +
|
| 27 | +* Adding only a route selector to the Ingress Controller, so that all routes with labels that match the route selector are in the Ingress shard. |
| 28 | +
|
| 29 | +* Adding both a namespace selector and route selector to the Ingress Controller, so that routes with labels that match the route selector in a namespace with labels that match the namespace selector are in the Ingress shard. |
| 30 | +
|
| 31 | +With sharding, you can distribute subsets of routes over multiple Ingress Controllers. These subsets can be non-overlapping, also called _traditional_ sharding, or overlapping, otherwise known as _overlapped_ sharding. |
| 32 | + |
| 33 | +== Traditional sharding example |
| 34 | + |
| 35 | +An Ingress Controller `finops-router` is configured with the label selector `spec.namespaceSelector.matchLabels.name` set to `finance` and `ops`: |
| 36 | + |
| 37 | +.Example YAML definition for `finops-router` |
| 38 | +[source,yaml] |
| 39 | +---- |
| 40 | +apiVersion: v1 |
| 41 | +items: |
| 42 | +- apiVersion: operator.openshift.io/v1 |
| 43 | + kind: IngressController |
| 44 | + metadata: |
| 45 | + name: finops-router |
| 46 | + namespace: openshift-ingress-operator |
| 47 | + spec: |
| 48 | + namespaceSelector: |
| 49 | + matchLabels: |
| 50 | + name: |
| 51 | + - finance |
| 52 | + - ops |
| 53 | +---- |
| 54 | + |
| 55 | +A second Ingress Controller `dev-router` is configured with the label selector `spec.namespaceSelector.matchLabels.name` set to `dev`: |
| 56 | + |
| 57 | +.Example YAML definition for `dev-router` |
| 58 | +[source,yaml] |
| 59 | +---- |
| 60 | +apiVersion: v1 |
| 61 | +items: |
| 62 | +- apiVersion: operator.openshift.io/v1 |
| 63 | + kind: IngressController |
| 64 | + metadata: |
| 65 | + name: dev-router |
| 66 | + namespace: openshift-ingress-operator |
| 67 | + spec: |
| 68 | + namespaceSelector: |
| 69 | + matchLabels: |
| 70 | + name: dev |
| 71 | +---- |
| 72 | + |
| 73 | +If all application routes are in separate namespaces, each labeled with `name:finance`, `name:ops`, and `name:dev` respectively, this configuration effectively distributes your routes between the two Ingress Controllers. {product-title} routes for console, authentication, and other purposes should not be handled. |
| 74 | + |
| 75 | +In the above scenario, sharding becomes a special case of partitioning, with no overlapping subsets. Routes are divided between router shards. |
| 76 | + |
| 77 | +[WARNING] |
| 78 | +==== |
| 79 | +The `default` Ingress Controller continues to serve all routes unless the `namespaceSelector` or `routeSelector` fields contain routes that are meant for exclusion. See this link:https://access.redhat.com/solutions/5097511[Red Hat Knowledgebase solution] and the section "Sharding the default Ingress Controller" for more information on how to exclude routes from the default Ingress Controller. |
| 80 | +==== |
| 81 | + |
| 82 | +== Overlapped sharding example |
| 83 | + |
| 84 | +In addition to `finops-router` and `dev-router` in the example above, you also have `devops-router`, which is configured with the label selector `spec.namespaceSelector.matchLabels.name` set to `dev` and `ops`: |
| 85 | + |
| 86 | +.Example YAML definition for `devops-router` |
| 87 | +[source,yaml] |
| 88 | +---- |
| 89 | +apiVersion: v1 |
| 90 | +items: |
| 91 | +- apiVersion: operator.openshift.io/v1 |
| 92 | + kind: IngressController |
| 93 | + metadata: |
| 94 | + name: devops-router |
| 95 | + namespace: openshift-ingress-operator |
| 96 | + spec: |
| 97 | + namespaceSelector: |
| 98 | + matchLabels: |
| 99 | + name: |
| 100 | + - dev |
| 101 | + - ops |
| 102 | +---- |
| 103 | +The routes in the namespaces labeled `name:dev` and `name:ops` are now serviced by two different Ingress Controllers. With this configuration, you have overlapping subsets of routes. |
16 | 104 |
|
17 |
| -Ingress Controller can use either route labels or namespace labels as a sharding method. |
| 105 | +With overlapping subsets of routes you can create more complex routing rules. For example, you can divert higher priority traffic to the dedicated `finops-router` while sending lower priority traffic to `devops-router`. |
0 commit comments