Skip to content

Commit 1531c2c

Browse files
chore: Update Service exposition concepts page (#760)
* chore: Update Service exposition concepts page * linter * Apply suggestions from code review Co-authored-by: Malte Sander <[email protected]> * Update modules/concepts/pages/service-exposition.adoc Co-authored-by: Malte Sander <[email protected]> * remove smiley :P * mention HDFS difference --------- Co-authored-by: Malte Sander <[email protected]>
1 parent 4b6477f commit 1531c2c

File tree

1 file changed

+39
-46
lines changed

1 file changed

+39
-46
lines changed
Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,63 @@
11
= Service exposition
2-
:k8s-service: https://kubernetes.io/docs/concepts/services-networking/service/
3-
:k8s-service-types: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
4-
:description: Explore Stackable's service exposition options: ClusterIP for internal access, NodePort for unstable external access, and LoadBalancer for stable external access.
5-
2+
:listener-operator: xref:listener-operator:index.adoc
3+
:secret-operator: xref:secret-operator:index.adoc
4+
:listenerclass: xref:listener-operator:listenerclass.adoc
5+
:description: Explore how Stackable utilizes the listener-operator to expose Services.
66

77
Data products expose interfaces to the outside world.
88
These interfaces (whether UIs, or APIs) can be accessed by other products or by end users.
9-
Other products accessing the interfaces can run inside or outside of the same Kubernetes cluster.
9+
Clients accessing the interfaces can run inside or outside of the same Kubernetes cluster.
1010
For example, xref:zookeeper:index.adoc[Apache ZooKeeper] is a dependency for other products, and it usually needs to be accessible only from within Kubernetes, while xref:superset:index.adoc[Apache Superset] is a data analysis product for end users and therefore needs to be accessible from outside the Kubernetes cluster.
1111
Users connecting to Superset can be restricted within the local company network, or they can connect over the internet depending on the company security policies and demands.
1212
This page gives an overview over the different options for service exposition, when to choose which option and how these options are configured.
1313

14-
== Service exposition options
15-
16-
The Stackable Data Platform supports three {k8s-service-types}[types of Kubernetes Service] for exposing data product endpoints:
14+
== Motivation
1715

18-
* ClusterIP
19-
* NodePort
20-
* LoadBalancer
16+
Service exposition is such a complicated topic, that Stackable has build it's own operator for that: {listener-operator}[].
17+
The following section explains the motivation behind implementing such an operator instead of using plain regular Kubernetes Services.
2118

22-
All custom resources for data products provide a resource field named `spec.clusterConfig.listenerClass` which determines how the product can be accessed.
23-
There are three ListenerClasses, named after the goal for which they are used (more on this in the <<when-to-choose-which-option, next section>>):
19+
=== Products advertising their addresses
2420

25-
* `cluster-internal` => Use ClusterIP (default)
26-
* `external-unstable` => Use NodePort
27-
* `external-stable` => Use LoadBalancer
21+
Some products require information about their external accessibility.
22+
This is e.g. important for HDFS, where the namenode keeps track of which datanode serves which block. Another case is Kafka, where it is required for client bootstrapping.
23+
A common use case is an HDFS client connecting to a namenode in order to read block 42. Therefore, the namenode needs to know which datanode is serving block 42. The namenode then responds with the IP or hostname of the datanode containing that block 42.
24+
For that to work, the datanode needs to know it's external address on startup and tell it the namenode.
25+
(And yes, we needed to patch the Hadoop sourcecode for that)
2826

29-
The `cluster-internal` class exposes the interface of a product by using a ClusterIP Service.
30-
This service is only reachable from within the Kubernetes cluster.
31-
This setting is the most secure and was chosen as the default for that reason.
27+
The {listener-operator}[listener-operator] runs as CSI driver (same as the {secret-operator}[secret-operator]) and places files inside the CSI volume, which tell the tool how it is reachable.
3228

33-
NOTE: Not all operators support all classes.
34-
Consult the operator specific documentation to find out about the supported service types.
29+
=== Integration with {secret-operator}[secret-operator]
3530

36-
[#when-to-choose-which-option]
37-
== When to choose which option
31+
If a tool is secured using TLS or Kerberos, it does not only need to be reachable via the determined address, it also needs a TLS certificate/keytab issued on the determined address.
32+
{secret-operator}[secret-operator] integrated with to {listener-operator}[listener-operator], so that the platform takes care of provisioning certificates with the correct addresses (in the form of SAN entries).
3833

39-
There are three options, one for internal traffic and two for external access, where internal and external refer to the Kubernetes cluster.
40-
Internal means inside of the Kuberenetes cluster, and external means access from outside of it.
34+
== {listenerclass}[ListenerClasses]
4135

42-
=== Internal
36+
A {listenerclass}[] describes how a product should be exposed.
37+
Please read on {listenerclass}[its documentation] before continuing on this page.
4338

44-
`cluster-internal` is the default class and the Service behind it is only reachable from within Kubernetes.
45-
This is useful for middleware products such as xref:zookeeper:index.adoc[Apache ZooKeeper], xref:hive:index.adoc[Apache Hive metastore], or an xref:kafka:index.adoc[Apache Kafka] cluster used for internal data flow.
46-
Products using this ListenerClass are not accessible from outside Kubernetes.
39+
As a quick reminder, the platform ships with 3 default {listenerclass}[ListenerClasses]:
4740

48-
=== External
41+
`cluster-internal`:: Used for listeners that are only accessible internally from the cluster. For example: communication between ZooKeeper nodes.
42+
`external-unstable`:: Used for listeners that are accessible from outside the cluster, but which do not require a stable address. For example: individual Kafka brokers.
43+
`external-stable`:: Used for listeners that are accessible from outside the cluster, and do require a stable address. For example: Kafka bootstrap.
4944

50-
External access is needed when a product needs to be accessed from _outside_ of Kubernetes.
51-
This is necessary for all end user products such as xref:superset:index.adoc[Apache Superset].
52-
Some tools can expose APIs for data ingestion like xref:kafka:index.adoc[Apache Kafka] or xref:nifi:index.adoc[Apache NiFi].
53-
If data needs to be ingested from outside of the cluster, one of the external listener classes should be chosen.
45+
Keep in mind that you are not restricted to this list, you can configure your own custom {listenerclass}[ListenerClasses].
5446

55-
When to use `stable` and when to use `unstable`?
56-
The `external-unstable` setting exposes a product interface via a Kuberneres NodePort.
57-
In this case the service's IP address and port can change if Kubernetes needs to restart or reschedule the Pod to another node.
47+
== Configuring the ListenerClass for a Stacklet
5848

59-
The `external-stable` class uses a LoadBalancer.
60-
The LoadBalancer is running at a fixed address and is therefore `stable`.
61-
Managed Kubernetes services in the cloud usually offer a LoadBalancer, but for an on premise cluster you have to configure a LoadBalancer yourself.
62-
For a production setup, it is recommended to use a LoadBalancer and the `external-stable` ListenerClass.
49+
The {listener-operator}[listener-operator] is integrated into most of the Stackable products, currently only xref:opa:index.adoc[] and xref:spark-k8s:index.adoc[] are not using {listener-operator}[listener-operator].
6350

64-
== Outlook
51+
Most of the products configure the {listenerclass}[] at the role level as follows.
52+
However, there are some products that have this option at the rolegroup level.
53+
One example is HDFS, where some roles require a listener service per Pod, to individually access single instances.
6554

66-
For most of the Stackable operators, these listener classes are hardcoded to expose certain Service types and do not offer any additional configuration.
67-
However, some operators support specifying custom xref:listener-operator:listenerclass.adoc[ListenerClass]es with more granular configuration options, via the xref:listener-operator:index.adoc[listener-operator].
68-
In a future release, all Stackable operators are planned to be migrated over to this system.
55+
[source,yaml]
56+
----
57+
spec:
58+
my-role:
59+
roleConfig:
60+
listenerClass: external-unstable
61+
----
6962

70-
For more information on what is supported by any individual operator, please see that operator's documentation.
63+
Every operator has a documentation section called "Service exposition with ListenerClasses", which may provide details for the specific tool.

0 commit comments

Comments
 (0)