Service Discovery
GoAkt ships with a discovery provider API that can help any developer to extend GoAkt cluster capability.
By default GoAkt comes bundled with the following fully function discovery providers:
kubernetes api integration is fully functional
NATS integration is fully functional
DNS is fully functional
Static is fully functional and for demo purpose
Consul discovery provider
etcd discovery provider
Kubernetes
This provider makes use of the Kubernetes API to discover cluster nodes during cluster mode bootstrap.
Get Started
To enable Kubernetes-based node discovery in your cluster, ensure the following pod labels and ports are correctly defined in your Kubernetes deployment manifest:
Required Pod Labels
Namespace: The Kubernetes namespace in which your application is running. This is required for scoping the discovery process.PodLabels: A set of labels that uniquely identify the pods participating in the cluster. These labels are used by the discovery mechanism to filter and locate eligible nodes.
Required Named Ports
Make sure the following named ports are defined in the container spec of your Kubernetes Deployment:
DiscoveryPortName: This named port is used by the discovery service to detect and connect to other nodes in the cluster. It enables automatic peer discovery.RemotingPortName: This port facilitates inter-node communication by enabling remote message delivery across cluster nodes.PeersPortName: Used by the distributed cache engine to synchronize actor state across nodes, enabling fault-tolerant replication and consistency.
Role Based Access
Youβll also have to grant the Service Account that your pods run under access to list pods. The following configuration can be used as a starting point. It creates a Role, pod-reader, which grants access to query pod information. It then binds the default Service Account to the Role by creating a RoleBinding. Adjust as necessary:
Example
A working example can be found here
NATS
This discovery provider make uses of the NATS client to connect to NATS server to discover cluster nodes during cluster mode bootstrap.
Get Started
To use the NATS discovery provider one needs to provide the following:
NatsServer: the NATS Server addressNatsSubject: the NATS subject to useTimeout: the nodes discovery timeoutMaxJoinAttempts: the maximum number of attempts to connect an existing NATs server. Defaults to5ReconnectWait: the time to backoff after attempting a reconnect to a server that we were already connected to previously. Default to2 secondsHost: the given node host addressDiscoveryPort: the discovery port of the given node
DNS
This provider performs nodes discovery based upon the domain name provided. This is very useful when doing local development using docker.
Get Started
To use the DNS discovery provider one needs to provide the following:
DomainName: the domain nameIPv6: it states whether to lookup for IPv6 addresses.
Example
A working example can be found here
Static
This provider performs nodes discovery based upon the list of static hosts addresses. The address of each host is the form of host:port where port is the gossip protocol port.
Get Started
Example
A working example can be found here
Last updated