Class KubernetesNodeDiscovery

  • All Implemented Interfaces:
    NodeDiscovery

    public class KubernetesNodeDiscovery
    extends Object
    implements NodeDiscovery
    Kubernetes-based node discovery implementation using the official Kubernetes Java client.

    This implementation uses the official Kubernetes Java client library to discover cache nodes running in the same cluster. It supports both in-cluster service account authentication and external kubeconfig.

    Key Features:

    • Official Client: Uses the official Kubernetes Java client library
    • Service Account Support: Automatically uses in-cluster service account
    • Kubeconfig Support: Can use external kubeconfig for development
    • Label Selectors: Filter pods/services by labels
    • Namespace Aware: Discover nodes in specific namespaces
    • Health Monitoring: Integrates with Kubernetes readiness probes

    Usage Examples:

    
     // In-cluster discovery using service account
     NodeDiscovery k8sDiscovery = NodeDiscovery.kubernetes()
             .namespace("default")
             .serviceName("jcachex-cluster")
             .labelSelector("app=jcachex,version=1.0")
             .build();
    
     // External discovery using kubeconfig
     NodeDiscovery k8sDiscovery = NodeDiscovery.kubernetes()
             .kubeConfigPath("/path/to/kubeconfig")
             .namespace("jcachex")
             .serviceName("cache-service")
             .build();
     
    Since:
    1.0.0