public class KubernetesDnsLookup extends java.lang.Object implements KubernetesLookup
Such pods can then be discovered via the above-mentioned DNS record. In order for H2O to know which service to query, it is mandatory for the K8S user to pass the name of the headless service to the H2O container, as follows:
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: h2o-stateful-set
namespace: h2o-statefulset
spec:
serviceName: h2o-service
replicas: 3
selector:
matchLabels:
app: h2o-k8s
template:
metadata:
labels:
app: h2o-k8s
spec:
terminationGracePeriodSeconds: 10
containers:
- name: h2o-k8s
image: ''
resources:
requests:
memory: "4Gi"
ports:
- containerPort: 54321
protocol: TCP
env:
- name: H2O_KUBERNETES_SERVICE_DNS
value: h2o-service.h2o-statefulset.svc.cluster.local
- name: H2O_NODE_LOOKUP_TIMEOUT
value: '180'
- name: H2O_NODE_EXPECTED_COUNT
value: '3'
| Constructor and Description |
|---|
KubernetesDnsLookup(java.lang.String serviceDns) |
| Modifier and Type | Method and Description |
|---|---|
static KubernetesDnsLookup |
fromH2ODefaults() |
static boolean |
isLookupPossible() |
java.util.Optional<java.util.Set<java.lang.String>> |
lookupNodes(java.util.Collection<LookupConstraint> lookupConstraints)
Looks up H2O pods via configured K8S Stateless service DNS.
|
public static KubernetesDnsLookup fromH2ODefaults() throws java.lang.IllegalStateException
java.lang.IllegalStateException - When the H2O-related kubernetes DNS service is not foundpublic java.util.Optional<java.util.Set<java.lang.String>> lookupNodes(java.util.Collection<LookupConstraint> lookupConstraints)
lookupNodes in interface KubernetesLookuplookupConstraints - Constraints to obey during lookupSet of adresses of looked up nodes represented as String. The resulting set is never empty.public static boolean isLookupPossible()