Skip to content

Latest commit

 

History

History

Pod Overlay

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 current tutorial directory

Set the tutorial directory under the directory you downloaded this Github repo:

export TUTORIAL_HOME=<Github repo directory>/advanced-configuration/pod-overlay

Deploy Confluent for Kubernetes

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

Deploy Confluent Platform:

kubectl apply -f $TUTORIAL_HOME/confluent-platform.yaml

Check that all Confluent Platform resources are deployed:

kubectl get confluent -n confluent

Configure pod overlay

  • 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 with spec(refer to statefulset.spec). Users are only allowed to configure fields inside statefulset.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"

Check patch result

  • 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 under status
  • kubectl -n confluent get zk zookeeper -oyaml verify zookeeper CR has platform.confluent.io/pod-overlay condition under status
  • kubectl -n confluent get cm foo-pod-overlay -oyaml verify configmap foo-pod-overlay has finalizer configmap.finalizers.platform.confluent.io/zookeeper-zookeeper

Tear down

# 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