2

I have the requirement to run a Kafka Rest Proxy for my Confluent Cloud and would like to use the existing Docker container that is provided by Confluent Cloud.

I got the Docker container running with the following command on my local machine:

docker run -p 8082:8082 --env-file env.list confluentinc/cp-kafka-rest

The env.file contains the following variables:

KAFKA_REST_HOST_NAME=rest-proxy
KAFKA_REST_LISTENERS=http://0.0.0.0:8082
KAFKA_REST_SCHEMA_REGISTRY_URL=<HIDDEN>
KAFKA_REST_CLIENT_SCHEMA_REGISTRY_BASIC_AUTH_USER_INFO=<HIDDEN>
KAFKA_REST_BOOTSTRAP_SERVERS=<HIDDEN>
KAFKA_REST_SECURITY_PROTOCOL=SASL_SSL
KAFKA_REST_SASL_JAAS_CONFIG=org.apache.kafka.common.security.plain.PlainLoginModule required username='<HIDDEN>' password='<HIDDEN>';
KAFKA_REST_SASL_MECHANISM=PLAIN
KAFKA_REST_CLIENT_BOOTSTRAP_SERVERS=<HIDDEN>
KAFKA_REST_CLIENT_SECURITY_PROTOCOL=SASL_SSL
KAFKA_REST_CLIENT_SASL_JAAS_CONFIG=org.apache.kafka.common.security.plain.PlainLoginModule required username='<HIDDEN>' password='<HIDDEN>';
KAFKA_REST_CLIENT_SASL_MECHANISM=PLAIN

Following the guide from Confluent Cloud for HTTP Basic Authentication I need to add two files (/etc/kafka-rest/rest-jaas.properties and /etc/kafka-rest/password.properties) and some env variables for the basic auth to work.

I added the following variables to the env.file

KAFKA_REST_CLIENT_SASL_MECHANISM=PLAIN
KAFKA_REST_AUTHENTICATION_METHOD=BASIC
KAFKA_REST_AUTHENTICATION_REALM=KafkaRest
KAFKA_REST_AUTHENTICATION_ROLES=thisismyrole
KAFKAREST_OPTS=-Djava.security.auth.login.config=/etc/kafka-rest/rest-jaas.properties

And I created a new Docker image:

FROM confluentinc/cp-kafka-rest:latest

COPY password.properties /etc/kafka-rest/
COPY rest-jaas.properties /etc/kafka-rest/

CMD ["/etc/confluent/docker/run"]

Running the new Docker image with docker run -p 8082:8082 --env-file env.list my-image/cp-kafka-rest the basic auth works...

...but now to my question:

Is it possible to get this working without having to create a new Docker image? I would like to avoid to have to maintain a new Docker image myself and just use the image provided by Confluent Cloud.

Shamshiel
  • 2,051
  • 3
  • 31
  • 50

0 Answers0