Service Discovery - K8s


This document provides instructions on how to discover service endpoints using Kubernetes (K8s) service information. Service discovery enables you to find the endpoints where a given service is available. To know more information about service discovery, see Volterra Service Discovery.

Using the instructions provided in this guide, you can create a discovery object for a Kubernetes cluster and an endpoint for a service using the service name.


The following prerequisites apply:

  • An existing Kubernetes cluster with a service or application reachable from a Volterra Site.
  • Note: The Kubernetes service should be of type NodePort.


Volterra enables users to discover existing service endpoints either natively or using external methods. This guide covers service discovery on sites, virtual sites, or virtual networks using Kubernetes service information.

The following figure shows the workflow for creating service discovery with Kubernetes service information:

Figure: Setting up Service Discovery with k8s Service Info

Configuration Sequence

Discovering services using the Kubernetes service information requires performing the following sequence of actions:

Phase Description
Create Discovery for External Kubernetes Cluster Create a service discovery object of type Kubernetes.
Verify Discovered Services Verify that the service discovery object is created and successfully discovered services.
Use Discovered Services Configure endpoint with K8s as the discovery type and associate sites with it.

Note: The site of discovery object and the endpoint must be the same.

Create Discovery for External Kubernetes Cluster

Step: 1 Create a discovery configuration object in the System namespace. Select the system from the namespace menu. Select Manage from the configuration menu and Discovery from the options pane. Click Add discovery. The discovery object form gets loaded.

Figure: Service Discovery Creation

Step 2: Enter name, labels, and description in the Name, Labels, and Description fields respectively.

Step 3: Select Virtual Network or Site or Virtual Site for the Virtual-site or site or network field in the Where section. Accordingly, select an appropriate object from the Select ref field. Select Site Local Network for the Network Type field.

add disc basic
Figure: Service Discovery Config Options

Note: The Network Type field is not applicable for the Virtual Network setting.

Step 4: Select Kubernetes Service Discovery for the Select How Endpoints are Discovered field in the Endpoint Services Discovery section. Click Configure under the Kubeconfig field.

Step 5: Select Blindfold Secret for the Secret Info field and enter the kubeconfig for the secret field. Click Blindfold to apply Volterra Blindfold to the kubeconfig. Wait for the display to show Blindfold configured. Click Apply.

Figure: Kubeconfig Options

Note: This example uses Blindfold Secret for the Secret Info. However, you can also use other supported type of secrets available in the drop down menu for the Secret Info field.

Step 6: Select the VIP publish enable checkbox in the Advertise VIP Publising section. Configure the values as per the following guidelines:

  • Select DNS Delegation for the VIP Publish Method field.
  • Enter a subdomain in the Subdomain field.
  • Select Core DNS or Kube DNS for the DNS mode field depending on your external k8s cluster DNS provider.

vip final
Figure: VIP Publish Configuration

Step 7: Click the Save and Exit to create the discovery object.

Verify Discovered Services

Verify that the service discovery object is created and discovered services.

Step 1: Navigate to Manage -> App Management -> Service Discovery. Verify that the service discovery object is created and the Services field displays the number of services discovered.

verify 1
Figure: Service Discovery Created

Step 2: Click on the value displayed on the Services field. This displays the list of discovered services.

verify 2
Figure: Discovered Services

Note: Note down the Service Name field for a service to use it in configuration such as origin pools or endpoints.

Use Discovered Services

After the service discovery object is created and the services are discovered, you can use it in the configurations such as the following:

  • Origin Pools: The origin pools are a way to declare the origin servers for your service in the load balancer configuration. You can create origin pools as part of HTTP load balancer creation or individually create and apply it to a HTTP load balancer later.
  • Endpoints: The endpoint objects are for advanced configuration for using in the virtual host configuration.

Configure Origin Pool with K8s Service Information

This chapter shows the origin pool creation with K8s service name for the origin server specification.

Step 1: Log into VoltConsole and change to your application namespace. Select Manage -> Origin Pools. Click Add Origin Pool.

Step 2: Set a name in the metadata section and select k8s Service Name of Origin Server on given Sites option for the Select Type of Origin Server field.

Step 3: Enter service name in the Service Name field. Obtain the service name using the instructions in the Verify Discovered Services chapter.

Step 4: Select Site or Virtual Site for the Select Site or Virtual Site field and select a site or virtual site accordingly. Select a network for the Select Network on the site option.

Step 5: Enter a port in the Port field. Scroll down and click Save and Exit.

orig pool
Figure: Origin Pool with K8s Service Information

This enables the service to be reachable on the selected network on the selected site or virtual site.

Create Endpoint with K8s Service Information

Step 1: Select desired namespace from the namespace selector or create a namespace using the General -> Personal Management -> My Namespaces -> Add namespace option.

Step 2: Select Manage -> Virtual Host from the configuration menu and Endpoints from the options pane. Click Add endpoint.

ep nav
Figure: Endpoint Creation

The Add endpoint form gets loaded. Add a name, optionally set labels, and optionally add a description.

Step 3: Obtain the K8s service information using the instructions in the Verify Discovered Services chapter.

Step 4: Configure where the endpoint should be discovered. Select an appropriate option in the Where field. Click Select ref. This site or virtual site or virtual network must be same as that of the discovery object created.

Figure: Endpoint Address Reference Selector

Note: Any reference object (site, virtual site, and virtual network) needs to be created and listed before configuring the Selectref field. All the available object list gets displayed on a cascading menu where you can select one or more objects.

Step 5: Configure endpoint address information as per the following guidelines:

  • Select Service Selector info for the Endpoint Specifier field.
  • Select Kubernetes for the Discovery field.
  • Select Service name for the Service field.
  • Enter your service name in the Service name field. Use the <servicename.namespace> format.

    Note: Obtain service name from Step 3.

Step 6: Enter port and protocol values for the fields Port and Protocol respectively.

k8s srv
Figure: Endpoint Address Service Info Config Options

Note: The port must be the service port of the Kubernetes service and not the node port.

With the steps above, you can discover a service endpoint from external Kubernetes providers using ‘Service Info’ on a location specified using the selector. Once the service is discovered, the object can be used with other configuration objects of Volterra platform. For example, you can advertise it across sites in cloud or edge.


API References