Search code examples
kubernetesopenshiftapache-kafka-connectstrimzi

Can we attach a init-container with strimzi kafka container?


Can we attach a init-container with strimzi kafka connect container? I want to copy some jars from another image (docker/my-sdk:9.1) to strimzi kafka connect container at runtime using init-container

apiVersion: apps/v1
kind: Deployment
metadata:
  name: debezium-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: debezium-deployment-app
  template:
    metadata:
      labels:
        app: debezium-deployment-app
    spec:
      initContainers:
        - name: init-container
          image: docker/my-sdk:9.1
          command: ['sh', '-c', 'cp -r /data/TTMMM/sdk /shared-jars/']
          volumeMounts:
            - name: jar-volume
              mountPath: /shared-jars
      containers:
        - name: main-container
          image: docker/strimzi-kafka-image
          volumeMounts:
            - name: jar-volume
              mountPath: /home/TTMMM/

Solution

  • No, you cannot configure custom init containers like this. You should follow the Strimzi documentation and either build your own container image or use the Strimzi APi to build one for you.