<p>I'm trying to give max.request.size to Kafka in kubernetes, it seems doesn't work. How to do that?</p>

<p>I tried also with <code>KAFKA_MAX_REQUEST_SIZE</code> again no positive result:</p>

<pre><code>  spec:
  containers:
  - name: kafka
    image: wurstmeister/kafka
    ...

    env:
    - name: KAFKA_ZOOKEEPER_CONNECT
      value: "zookeeper:2181"
    - name: KAFKA_ADVERTISED_PORT
      value: "9092"
    - name: KAFKA_DELETE_TOPIC_ENABLE
      value: "true"
    - name: KAFKA_CREATE_TOPICS
      value: "tpinput:1:1,tpoutput:1:1,operinput:1:1,operoutput:1:1,authoutput:1:1"  
    - name: KAFKA_JMX_PORT
      value: "7071"             
    - name: KAFKA_ZOOKEEPER_TIMEOUT_MS
      value: "16000"
    - name: KAFKA_MESSAGE_MAX_BYTES
      value: "209715200"
    - name: KAFKA_FETCH_MESSAGE_MAX_BYTES
      value: "209715200"  
    - name: KAFKA_REPLICA_FETCH_MAX_BYTES
      value: "209715200" 
    - name: KAFKA_PRODUCER_MAX_REQUEST_SIZE
      value: "9651322321"
    - name: KAFKA_ADVERTISED_HOST_NAME
      valueFrom:
        fieldRef:
          fieldPath: status.podIP        
    - name: KUBE_POD_NAME
      valueFrom:
        fieldRef:
          fieldPath: metadata.name
    imagePullPolicy: Always
    restartPolicy: Always
    envFrom:
    - configMapRef:
        name: env-config-for-pods
</code></pre>

<p>Based on the Docker entrypoint script <a href="https://github.com/wurstmeister/kafka-docker/blob/master/start-kafka.sh" rel="nofollow noreferrer">here</a> and this part in that file:</p>

<pre><code>EXCLUSIONS="|KAFKA_VERSION|KAFKA_HOME|KAFKA_DEBUG|KAFKA_GC_LOG_OPTS|KAFKA_HEAP_OPTS|KAFKA_JMX_OPTS|KAFKA_JVM_PERFORMANCE_OPTS|KAFKA_LOG|KAFKA_OPTS|"

# Read in env as a new-line separated array. This handles the case of env variables have spaces and/or carriage returns. See #313
IFS=$'\n'
for VAR in $(env)
do
    env_var=$(echo "$VAR" | cut -d= -f1)
    if [[ "$EXCLUSIONS" = *"|$env_var|"* ]]; then
        echo "Excluding $env_var from broker config"
        continue
    fi

    if [[ $env_var =~ ^KAFKA_ ]]; then
        kafka_name=$(echo "$env_var" | cut -d_ -f2- | tr '[:upper:]' '[:lower:]' | tr _ .)
        updateConfig "$kafka_name" "${!env_var}" "$KAFKA_HOME/config/server.properties"
    fi

    if [[ $env_var =~ ^LOG4J_ ]]; then
        log4j_name=$(echo "$env_var" | tr '[:upper:]' '[:lower:]' | tr _ .)
        updateConfig "$log4j_name" "${!env_var}" "$KAFKA_HOME/config/log4j.properties"
    fi
done
</code></pre>

<p><code>KAFKA_MAX_REQUEST_SIZE</code> should be included in the <code>$KAFKA_HOME/config/server.properties</code> file as <code>max.request.size</code>. I wouldn't be surprised if there's a bug in the docker image. </p>

<p>You can always shell into your Kafka pod and check the <code>$KAFKA_HOME/config/server.properties</code> config file.</p>

<pre><code>kubectl exec -it &lt;kafka-pod&gt; -c &lt;kafka-container&gt; sh
</code></pre>
