Kafka REST ConfigMap

You can customize the kafkarest config files by editing the kafkarest-cm ConfigMap. Adding a file to the data section of kafkarest-cm copies the file contents to /opt/mapr/kafka-rest/kafka-rest-5.1.2/config/ and overrides the existing files after pod restart.

The following example customizes the /opt/mapr/kafka-rest/kafka-rest-5.1.2/config/kafka-rest.properties file:

  1. Add the customized kafka-rest.properties content in the data section by editing the existing kafkarest-cm: $ kubectl -n dataplatform edit cm kafkarest-cm:
    ...
    ApiVersion: v1 
    data:
      kafka-rest.properties: | 
        listeners=https://0.0.0.0:8082 
        authentication.enable=true 
        impersonation.enable=true 
        schema.registry.enable=false 
        streams.default.stream=/st
        headers.file=/opt/mapr/kafka-rest/kafka-rest-5.1.2/config/headers.xml 
        host.name=kafkarest-svc.dataplatform.svc.cluster.local
    kind: ConfigMap metadata:
    ...
  2. Restart the kafkarest pods:
    $ kubectl delete pods -n dataplatform kafkarest-0
  3. Check the kafkarest config file:
    $ kubectl -n dataplatform exec --stdin --tty kafkarest-0 -- /bin/bash
    $ cat /opt/mapr/kafka-rest/kafka-rest-5.1.2/config/kafka-rest.properties 
    listeners=https://0.0.0.0:8082
    authentication.enable=true 
    impersonation.enable=true 
    schema.registry.enable=false 
    streams.default.stream=/st
    headers.file=/opt/mapr/kafka-rest/kafka-rest-5.1.2/config/headers.xml 
    host.name=kafkarest-svc.dataplatform.svc.cluster.local