Service Discovery - K8s
On This Page:
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:
- Note: If you do not have an account, see Create a Volterra Account.
- An existing Kubernetes cluster with a service or application reachable from a Volterra Site.
- Note: The Kubernetes service should be of type
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:
Discovering services using the Kubernetes service information requires performing the following sequence of actions:
|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.
Step 2: Enter name, labels, and description in the
Description fields respectively.
Step 3: Select
Virtual Network 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.
Network Typefield is not applicable for the
Step 4: Select
Kubernetes Service Discovery for the
Select How Endpoints are Discovered field in the
Endpoint Services Discovery section. Click
Configure under the
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
Note: This example uses
Blindfold Secretfor the
Secret Info. However, you can also use other supported type of secrets available in the drop down menu for the
Step 6: Select the
VIP publish enable checkbox in the
Advertise VIP Publising section. Configure the values as per the following guidelines:
DNS Delegationfor the
VIP Publish Methodfield.
- Enter a subdomain in the
Kube DNSfor the
DNS modefield depending on your external k8s cluster DNS provider.
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
App Management ->
Service Discovery. Verify that the service discovery object is created and the
Services field displays the number of services discovered.
Step 2: Click on the value displayed on the
Services field. This displays the list of discovered services.
Note: Note down the
Service Namefield 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
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
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.
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
Personal Management ->
My Namespaces ->
Add namespace option.
Step 2: Select
Virtual Host from the configuration menu and
Endpoints from the options pane. Click
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.
Note: Any reference object (site, virtual site, and virtual network) needs to be created and listed before configuring the
Selectreffield. 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:
Service Selector infofor the
Service namefor the
Enter your service name in the
Service namefield. Use the
Note: Obtain service name from Step 3.
Step 6: Enter port and protocol values for the fields
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.