Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/ROOT/pages/kubernetes/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,8 @@ Kubernetes control plane is running at https://127.0.0.1:6443
CoreDNS is running at https://127.0.0.1:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://127.0.0.1:6443/api/v1/namespaces/kube-system/services/https:metrics-server:https/proxy
----

=== Configuring the cluster domain

In case a non-default cluster domain is used as described in https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/[Customizing DNS Service],
Stackable operators can be configured accordingly. This is described in detail in the xref:guides:kubernetes-cluster-domain.adoc[Configuring the Kubernetes cluster domain] guide.
1 change: 1 addition & 0 deletions modules/guides/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
** xref:running-stackable-in-an-airgapped-environment.adoc[]
** xref:viewing-and-verifying-sboms.adoc[]
** xref:enabling-verification-of-image-signatures.adoc[]
** xref:kubernetes-cluster-domain.adoc[]
47 changes: 47 additions & 0 deletions modules/guides/pages/kubernetes-cluster-domain.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
= Configuring the Kubernetes cluster domain
:description: Configure Stackable operators to use a different cluster domain other than 'cluster.local'.
:dns-custom-nameservers: https://kubernetes.io/docs/tasks/administer-cluster/dns-custom-nameservers/
:dns-pod-service: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/

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]).
The configuration is primarily done via an environment variable `KUBERNETES_CLUSTER_DOMAIN`, but there is also a mechanism to auto detect the cluster domain using the `/etc/resolv.conf` file.

The following steps explain the use of the environment variable and the auto detection mechanism in detail:

== Steps

=== Use environment variable

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:

```
helm install hive-operator stackable-stable/hive-operator --set kubernetesClusterDomain="my-cluster.local"
```

=== Use auto detection

If the `KUBERNETES_CLUSTER_DOMAIN` environment variable is not set, the auto detection is checking the runtime environment of the operator.
In most cases this is a clusterized environment like Kubernetes or Openshift.
This is determined by checking if the `KUBERNETES_SERVICE_HOST` environment variable is set in the operator Pod.

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.

An example `/etc/resolv.conf` in a Pod looks like:

```
nameserver 10.32.0.10
search <namespace>.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
```

Using this example as a base for the cluster domain auto detection, the operator would choose `cluster.local` as cluster domain.

=== Running locally

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.
Running the operator locally is mostly for development and therefore not relevant for most users.

If running locally, and `KUBERNETES_CLUSTER_DOMAIN` and `KUBERNETES_SERVICE_HOST` are not set, the operator will default its cluster domain to `cluster.local`.