이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 12. Using the User Operator to manage Kafka users
When you create, modify or delete a user using the KafkaUser resource, the User Operator ensures that these changes are reflected in the Kafka cluster.
For more information on the KafkaUser resource, see the KafkaUser schema reference.
12.1. Configuring Kafka users 링크 복사링크가 클립보드에 복사되었습니다!
Use the properties of the KafkaUser resource to configure Kafka users.
You can use oc apply to create or modify users, and oc delete to delete existing users.
For example:
-
oc apply -f <user_config_file> -
oc delete KafkaUser <user_name>
Users represent Kafka clients. When you configure Kafka users, you enable the user authentication and authorization mechanisms required by clients to access Kafka. The mechanism used must match the equivalent Kafka configuration. For more information on using Kafka and KafkaUser resources to secure access to Kafka brokers, see https://docs.redhat.com/en/documentation/red_hat_streams_for_apache_kafka/2.9/html-single/deploying_and_managing_streams_for_apache_kafka_on_openshift/index#assembly-securing-access-str.
Prerequisites
- A running Kafka cluster configured with a Kafka broker listener using mTLS authentication and TLS encryption.
- A running User Operator (typically deployed with the Entity Operator).
Procedure
Configure the
KafkaUserresource.This example specifies mTLS authentication and simple authorization using ACLs.
Example Kafka user configuration
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the
KafkaUserresource in OpenShift.oc apply -f <user_config_file>
oc apply -f <user_config_file>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Wait for the ready status of the user to change to
True:oc get kafkausers -o wide -w -n <namespace>
oc get kafkausers -o wide -w -n <namespace>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Kafka user status
NAME CLUSTER AUTHENTICATION AUTHORIZATION READY my-user-1 my-cluster tls simple True my-user-2 my-cluster tls simple my-user-3 my-cluster tls simple True
NAME CLUSTER AUTHENTICATION AUTHORIZATION READY my-user-1 my-cluster tls simple True my-user-2 my-cluster tls simple my-user-3 my-cluster tls simple TrueCopy to Clipboard Copied! Toggle word wrap Toggle overflow User creation is successful when the
READYoutput showsTrue.If the
READYcolumn stays blank, get more details on the status from the resource YAML or User Operator logs.Messages provide details on the reason for the current status.
oc get kafkausers my-user-2 -o yaml
oc get kafkausers my-user-2 -o yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Details on a user with a
NotReadystatusCopy to Clipboard Copied! Toggle word wrap Toggle overflow In this example, the reason the user is not ready is because simple authorization is not enabled in the
Kafkaconfiguration.Kafka configuration for simple authorization
Copy to Clipboard Copied! Toggle word wrap Toggle overflow After updating the Kafka configuration, the status shows the user is ready.
oc get kafkausers my-user-2 -o wide -w -n <namespace>
oc get kafkausers my-user-2 -o wide -w -n <namespace>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Status update of the user
NAME CLUSTER AUTHENTICATION AUTHORIZATION READY my-user-2 my-cluster tls simple True
NAME CLUSTER AUTHENTICATION AUTHORIZATION READY my-user-2 my-cluster tls simple TrueCopy to Clipboard Copied! Toggle word wrap Toggle overflow Fetching the details shows no messages.
oc get kafkausers my-user-2 -o yaml
oc get kafkausers my-user-2 -o yamlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Details on a user with a
READYstatusCopy to Clipboard Copied! Toggle word wrap Toggle overflow