The Kubernetes Service Plugin for Gloo leverages Kubernetes Services to discover endpoints for Envoy to route to. The Kubernetes Upstream Type supports routing to pods by label.
The Upstream Type for Kubernetes upstreams is kubernetes.
The upstream spec for Kubernetes Upstreams has the following structure:
service_name: string
service_namespace: string
service_port: int
labels: map<string, string>| Field | Type | Description |
|---|---|---|
| service_name | string | The name of the kubernetes service this upstream routes to. required |
| service_namespace | string | The namespace that contains the kubernetes service this upstream routes to. required |
| service_port | int | The service port the upstream should route to. required if the service has more than one port defined Note: create an upstream for each service port to which you want to route |
| labels | map<string, string> | If specified, this upstream will route only to pods selected for these labels. optional Note: create an upstream for each set of labels to which you want to route |
The Kubernetes Plugin does not support functions. However, other function plugins (such as the transformation plugin) can process functions on kubernetes upstreams.
The following is an example of a valid Kubernetes Upstream:
name: petstore
spec:
service_name: "petstore"
service_namespace: "default"
type: kubernetesWith labels:
name: petstore-v1
spec:
service_name: "petstore"
service_namespace: "default"
labels:
version: v1
type: kubernetesThe Gloo Kubernetes Service Discovery Service will automatically discover upstreams from Kubernetes Services if it is running. Upstreams discovered in this way will not contain labels.