Skip to content

KafkaTopic

Usage example

Example
apiVersion: aiven.io/v1alpha1
kind: KafkaTopic
metadata:
  name: kafka-topic
spec:
  authSecretRef:
    name: aiven-token
    key: token

  project: my-aiven-project
  serviceName: my-kafka
  topicName: my-kafka-topic

  replication: 2
  partitions: 1

  config:
    min_cleanable_dirty_ratio: 0.2

Info

To create this resource, a Secret containing Aiven token must be created first.

Apply the resource with:

kubectl apply -f example.yaml

Verify the newly created KafkaTopic:

kubectl get kafkatopics kafka-topic

The output is similar to the following:

Name           Service Name    Project             Partitions    Replication    
kafka-topic    my-kafka        my-aiven-project    1             2              

KafkaTopic

KafkaTopic is the Schema for the kafkatopics API.

Required

  • apiVersion (string). Value aiven.io/v1alpha1.
  • kind (string). Value KafkaTopic.
  • metadata (object). Data that identifies the object, including a name string and optional namespace.
  • spec (object). KafkaTopicSpec defines the desired state of KafkaTopic. See below for nested schema.

spec

Appears on KafkaTopic.

KafkaTopicSpec defines the desired state of KafkaTopic.

Required

  • partitions (integer, Minimum: 1, Maximum: 1000000). Number of partitions to create in the topic.
  • project (string, Immutable, Pattern: ^[a-zA-Z0-9_-]+$, MaxLength: 63). Identifies the project this resource belongs to.
  • replication (integer, Minimum: 2). Replication factor for the topic.
  • serviceName (string, Immutable, Pattern: ^[a-z][-a-z0-9]+$, MaxLength: 63). Specifies the name of the service that this resource belongs to.

Optional

  • authSecretRef (object). Authentication reference to Aiven token in a secret. See below for nested schema.
  • config (object). Kafka topic configuration. See below for nested schema.
  • tags (array of objects). Kafka topic tags. See below for nested schema.
  • termination_protection (boolean). It is a Kubernetes side deletion protections, which prevents the kafka topic from being deleted by Kubernetes. It is recommended to enable this for any production databases containing critical data.
  • topicName (string, Immutable, MinLength: 1, MaxLength: 249). Topic name. If provided, is used instead of metadata.name. This field supports additional characters, has a longer length, and will replace metadata.name in future releases.

authSecretRef

Appears on spec.

Authentication reference to Aiven token in a secret.

Required

  • key (string, MinLength: 1).
  • name (string, MinLength: 1).

config

Appears on spec.

Kafka topic configuration.

Optional

tags

Appears on spec.

Kafka topic tags.

Required

  • key (string, Pattern: ^[a-zA-Z0-9_-]+$, MinLength: 1, MaxLength: 64).

Optional

  • value (string, Pattern: ^[a-zA-Z0-9_-]+$, MaxLength: 256).