Skip to main content
Quick navigation

Environment Variables

Configuring the environment variables is the recommended way of setting up Conduktor Gateway.

Jump to:

Kafka Environment Variables

Conduktor Gateway's connection to Kafka are configured by the KAFKA_ environment variables. When translating Kafka's properties, use upper case instead and replace the . with _.

For example;
When defining Gateway's Kafka property bootstrap.servers, declare it as the environment variable KAFKA_BOOTSTRAP_SERVERS.

Any variable prefixed with KAFKA_ will be treated as a connection parameter by Gateway.

Gateway Environment Variables

Default configurations for Conduktor Gateway can be overridden by environment variables.

Guidelines

There is no typical deployment of Gateway as every environment will be unique in it's design considerations and security requirements.

The below is an example including some variables we recommend you modify in any setup you do, but is by no means a guarantee of sufficient requirements in your setup.

We will support you in onboarding of Conduktor Gateway to help you get setup in the first place and for any ongoing issues or questions please contact support at support@conduktor.io.

Example Values

  -e KAFKA_BOOTSTRAP_SERVERS=kafka1:9092,kafka2:9092 \
-e KAFKA_SECURITY_PROTOCOL=SASL_PLAINTEXT \
-e KAFKA_SASL_MECHANISM=PLAIN \
-e KAFKA_SASL_JAAS_CONFIG="org.apache.kafka.common.security.plain.PlainLoginModule required username='usr' password='pwd';"

Host/Port

Environment VariableDefault ValueDescription
GATEWAY_BIND_HOST0.0.0.0The host on which to bind the gateway
GATEWAY_ADVERTISED_HOSTYour hostnameThe gateway hostname that should be presented to clients
GATEWAY_PORT_START6969Port on which Gateway will start listening on
GATEWAY_PORT_COUNT(maxBrokerId-minBrokerId)+3Number of ports to be used by the Gateway, see networking for more on host/port configuration.
GATEWAY_MIN_BROKERID0The broker id associated to Gateway's first port (GATEWAY_PORT_START), should be the lowest broker.id (or node.id) defined in the Kafka cluster.
GATEWAY_ROUTING_MECHANISMportport or host.
SNI Routing onlyCheck our dedicated guide on SNI Routing
GATEWAY_ADVERTISED_SNI_PORTnonePort to be advertised to the client if routing mechanism is set to host for SNI routing.
GATEWAY_ADVERTISED_HOST_PREFIXbrokerSet the host prefix when using SNI Routing
GATEWAY_SNI_HOST_SEPARATOR.Set the host separator when using SNI Routing

Load Balancing

Environment VariableDefault ValueDescription
GATEWAY_CLUSTER_IDconduktorGatewayA unique identifier for a given Gateway cluster, this is used to establish Gateway cluster membership for load balancing
GATEWAY_FEATURE_FLAGS_INTERNAL_LOAD_BALANCINGtrueWhether to use Conduktor Gateway's internal load balancer to balance connections between Gateway instances.
GATEWAY_RACK_IDnoneSimilar as broker.rack

Client to Gateway Authentication

Note: These configurations apply to authentication between clients and Conduktor Gateway. For authentication between Conduktor Gateway and Kafka see Kafka Environment Variables

Environment VariableDefault ValueDescription
GATEWAY_SECURITY_PROTOCOLdefaults to KAFKA_SECURITY_PROTOCOLThe type of authentication clients should use to connect to the gateway, valid values are PLAINTEXT, SASL_PLAINTEXT, SASL_SSL, SSL, DELEGATED_SASL_PLAINTEXT and DELEGATED_SASL_SSL
GATEWAY_FEATURE_FLAGS_MANDATORY_VCLUSTERdefault to falseIf no virtual cluster was detected then user automatically falls back into the transparent virtual cluster, named passthrough. Reject authentication if set to true and vcluster is not configured for a principal
GATEWAY_ACL_ENABLEDdefault to falseEnable / Disable ACLs support on the Gateway (not including Virtual Clusters)
GATEWAY_ACL_STORE_ENABLEDdefault to falseEnable / Disable ACLs support for Virtual Clusters only.

SSL

Environment VariableDefault ValueDescription
GATEWAY_SSL_KEY_STORE_PATHconfig/kafka-proxy.keystore.jksPath to a keystore for SSL connections
GATEWAY_SSL_KEY_STORE_PASSWORD123456Password for the keystore defined above
GATEWAY_SSL_KEY_PASSWORD123456Password for the key contained in the store above
GATEWAY_SSL_KEY_TYPEjksWe currently only support jks
GATEWAY_SSL_UPDATE_INTERVAL_MS600000
GATEWAY_SSL_UPDATE_CONTEXT_INTERVAL_MINUTES5Interval in minutes to refresh SSL context
Environment VariableDefault ValueDescription
GATEWAY_SSL_TRUST_STORE_PATHconfig/kafka-proxy.truststore.jksPath to a keystore for SSL connections
GATEWAY_SSL_TRUST_STORE_PASSWORD123456Password for the keystore defined above
GATEWAY_SSL_TRUST_STORE_TYPEjksWe currently only support jks
GATEWAY_SSL_CLIENT_AUTHNONENONE will not request client authentication, OPTIONAL will request client authentication, REQUIRE will require client authentication

SSL Config

Environment VariableDefault ValueDescription
GATEWAY_AUTHENTICATION_CONNECTION_MAX_REAUTH_MS0Max Reauth
GATEWAY_AUTHENTICATION_TIMEOUT_MS1000Timeout in ms
GATEWAY_AUTHENTICATION_EXPONENTIAL_BACKOFF_MULTIPLIER2Backoff multiplier on reauth
GATEWAY_AUTHENTICATION_EXPONENTIAL_BACKOFF_MAX_MS5000Max backoff

MTLS

More context for mTLS here

Environment VariableDefault ValueDescription
GATEWAY_SSL_PRINCIPAL_MAPPING_RULESextracts the CNmTLS leverages SSL mutual authentication to identify a Kafka client. Principal for mTLS connection can be detected from the subject certificate using the same feature as in Apache Kafka, the SSL principal mapping

OAuthbearer

Some of these definitions are taken from the Kafka documentation, e.g. JKWS_REFRESH.

Environment VariableDefault ValueDescription
GATEWAY_OAUTH_JWKS_URLNULLThe OAuth/OIDC provider URL from which the provider's JWKS (JSON Web Key Set) can be retrieved. The URL can be HTTP(S)-based or file-based.
GATEWAY_OAUTH_EXPECTED_ISSUERNULLThe (optional) setting for the broker to use to verify that the JWT was created by the expected issuer. The JWT will be inspected for the standard OAuth iss claim and if this value is set, the broker will match it exactly against what is in the JWT's iss claim. If there is no match, the broker will reject the JWT and authentication will fail
GATEWAY_OAUTH_EXPECTED_AUDIENCESNULLThe (optional) comma-delimited setting for the broker to use to verify that the JWT was issued for one of the expected audiences. The JWT will be inspected for the standard OAuth aud claim and if this value is set, the broker will match the value from JWT's aud claim to see if there is an exact match. If there is no match, the broker will reject the JWT and authentication will fail.
GATEWAY_OAUTH_JWKS_REFRESHNULLThe (optional) value in milliseconds for the broker to wait between refreshing its JWKS (JSON Web Key Set) cache that contains the keys to verify the signature of the JWT.
GATEWAY_OAUTH_JWKS_RETRYNULLThe (optional) value in milliseconds for the initial wait between JWKS (JSON Web Key Set) retrieval attempts from the external authentication provider. JWKS retrieval uses an exponential backoff algorithm with an initial wait based on the sasl.oauthbearer.jwks.endpoint.retry.backoff.ms setting and will double in wait length between attempts up to a maximum wait length specified by the sasl.oauthbearer.jwks.endpoint.retry.backoff.max.ms setting
GATEWAY_OAUTH_JWKS_MAX_RETRYNULLThe (optional) value in milliseconds for the maximum wait between attempts to retrieve the JWKS (JSON Web Key Set) from the external authentication provider. JWKS retrieval uses an exponential backoff algorithm with an initial wait based on the sasl.oauthbearer.jwks.endpoint.retry.backoff.ms setting and will double in wait length between attempts up to a maximum wait length specified by the sasl.oauthbearer.jwks.endpoint.retry.backoff.max.ms setting
GATEWAY_OAUTH_SCOPE_CLAIM_NAMENULLThe OAuth claim for the scope is often named scope, but this (optional) setting can provide a different name to use for the scope included in the JWT payload's claims if the OAuth/OIDC provider uses a different name for that claim.
GATEWAY_OAUTH_SUB_CLAIM_NAMENULLThe OAuth claim for the subject is often named sub, but this (optional) setting can provide a different name to use for the subject included in the JWT payload's claims if the OAuth/OIDC provider uses a different name for that claim.

PLAIN

These settings are used when credentials are managed on the Gateway, see Client Authentication for details.

Environment VariableDefault ValueDescription
GATEWAY_USER_POOL_SECRET_KEYA default value is used to sign tokens and must be changed.Used for the PLAIN mechanism when generating JWT tokens for clients. You must set a random value which is at least 256 bit long to ensure tokens can't be forged.

SECURITY PROVIDER

Environment VariableDefault ValueDescription
GATEWAY_SECURITY_PROVIDERDEFAULTSpecify your security provider, can be DEFAULT (from your JRE), BOUNCY_CASTLE, BOUNCY_CASTLE_FIPS and CONSCRYPT

Please note that CONSCRYPT does not support Mac OS with aarch64.

SECRET MANAGEMENT

Secrets may be passed from configuration to Gateway using environment variables. Some suggested examples are below that may be more common, but you are free to use your own and avoid any clashes with existing environment variables.

  • SCHEMA_REGISTRY_LOGIN
  • SCHEMA_REGISTRY_PASSWORD
  • AWS_ACCESS_KEY
  • AWS_SECRET_KEY
  • AWS_SESSION_TOKEN
  • AZURE_CLIENT_ID
  • AZURE_TENANT_ID
  • AZURE_CLIENT_SECRET
  • VAULT_TOKEN
  • VAULT_USERNAME
  • VAULT_PASSWORD
  • etc.

HTTP

Environment VariableDefault ValueDescription
GATEWAY_HTTP_PORT8888The port on which the gateway will present the HTTP management API
GATEWAY_SECURED_METRICStrueDoes the HTTP management API require authentication?
GATEWAY_ADMIN_API_USERS[{username: admin, password: conduktor, admin: true}]Users that can access the api, please note that admin is required to do any write
GATEWAY_HTTPS_CLIENT_AUTHNONEClient auth configuration for HTTPS incoming connection. Possible values: NONE, REQUEST, REQUIRED
GATEWAY_HTTPS_KEY_STORE_PATHActivates HTTPS and defines the keystore to use for TLS connection
GATEWAY_HTTPS_KEY_STORE_PASSWORDConfigures the password of the keystore used for HTTPS TLS connection
GATEWAY_HTTPS_TRUST_STORE_PATHConfigure the truststore used for the HTTPS TLS connection
GATEWAY_HTTPS_TRUST_STORE_PASSWORDConfigures the password of the truststore used for HTTPS TLS connection

Internal State

To keep the Gateway instances stateless, internal state is stored in Kafka topics.

Environment VariableDefault ValueDescription
GATEWAY_GROUP_IDnullSet the group name for internal topic if not defined
GATEWAY_STORE_TTL_MS604800000Time between full refresh
GATEWAY_TOPIC_STORE_REAL_TOPIC_PARTITION_COUNT-1Defaults to the one defined in your cluster settings
GATEWAY_TOPIC_STORE_KCACHE_REPLICATION_FACTOR-1Defaults to the one defined in your cluster settings
GATEWAY_TOPIC_STORE_DISTRIBUTED_CATCHUP_TIMEOUT_IN_SECONDS1Duration for catchup

Topic Names

Environment VariableDefault ValueDescription
GATEWAY_LICENSE_TOPIC_conduktor_gateway_licenseName of license topic
GATEWAY_TOPIC_MAPPINGS_TOPIC_conduktor_gateway_topicmappingsName of topicMappings topic
GATEWAY_USER_MAPPINGS_TOPIC_conduktor_gateway_usermappingsName of the user mapping topic
GATEWAY_CONSUMER_SUBSCRIPTIONS_TOPIC_conduktor_gateway_consumer_subscriptionsName of the subscriptions for concentrated topic consumption topic
GATEWAY_CONSUMER_OFFSETS_TOPIC_conduktor_gateway_consumer_offsetsName of the topic to store the offsets for concentrated topic consumption
GATEWAY_INTERCEPTOR_CONFIGS_TOPIC_conduktor_gateway_interceptor_configsName of interceptor config topic
GATEWAY_ENCRYPTION_CONFIGS_TOPIC_conduktor_gateway_encryption_configsName of encryption configuration topic
GATEWAY_ACLS_TOPIC_conduktor_gateway_aclsName of the acl topic
GATEWAY_AUDIT_LOG_TOPIC_conduktor_gateway_auditlogsName of audit topic
GATEWAY_VCLUSTERS_TOPIC_conduktor_gateway_vclustersName of vclusters topic
GATEWAY_GROUPS_TOPIC_conduktor_gateway_groupsName of groups topic

Cluster Switching / Failover

For a fuller description of the failover experience see the failover how-to. Setup of environment variables is similar to normally connecting to a Kafka cluster, but you provide two sets, one for your main cluster, one for your failover cluster. You can also load a cluster-config file if you prefer.

Environment VariableDefault ValueDescription
GATEWAY_BACKEND_KAFKA_SELECTORIndicates use of a file for config, and provide path to it e.g. 'file : { path: /cluster-config.yaml}'
KAFKA_MAIN_BOOTSTRAP_SERVERSBootstrap server of the main cluster
KAFKA_MAIN_SECURITY_PROTOCOLSecurity protocol of the main cluster
KAFKA_MAIN_SASL_MECHANISMSASL mechanism of the main cluster
KAFKA_MAIN_SASL_JAAS_CONFIGSASL jaas config of the main cluster
KAFKA_FAILOVER_BOOTSTRAP_SERVERSBootstrap server of the failover cluster
KAFKA_FAILOVER_SECURITY_PROTOCOLSecurity protocol of the failover cluster
KAFKA_FAILOVER_SASL_MECHANISMSASL mechanism of the main cluster
KAFKA_FAILOVER_SASL_JAAS_CONFIGSASL jaas config of the main cluster
KAFKA_FAILOVER_GATEWAY_ROLESSet the Gateway into failover mode, set this to failover for this scenario

Internal Setup

Threading

Environment VariableDefault ValueDescription
GATEWAY_DOWNSTREAM_THREADnumber of coresThe number of threads dedicated to handling IO between clients and Conduktor Gateway
GATEWAY_UPSTREAM_THREADnumber of coresThe number of threads dedicated to handling IO between Kafka and Conduktor Gateway

Upstream Connection

Environment VariableDefault ValueDescription
GATEWAY_UPSTREAM_CONNECTION_POOL_TYPENONEUpstream connection pool type. Possible values are NONE (no connection pool), ROUND_ROBIN (Round robin selected connection pool)
GATEWAY_UPSTREAM_NUM_CONNECTION10The number of connections between Conduktor Gateway and Kafka per upstream thread. Used only when ROUND_ROBIN is enabled.

Feature Flags

Environment VariableDefault ValueDescription
GATEWAY_FEATURE_FLAGS_AUDITtrueWhether or not to enable the audit feature
GATEWAY_FEATURE_FLAGS_INTERNAL_LOAD_BALANCINGtrueWhether or not to enable we replicate kafka internal load balancing

Licensing

Environment VariableDefault ValueDescription
GATEWAY_LICENSE_KEYNoneLicense key

Audit

Environment VariableDefault ValueDescription
GATEWAY_AUDIT_LOG_CONFIG_SPEC_VERSION0.1.0Version
GATEWAY_AUDIT_LOG_SERVICE_BACKING_TOPIC_auditLogsTarget topic name
GATEWAY_AUDIT_LOG_REPLICATION_FACTOR_OF_TOPIC-1Replication factor to be used when creating the audit topic, defaults to the one defined in your cluster settings
GATEWAY_AUDIT_LOG_NUM_PARTITIONS_OF_TOPIC-1Number of partitions to be used when creating the audit topic, defaults to the one defined in your cluster settings
GATEWAY_AUDIT_LOG_KAFKA_Overrides Kafka Producer configuration for Audit Logs ie. GATEWAY_AUDIT_LOG_KAFKA_LINGER_MS=0

Logging

Environment VariableDefault ValueDescriptionPackage
LOG4J2_APPENDER_LAYOUTpatternThe format to output console logging. Use json for json layout or pattern for pattern layout
LOG4J2_IO_CONDUKTOR_PROXY_NETWORK_LEVELinfoLow-level networking, connection mapping, authentication, authorizationio.conduktor.proxy.network
LOG4J2_IO_CONDUKTOR_UPSTREAM_THREAD_LEVELinfoRequests processing and forwarding. At trace, log requests sentio.conduktor.proxy.thread.UpstreamThread
LOG4J2_IO_CONDUKTOR_PROXY_REBUILDER_COMPONENTS_LEVELinfoRequests and responses rewriting. Logs responses payload in debug (useful for checking METADATA)io.conduktor.proxy.rebuilder.components
LOG4J2_IO_CONDUKTOR_PROXY_SERVICE_LEVELinfoVarious. Logs ACL checks and interceptor targettings at debug. Logs post-interceptor requests/response payload at traceio.conduktor.proxy.service
LOG4J2_IO_CONDUKTOR_LEVELinfoGet even more logs not covered by specific packagesio.conduktor
LOG4J2_ORG_APACHE_KAFKA_LEVELwarnKafka log levelorg.apache.kafka
LOG4J2_IO_KCACHE_LEVELwarnKcache log level (our persistence library)io.kcache
LOG4J2_IO_VERTX_LEVELwarnVertx log level (our HTTP API framework)io.vertx
LOG4J2_IO_NETTY_LEVELerrorNetty log level (our network framework)io.netty
LOG4J2_IO_MICROMETER_LEVELerrorMicrometer log level (our metrics framework)io.micrometer
LOG4J2_ROOT_LEVELinfoRoot logging level (applies to anything else)(root)

Product Analytics

Environment VariableDefault ValueDescription
GATEWAY_FEATURE_FLAGS_ANALYTICStrueConduktor collects basic user analytics to understand product usage and enhance product development and improvement, such as a Gateway Started event. This is not based on any of the underlying Kafka data which is never sent to Conduktor.