1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/nw-ingress-sharding-route-labels.adoc

56 lines
2.0 KiB
Plaintext

// Module included in the following assemblies:
//
// * configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-ingress-controller.adoc
// * networking/ingress-operator.adoc
:_mod-docs-content-type: PROCEDURE
[id="nw-ingress-sharding-route-labels_{context}"]
= Configuring Ingress Controller sharding by using route labels
[role="_abstract"]
You can use route labels to configure Ingress Controller sharding so that the Ingress Controller serves any route in any namespace that is selected by the route selector.
.Ingress sharding by using route labels
image::nw-sharding-route-labels.png[A diagram showing multiple Ingress Controllers with different route selectors serving any route containing a label that matches a given route selector regardless of the namespace a route belongs to]
Ingress Controller sharding is useful when balancing incoming traffic load among a set of Ingress Controllers and when isolating traffic to a specific Ingress Controller. For example, company A goes to one Ingress Controller and company B to another.
.Procedure
. Edit the `router-internal.yaml` file:
+
[source,yaml]
----
apiVersion: operator.openshift.io/v1
kind: IngressController
metadata:
name: sharded
namespace: openshift-ingress-operator
spec:
domain: <apps-sharded.basedomain.example.net>
nodePlacement:
nodeSelector:
matchLabels:
node-role.kubernetes.io/worker: ""
routeSelector:
matchLabels:
type: sharded
----
* `<apps-sharded.basedomain.example.net>`: Specify a domain to be used by the Ingress Controller. This domain must be different from the default Ingress Controller domain.
. Apply the Ingress Controller `router-internal.yaml` file:
+
[source,terminal]
----
# oc apply -f router-internal.yaml
----
+
The Ingress Controller selects routes in any namespace that have the label
`type: sharded`.
. Create a new route by using the domain configured in the `router-internal.yaml`:
+
[source,terminal]
----
$ oc expose svc <service-name> --hostname <route-name>.apps-sharded.basedomain.example.net
----