Skip to content

Commit cfa8574

Browse files
committed
initial cluster domain docs
1 parent 384fb70 commit cfa8574

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

modules/guides/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
** xref:running-stackable-in-an-airgapped-environment.adoc[]
55
** xref:viewing-and-verifying-sboms.adoc[]
66
** xref:enabling-verification-of-image-signatures.adoc[]
7+
** xref:cluster-domain.adoc[]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
= Configuring the Kubernetes cluster domain
2+
:description: Configure Stackable operators to use a different cluster domain other than 'cluster.local'.
3+
:dns-custom-nameservers: https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/
4+
:dns-pod-service: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
5+
6+
Stackable operators allow to configure a non-default cluster domain as described in {dns-custom-nameservers}[`Customizing DNS Service`] (and more in {dns-pod-service}[`DNS for Services and Pods`]).
7+
The configuration is primarily done via and environment variable `KUBERNETES_CLUSTER_DOMAIN`, but there is also a mechansim to auto detect the cluster domain using the `/etc/resolv.conf` file.
8+
9+
The following steps explain the use of the environment variable and the auto detection mechanism in detail.
10+
11+
== Steps
12+
13+
=== Setting `KUBERNETES_CLUSTER_DOMAIN` variable
14+
15+
The environment variable `KUBERNETES_CLUSTER_DOMAIN` takes precedence over auto detection. This means that the desired cluster domain can be configured in a Helm values file via the property`kubernetesClusterDomain` or via the install command like:
16+
17+
```
18+
helm install hive-operator stackable-stable/hive-operator --set kubernetesClusterDomain="my-cluster.local"
19+
```
20+
21+
=== Using auto detection
22+
23+
As a first step, the auto detection is checking the runtime environment of the operator. In most cases this is a clusterized environment like Kubernetes or Openshift.
24+
This is determined by checking if the `KUBERNETES_SERVICE_HOST` environment variable is set in the operator Pod.
25+
26+
If clusterized, the auto detection parses the `/etc/resolv.conf` file for the last entry starting with the `search` keyword. Within that `search` entry the shortest option is selected.
27+
28+
An example for the `/etc/resolv.conf` in a Kubelet looks like:
29+
30+
```
31+
nameserver 10.32.0.10
32+
search <namespace>.svc.cluster.local svc.cluster.local cluster.local
33+
options ndots:5
34+
```
35+
36+
Using this example as a base for the cluster domain auto detection, the operator would choose the `cluster.local` option.
37+
38+
=== Running locally
39+
40+
This section covers the case when both `KUBERNETES_CLUSTER_DOMAIN` and `KUBERNETES_SERVICE_HOST` are not set. This would be the case if the operator is not running in a clusterized environment like e.g. locally a Laptop or PC.
41+
Running the operator locally is mostly for development and therefore not relevant for most users.
42+
43+
If running locally, and `KUBERNETES_CLUSTER_DOMAIN` and `KUBERNETES_SERVICE_HOST` are not set, the operator will default its cluster domain to `cluster.local`.

0 commit comments

Comments
 (0)