17.2. Secrets generated by the operators


The Cluster Operator automatically sets up and renews TLS certificates to enable encryption and authentication within a cluster. It also sets up other TLS certificates if you want to enable encryption or mTLS authentication between Kafka brokers and clients.

Secrets are created when custom resources are deployed, such as Kafka and KafkaUser. Streams for Apache Kafka uses these secrets to store private and public key certificates for Kafka clusters, clients, and users. The secrets are used for establishing TLS encrypted connections between Kafka brokers, and between brokers and clients. They are also used for mTLS authentication.

Cluster and clients secrets are always pairs: one contains the public key and one contains the private key.

Cluster secret
A cluster secret contains the cluster CA to sign Kafka broker certificates. Connecting clients use the certificate to establish a TLS encrypted connection with a Kafka cluster. The certificate verifies broker identity.
Client secret
A client secret contains the clients CA for a user to sign its own client certificate. This allows mutual authentication against the Kafka cluster. The broker validates a client’s identity through the certificate.
User secret
A user secret contains a private key and certificate. The secret is created and signed by the clients CA when a new user is created. The key and certificate are used to authenticate and authorize the user when accessing the cluster.
注意

You can provide Kafka listener certificates for TLS listeners or external listeners that have TLS encryption enabled. Use Kafka listener certificates to incorporate the security infrastructure you already have in place.

The secrets created by Streams for Apache Kafka provide private keys and certificates in PEM (Privacy Enhanced Mail) and PKCS #12 (Public-Key Cryptography Standards) formats. PEM and PKCS #12 are OpenSSL-generated key formats for TLS communications using the SSL protocol.

You can configure mutual TLS (mTLS) authentication that uses the credentials contained in the secrets generated for a Kafka cluster and user.

To set up mTLS, you must first do the following:

When you deploy a Kafka cluster, a <cluster_name>-cluster-ca-cert secret is created with public key to verify the cluster. You use the public key to configure a truststore for the client.

When you create a KafkaUser, a <kafka_user_name> secret is created with the keys and certificates to verify the user (client). Use these credentials to configure a keystore for the client.

With the Kafka cluster and client set up to use mTLS, you extract credentials from the secrets and add them to your client configuration.

PEM keys and certificates

For PEM, you add the following to your client configuration:

Truststore
  • ca.crt from the <cluster_name>-cluster-ca-cert secret, which is the CA certificate for the cluster.
Keystore
  • user.crt from the <kafka_user_name> secret, which is the public certificate of the user.
  • user.key from the <kafka_user_name> secret, which is the private key of the user.
PKCS #12 keys and certificates

For PKCS #12, you add the following to your client configuration:

Truststore
  • ca.p12 from the <cluster_name>-cluster-ca-cert secret, which is the CA certificate for the cluster.
  • ca.password from the <cluster_name>-cluster-ca-cert secret, which is the password to access the public cluster CA certificate.
Keystore
  • user.p12 from the <kafka_user_name> secret, which is the public key certificate of the user.
  • user.password from the <kafka_user_name> secret, which is the password to access the public key certificate of the Kafka user.

PKCS #12 is supported by Java, so you can add the values of the certificates directly to your Java client configuration. You can also reference the certificates from a secure storage location. With PEM files, you must add the certificates directly to the client configuration in single-line format. Choose a format that’s suitable for establishing TLS connections between your Kafka cluster and client. Use PKCS #12 if you are unfamiliar with PEM.

注意

All keys are 2048 bits in size and, by default, are valid for 365 days from the initial generation. You can change the validity period.

17.2.2. Secrets generated by the Cluster Operator

The Cluster Operator generates the following certificates, which are saved as secrets in the OpenShift cluster. Streams for Apache Kafka uses these secrets by default.

The cluster CA and clients CA have separate secrets for the private key and public key.

<cluster_name>-cluster-ca
Contains the private key of the cluster CA. Streams for Apache Kafka and Kafka components use the private key to sign server certificates.
<cluster_name>-cluster-ca-cert
Contains the public key of the cluster CA. Kafka clients use the public key to verify the identity of the Kafka brokers they are connecting to with TLS server authentication.
<cluster_name>-clients-ca
Contains the private key of the clients CA. Kafka clients use the private key to sign new user certificates for mTLS authentication when connecting to Kafka brokers.
<cluster_name>-clients-ca-cert
Contains the public key of the clients CA. Kafka brokers use the public key to verify the identity of clients accessing the Kafka brokers when mTLS authentication is used.

Secrets for communication between Streams for Apache Kafka components contain a private key and a public key certificate signed by the cluster CA.

<cluster_name>-kafka-brokers
Contains the private and public keys for Kafka brokers.
<cluster_name>-zookeeper-nodes
Contains the private and public keys for ZooKeeper nodes.
<cluster_name>-cluster-operator-certs
Contains the private and public keys for encrypting communication between the Cluster Operator and Kafka or ZooKeeper.
<cluster_name>-entity-topic-operator-certs
Contains the private and public keys for encrypting communication between the Topic Operator and Kafka or ZooKeeper.
<cluster_name>-entity-user-operator-certs
Contains the private and public keys for encrypting communication between the User Operator and Kafka or ZooKeeper.
<cluster_name>-cruise-control-certs
Contains the private and public keys for encrypting communication between Cruise Control and Kafka or ZooKeeper.
<cluster_name>-kafka-exporter-certs
Contains the private and public keys for encrypting communication between Kafka Exporter and Kafka or ZooKeeper.
注意

You can provide your own server certificates and private keys to connect to Kafka brokers using Kafka listener certificates rather than certificates signed by the cluster CA.

17.2.3. Cluster CA secrets

Cluster CA secrets are managed by the Cluster Operator in a Kafka cluster.

Only the <cluster_name>-cluster-ca-cert secret is required by clients. All other cluster secrets are accessed by Streams for Apache Kafka components. You can enforce this using OpenShift role-based access controls, if necessary.

注意

The CA certificates in <cluster_name>-cluster-ca-cert must be trusted by Kafka client applications so that they validate the Kafka broker certificates when connecting to Kafka brokers over TLS.

Expand
表 17.1. Fields in the <cluster_name>-cluster-ca secret
FieldDescription

ca.key

The current private key for the cluster CA.

Expand
表 17.2. Fields in the <cluster_name>-cluster-ca-cert secret
FieldDescription

ca.p12

PKCS #12 store for storing certificates and keys.

ca.password

Password for protecting the PKCS #12 store.

ca.crt

The current certificate for the cluster CA.

Expand
表 17.3. Fields in the <cluster_name>-kafka-brokers secret
FieldDescription

<cluster_name>-kafka-<num>.p12

PKCS #12 store for storing certificates and keys.

<cluster_name>-kafka-<num>.password

Password for protecting the PKCS #12 store.

<cluster_name>-kafka-<num>.crt

Certificate for a Kafka broker pod <num>. Signed by a current or former cluster CA private key in <cluster_name>-cluster-ca.

<cluster_name>-kafka-<num>.key

Private key for a Kafka broker pod <num>.

Expand
表 17.4. Fields in the <cluster_name>-zookeeper-nodes secret
FieldDescription

<cluster_name>-zookeeper-<num>.p12

PKCS #12 store for storing certificates and keys.

<cluster_name>-zookeeper-<num>.password

Password for protecting the PKCS #12 store.

<cluster_name>-zookeeper-<num>.crt

Certificate for ZooKeeper node <num>. Signed by a current or former cluster CA private key in <cluster_name>-cluster-ca.

<cluster_name>-zookeeper-<num>.key

Private key for ZooKeeper pod <num>.

Expand
表 17.5. Fields in the <cluster_name>-cluster-operator-certs secret
FieldDescription

cluster-operator.p12

PKCS #12 store for storing certificates and keys.

cluster-operator.password

Password for protecting the PKCS #12 store.

cluster-operator.crt

Certificate for mTLS communication between the Cluster Operator and Kafka or ZooKeeper. Signed by a current or former cluster CA private key in <cluster_name>-cluster-ca.

cluster-operator.key

Private key for mTLS communication between the Cluster Operator and Kafka or ZooKeeper.

Expand
表 17.6. Fields in the <cluster_name>-entity-topic-operator-certs secret
FieldDescription

entity-operator.p12

PKCS #12 store for storing certificates and keys.

entity-operator.password

Password for protecting the PKCS #12 store.

entity-operator.crt

Certificate for mTLS communication between the Topic Operator and Kafka or ZooKeeper. Signed by a current or former cluster CA private key in <cluster_name>-cluster-ca.

entity-operator.key

Private key for mTLS communication between the Topic Operator and Kafka or ZooKeeper.

Expand
表 17.7. Fields in the <cluster_name>-entity-user-operator-certs secret
FieldDescription

entity-operator.p12

PKCS #12 store for storing certificates and keys.

entity-operator.password

Password for protecting the PKCS #12 store.

entity-operator.crt

Certificate for mTLS communication between the User Operator and Kafka or ZooKeeper. Signed by a current or former cluster CA private key in <cluster_name>-cluster-ca.

entity-operator.key

Private key for mTLS communication between the User Operator and Kafka or ZooKeeper.

Expand
表 17.8. Fields in the <cluster_name>-cruise-control-certs secret
FieldDescription

cruise-control.p12

PKCS #12 store for storing certificates and keys.

cruise-control.password

Password for protecting the PKCS #12 store.

cruise-control.crt

Certificate for mTLS communication between Cruise Control and Kafka or ZooKeeper. Signed by a current or former cluster CA private key in <cluster_name>-cluster-ca.

cruise-control.key

Private key for mTLS communication between the Cruise Control and Kafka or ZooKeeper.

Expand
表 17.9. Fields in the <cluster_name>-kafka-exporter-certs secret
FieldDescription

kafka-exporter.p12

PKCS #12 store for storing certificates and keys.

kafka-exporter.password

Password for protecting the PKCS #12 store.

kafka-exporter.crt

Certificate for mTLS communication between Kafka Exporter and Kafka or ZooKeeper. Signed by a current or former cluster CA private key in <cluster_name>-cluster-ca.

kafka-exporter.key

Private key for mTLS communication between the Kafka Exporter and Kafka or ZooKeeper.

17.2.4. Clients CA secrets

Clients CA secrets are managed by the Cluster Operator in a Kafka cluster.

The certificates in <cluster_name>-clients-ca-cert are those which the Kafka brokers trust.

The <cluster_name>-clients-ca secret is used to sign the certificates of client applications. This secret must be accessible to the Streams for Apache Kafka components and for administrative access if you are intending to issue application certificates without using the User Operator. You can enforce this using OpenShift role-based access controls, if necessary.

Expand
表 17.10. Fields in the <cluster_name>-clients-ca secret
FieldDescription

ca.key

The current private key for the clients CA.

Expand
表 17.11. Fields in the <cluster_name>-clients-ca-cert secret
FieldDescription

ca.p12

PKCS #12 store for storing certificates and keys.

ca.password

Password for protecting the PKCS #12 store.

ca.crt

The current certificate for the clients CA.

17.2.5. User secrets generated by the User Operator

User secrets are managed by the User Operator.

When a user is created using the User Operator, a secret is generated using the name of the user.

Expand
表 17.12. Fields in the user_name secret
Secret nameField within secretDescription

<user_name>

user.p12

PKCS #12 store for storing certificates and keys.

user.password

Password for protecting the PKCS #12 store.

user.crt

Certificate for the user, signed by the clients CA

user.key

Private key for the user

17.2.6. Adding labels and annotations to cluster CA secrets

By configuring the clusterCaCert template property in the Kafka custom resource, you can add custom labels and annotations to the Cluster CA secrets created by the Cluster Operator. Labels and annotations are useful for identifying objects and adding contextual information. You configure template properties in Streams for Apache Kafka custom resources.

Example template customization to add labels and annotations to secrets

apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
metadata:
  name: my-cluster
spec:
  kafka:
    # ...
    template:
      clusterCaCert:
        metadata:
          labels:
            label1: value1
            label2: value2
          annotations:
            annotation1: value1
            annotation2: value2
    # ...

17.2.7. Disabling ownerReference in the CA secrets

By default, the cluster and clients CA secrets are created with an ownerReference property that is set to the Kafka custom resource. This means that, when the Kafka custom resource is deleted, the CA secrets are also deleted (garbage collected) by OpenShift.

If you want to reuse the CA for a new cluster, you can disable the ownerReference by setting the generateSecretOwnerReference property for the cluster and clients CA secrets to false in the Kafka configuration. When the ownerReference is disabled, CA secrets are not deleted by OpenShift when the corresponding Kafka custom resource is deleted.

Example Kafka configuration with disabled ownerReference for cluster and clients CAs

apiVersion: kafka.strimzi.io/v1beta2
kind: Kafka
# ...
spec:
# ...
  clusterCa:
    generateSecretOwnerReference: false
  clientsCa:
    generateSecretOwnerReference: false
# ...

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部