Usage
The operator creates a Listener
for each mounted CSI volume with storageClassName: listeners.stackable.tech
.
A minimal exposed Pod
looks like this:
---
apiVersion: v1
kind: Pod
metadata:
name: example-public-pod
spec:
volumes:
- name: listener
ephemeral: (1)
volumeClaimTemplate:
metadata:
annotations:
listeners.stackable.tech/listener-class: external-stable (2)
spec:
storageClassName: listeners.stackable.tech
accessModes:
- ReadWriteMany
resources:
requests:
storage: "1"
containers:
- name: nginx
image: nginx
ports:
- name: http
containerPort: 80
volumeMounts:
- name: listener
mountPath: /listener (3)
1 | Defines an ephemeral listener, meaning that it will automatically be deleted when the Pod is. |
2 | Defines that we want to expose this pod by automatically creating a service according to the ListenerClass public . |
3 | Mounts metadata about the Listener (such as the port mapping and IP address) into /listener . The volume must be mounted, even if this data is never used by the Pod itself. |
The exact ListenerClass is going to depend on the Kubernetes environment, but should often look like this for public clouds:
---
apiVersion: listeners.stackable.tech/v1alpha1
kind: ListenerClass
metadata:
name: public
spec:
serviceType: LoadBalancer
Or like this for on-premise environments:
---
apiVersion: listeners.stackable.tech/v1alpha1
kind: ListenerClass
metadata:
name: public
spec:
serviceType: NodePort