You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Scoping the service mesh with DiscoverySelectors
2
-
This page describes how the service mesh control plane discovers and observes cluster resources and how to manage this scope.
3
2
4
3
A service mesh will include a workload that:
5
4
1. Has been discovered by the control plane
@@ -27,23 +26,20 @@ You can configure each label selector for a variety of use cases, including but
27
26
- A list of namespace labels using set-based selectors which carries OR semantics, for example, all namespaces with label `istio-discovery=enabled` OR `region=us-east1`
28
27
- Inclusion and/or exclusion of namespaces, for example, all namespaces with label `istio-discovery=enabled` AND label key `app` equal to `helloworld`
29
28
30
-
#### Using Discovery Selectors to Scope of a Service Mesh
31
-
Assuming you know which namespaces to include as part of the service mesh, as a mesh administrator, you can configure `discoverySelectors` at installation time or post-installation by adding your desired discovery selectors to Istio’s MeshConfig resource. For example, you can configure Istio to discover only the namespaces that have the label `istio-discovery=enabled`.
29
+
#### Using Discovery Selectors to Scope a Service Mesh
30
+
Assuming you know which namespaces to include as part of the service mesh, as a mesh administrator, you can configure `discoverySelectors` at installation time or post-installation by adding your desired discovery selectors to Istio’s MeshConfig resource.
31
+
32
+
For example, you can configure Istio to discover only the namespaces that have the label `istio-discovery=enabled`.
32
33
33
34
##### Prerequisites
34
35
- The OpenShift Service Mesh operator has been installed
35
36
- An Istio CNI resource has been created
36
-
- The `istioctl` binary has been installed on your localhost
37
37
38
-
1. Create the `istio-system` system namespace:
39
-
```bash
40
-
oc create ns istio-system
41
-
```
42
-
1. Label the `istio-system` system namespace:
38
+
1. Add a label to the namespace containing the Istio control plane, for example, the `istio-system` system namespace:
1. Deploy the sleep application to the first namespaces:
61
+
1. You then must ensure that all namespaces that will contain workloads that are to be part of the service mesh have both the `discoverySelector` label and, if desired, the appropriate Istio injection label. For example, for the `bookinfo` application, you can apply both labels as follows:
1. Verify that you don't see any endpoints from the second namespace:
88
-
```bash
89
-
istioctl pc endpoint deploy/sleep -n app-ns-1
90
-
ENDPOINT STATUS OUTLIER CHECK CLUSTER
91
-
10.128.2.197:15010 HEALTHY OK outbound|15010||istiod.istio-system.svc.cluster.local
92
-
10.128.2.197:15012 HEALTHY OK outbound|15012||istiod.istio-system.svc.cluster.local
93
-
10.128.2.197:15014 HEALTHY OK outbound|15014||istiod.istio-system.svc.cluster.local
94
-
10.128.2.197:15017 HEALTHY OK outbound|443||istiod.istio-system.svc.cluster.local
95
-
10.131.0.32:80 HEALTHY OK outbound|80||sleep.app-ns-1.svc.cluster.local
96
-
127.0.0.1:15000 HEALTHY OK prometheus_stats
97
-
127.0.0.1:15020 HEALTHY OK agent
98
-
unix://./etc/istio/proxy/XDS HEALTHY OK xds-grpc
99
-
unix://./var/run/secrets/workload-spiffe-uds/socket HEALTHY OK sds-grpc
100
-
```
101
-
1. Label second application namespace to be matched by defined `discoverySelectors` and enable sidecar injection:
102
-
```bash
103
-
oc label ns app-ns-2 istio-discovery=enabled
104
-
```
105
-
1. Verify that after labeling second namespace it also appears on the list of discovered endpoints:
106
-
```bash
107
-
istioctl pc endpoint deploy/sleep -n app-ns-1
108
-
ENDPOINT STATUS OUTLIER CHECK CLUSTER
109
-
10.128.2.197:15010 HEALTHY OK outbound|15010||istiod.istio-system.svc.cluster.local
110
-
10.128.2.197:15012 HEALTHY OK outbound|15012||istiod.istio-system.svc.cluster.local
111
-
10.128.2.197:15014 HEALTHY OK outbound|15014||istiod.istio-system.svc.cluster.local
112
-
10.128.2.197:15017 HEALTHY OK outbound|443||istiod.istio-system.svc.cluster.local
113
-
10.131.0.32:80 HEALTHY OK outbound|80||sleep.app-ns-1.svc.cluster.local
114
-
10.131.0.33:80 HEALTHY OK outbound|80||sleep.app-ns-2.svc.cluster.local
115
-
127.0.0.1:15000 HEALTHY OK prometheus_stats
116
-
127.0.0.1:15020 HEALTHY OK agent
117
-
unix://./etc/istio/proxy/XDS HEALTHY OK xds-grpc
118
-
unix://./var/run/secrets/workload-spiffe-uds/socket HEALTHY OK sds-grpc
119
-
```
120
-
121
-
See [Multiple Istio Control Planes in a Single Cluster](../multi-control-planes/README.md) for another example of `discoverySelectors` usage.
65
+
In addition to limiting the scope of a single service mesh, `discoverySelectors` also play a critical role in limiting the scope of control plane when [multiple Istio control planes are to be deployed within a single cluster](../multi-control-planes/README.md).
122
66
123
67
### Next Steps: Sidecar injection
124
68
As described earlier, in addition to the control plane discovering the namespaces to be included in the mesh, workloads must be [injected with a sidecar proxy](../injection/README.md) to be included in the service mesh.
0 commit comments