Confluent for Kubernetes (CFK) pod overlay feature allows you to use Kubernetes pod functionality that's not currently
supported in CFK API(<component>.spec.podTemplate
section).
Customer can leverage pod overlay feature in Zookeeper, Kafka, Connect, Schema Registry, Kafka Rest Proxy and
Control Center by adding an annotation(platform.confluent.io/pod-overlay-configmap-name: <cm-name>
) which point to
a configmap that contains pod overlay configuration in CR. There are fields not allowed to be overwritten by pod overlay, those fields are critical to the functionality of application pod.
The valid pod overlay configuration will be strategically merged with
pod spec inside statefulSet generated by CFK to form the final pod configuration for the application.
In this example, you'll set up a Confluent Platform(Zookeeper and Kafka), and configure pod overlay for Zookeeper and Kafka respectively. To configure pod overlay, you'll first create a configmap resource containing the pod overlay yaml content, and later, annotate CR.
Set the tutorial directory under the directory you downloaded this Github repo:
export TUTORIAL_HOME=<Github repo directory>/advanced-configuration/pod-overlay
This workflow scenario assumes you are using the namespace confluent
.
Set up the Helm Chart:
helm repo add confluentinc https://packages.confluent.io/helm
Install Confluent For Kubernetes using Helm:
helm upgrade --install operator confluentinc/confluent-for-kubernetes -n confluent
Check that the Confluent For Kubernetes pod comes up and is running:
kubectl get pods
Deploy Confluent Platform:
kubectl apply -f $TUTORIAL_HOME/confluent-platform.yaml
Check that all Confluent Platform resources are deployed:
kubectl get confluent -n confluent
-
Create configmap used by pod overlay (required data:
key: pod-template.yaml
,value: <yaml content>
which conform with kubernetes StatefulSetSpec API). yaml content must begin withspec
(refer tostatefulset.spec
). Users are only allowed to configure fields insidestatefulset.spec.template
. If they try to set fields outside of it, the configuration will be considered as invalid.-
option 1: add a custom init container
kubectl -n confluent create configmap foo-pod-overlay --from-file=pod-template.yaml=$TUTORIAL_HOME/extra-init-container.yaml
-
option 2: enable QoS class of BestEffort
kubectl -n confluent create configmap foo-pod-overlay --from-file=pod-template.yaml=$TUTORIAL_HOME/enable-best-effort-qos.yaml
-
-
Annotate CP component to enable pod overlay
-
enable pod overlay on zookeeper
kubectl -n confluent annotate zk zookeeper platform.confluent.io/pod-overlay-configmap-name="foo-pod-overlay"
-
- If option 1 is used:
kubectl -n confluent get sts zookeeper -oyaml
- verify statefulset has another initContainer
busybox
- If option 2 is used:
kubectl -n confluent get pod zookeeper-0 -oyaml
- verify pod has
qosClass: BestEffort
understatus
kubectl -n confluent get zk zookeeper -oyaml
verify zookeeper CR hasplatform.confluent.io/pod-overlay
condition under statuskubectl -n confluent get cm foo-pod-overlay -oyaml
verify configmapfoo-pod-overlay
has finalizerconfigmap.finalizers.platform.confluent.io/zookeeper-zookeeper
# below command will delete zookeeper CR, which will then remove finalizer in configmap referenced in the annotation.
kubectl delete -f $TUTORIAL_HOME/confluent-platform.yaml
kubectl -n confluent delete configmap foo-pod-overlay
helm delete operator -n confluent