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
Copy file name to clipboardexpand all lines: docs/content/guides/traffic_management/destination_types/kubernetes_services/_index.md
+16-9
Original file line number
Diff line number
Diff line change
@@ -4,17 +4,19 @@ weight: 80
4
4
description: Routing to services registered as Kubernetes Services through the API
5
5
---
6
6
7
-
If you are running Gloo Edge in a Kubernetes cluster, it is possible to directly specify
8
-
[Kubernetes Services](https://kubernetes.io/docs/concepts/services-networking/service/) as routing destinations.
9
-
The `kube` destination type has two required fields:
7
+
To allow for optimal performance in Gloo Edge, it is recommended to use Gloo [static]({{% versioned_link_path fromRoot="/guides/traffic_management/destination_types/static_upstream/" %}}) and [discovered]({{% versioned_link_path fromRoot="/guides/traffic_management/destination_types/discovered_upstream/" %}}) Upstreams as your routing destination. However, if you run Gloo Edge in a Kubernetes cluster, you have the option to route to a Kubernetes service directly.
10
8
11
-
*`ref` is a {{< protobuf name="core.solo.io.ResourceRef">}} to the service that should receive traffic
12
-
*`port` is an `int` which represents the port on which the service is listening. This must be one of the ports defined in the Kubernetes service spec
9
+
Consider the following information before choosing a Kubernetes service as your routing destination:
10
+
- For Gloo Edge to route traffic to a Kubernetes service directly, Gloo Edge scans all services in the cluster and creates in-memory Upstream resources. If you have a large number of services in your cluster, the API snapshot increases which can have a negative impact on the Gloo Edge translation time.
11
+
- When using Kubernetes services, load balancing is done in `kube-proxy` which can have further performance impacts. Routing to Gloo Upstreams bypasses `kube-proxy` as the request is routed to the pod directly.
12
+
- Some Gloo Edge functionality, such as policies, might not be available when using Kubernetes services.
13
13
14
-
The following configuration will forward all requests to `/petstore` to port `8080` on the Kubernetes service named
15
-
`petstore` in the `default` namespace.
14
+
To use Kubernetes services as a routing destination:
16
15
17
-
{{< highlight yaml "hl_lines=6-10" >}}
16
+
1. Enable routing to Kubernetes services by setting `settings.disableKubernetesDestinations: true` in your Gloo Edge Helm chart. By default, routing to Kubernetes services is disabled in Gloo Edge due to the negative performance impact on translation and load balancing time in clusters with a lot of Kubernetes services.
17
+
2. Configure the Kubernetes service as a routing destination in your VirtualService. The following example configuration forwards all requests to `/petstore` to port `8080` on the `petstore` Kubernetes service in the `default` namespace.
18
+
19
+
{{< highlight yaml "hl_lines=6-10" >}}
18
20
routes:
19
21
- matchers:
20
22
- prefix: /petstore
@@ -25,4 +27,9 @@ routes:
25
27
name: petstore
26
28
namespace: default
27
29
port: 8080
28
-
{{< /highlight >}}
30
+
{{< /highlight >}}
31
+
32
+
The `kube` destination type has two required fields:
33
+
34
+
*`ref` is a {{< protobuf name="core.solo.io.ResourceRef">}} to the service that receives the traffic.
35
+
*`port` is an integer (`int`) and represents the port the service listens on. Note that this port must be defined in the Kubernetes service.
0 commit comments