This discovery bridge imports services from Kubernetes (or Openshift v3) into the Vert.x service discovery.
Kubernetes services are mapped to
Record. This bridge only
supports the importation of services from kubernetes in vert.x (and not the opposite).
Record are created from Kubernetes Service. The service type is deduced from the
service.type label. If
not set, the service is imported as
http-endpoint are supported for now.
To use this Vert.x discovery bridge, add the following dependency to the dependencies section of your build descriptor:
Maven (in your
<dependency> <groupId>io.vertx</groupId> <artifactId>vertx-service-discovery-bridge-kubernetes</artifactId> <version>3.3.3</version> </dependency>
Gradle (in your
The bridge is configured using:
the oauth token (using the content of
/var/run/secrets/kubernetes.io/serviceaccount/token by default)
the namespace in which the service are searched (defaults to
Be aware that the application must have access to Kubernetes and must be able to read the chosen namespace.
The record is created as follows:
the service type is deduced from the
service.type label. If this label is not set the service type is set to
the record’s name is the service’s name
the labels of the service are mapped to metadata
in addition are added:
the location is deduced from the first port of the service
For HTTP endpoints, the
https) attribute is set to
true if the service has the
ssl label set to
The bridge imports all services on
start and removes them on
stop. In between it watches the Kubernetes
services and add the new ones and removes the deleted ones.