我正在尝试通过SASL对我的Kafka rest代理进行身份验证,但是我无法将本地docker compose中所做的配置转移到Kubernetes。
我正在使用JAAS配置来实现这一点。我的JAAS文件看起来像这样。
KafkaClient {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="rest"
password="rest-secret";
};
Client {
org.apache.zookeeper.server.auth.DigestLoginModule required
username="rest"
password="restsecret";
};
然后在我的docker compose中,我完成了:
KAFKA_OPTS: -Djava.security.auth.login.config=/etc/kafka/secrets/rest_jaas.conf
我将如何将同样的逻辑转移到Kubernetes?我试过像这样传递env变量:
env:
- name: KAFKA_OPTS
value: |
KafkaClient {
org.apache.kafka.common.security.plain.PlainLoginModule required
username="rest"
password="rest-secret";
};
Client {
org.apache.zookeeper.server.auth.DigestLoginModule required
username="rest"
password="rest-secret";
};
但仍然失败。这是我的日志所说的:
Error: Could not find or load main class KafkaClient
/bin/sh: 3: org.apache.kafka.common.security.plain.PlainLoginModule: not found
/bin/sh: 6: Syntax error: "}" unexpected
非常感谢您的帮助。
将您的Kafka JAAS配置文件另存为rest_jaas.conf。然后执行:
kubectl create secret generic kafka-secret --from-file=rest_jaas.conf
然后在您的部署中插入:
env:
- name: KAFKA_OPTS
value: -Djava.security.auth.login.config=/etc/kafka/secrets/rest_jaas.conf
volumeMounts:
- name: kafka-secret
mountPath: /etc/kafka/secrets
subPath: rest_jaas.conf
volumes:
- name: kafka-secret
secret:
secretName: kafka-secret
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句