Skip to content

Kubernetes Service Discovery

Kubernetes has a built-in support for service discovery and load-balancing. However, you may need more flexibility to carefully select the service instance you want.

This page explains how Stork can use the Kubernetes API to handle the service discovery.


First, you need to add the Stork Kubernetes Service Discovery provider:



For each service expected to be exposed as Kubernetes Service, configure the lookup:

Stork looks for the Kubernetes Service with the given name (my-service in the previous example) in the specified namespace.

Instead of using the Kubernetes Service IP directly, and let Kubernetes handle the selection and balancing, Stork inspects the service and retrieves the list of pods providing the service. Then, it can select the instance.

Supported attributes are the following:

Attribute Mandatory Default Value Description
k8s-host No master url The Kubernetes API host
k8s-namespace No The namespace of the service. Use all to discover all namespaces.