Manage Connectors using Confluent for Kubernetes Blueprints

Confluent for Kubernetes (CFK) Blueprints supports declaratively creating and managing connectors as Connector custom resources (CRs).

As connectors are managed by Kafka Connect, you need to configure the Connect cluster and install connector plugins as described in Configure Kafka Connect before you create connector CRs.

Create a connector

Each Connector CR is mapped to a connector in the Connect worker.

Adding connectors to an existing Connect cluster does not require the Connect cluster to be restarted.

  1. Create a connector with a new Connector CR:

    apiVersion: apps.cpc.platform.confluent.io/v1beta1
    kind: Connector
    spec:
      name:                       --- [1]
      connectorConfigs:           --- [2]
        taskMax:                  --- [3]
        class:                    --- [4]
        configs:                  --- [5]
      action:
        type:                     --- [6]
        restartTask:
          taskID:                 --- [7]
      actionPolicy:
        restart:
          type:                   --- [8]
          maxRetry:               --- [9]
      connectClusterRef:
        name:                     --- [10]
        namespace:                --- [11]
      certificateStoreConfigs:
        name:                     --- [12]
        namespace:                --- [13]
      credentialStoreConfigs:
        name:                     --- [14]
        namespace:                --- [15]
    
    • [1] Typically, this is the same as metadata.name. If you need a name that Kubernetes cannot support, specify that name here.

    • [2] Required. Specify the configurations for the connector.

    • [3] Required. The maximum number of tasks for the connector.

      When you set this, consider resource consumption. You may need to test in a development environment, first, if setting this to a large number.

    • [4] Required. The class name of the connector.

    • [5] Connector-specific configuration settings as key-value maps. Consult the connector documentation for the required settings.

    • [6] Required. The action type for the connector. The valid values are Pause, Resume, Restart, and RestartTask.

    • [7] Required. Specify the ID of the task to be restarted.

    • [8] Required. The policy to restart failed tasks of the connector. Set to OnFailure or Never. The default value is OnFailure, which means it will automatically restart the task when a task failed if maxRetry is not reached.

    • [9] The maximum number of restarts when restartPolicy type is OnFailure. The default value is 10.

    • [10] Required. The name of the Connect cluster.

    • [11] The namespace where the Connect cluster is deployed. If omitted, the same namespace as this connector is assumed.

    • [12] Required. The name of the CertificateStoreConfig CR that contains the certificate secrets used by this connector.

    • [13] The namespace of the CertificateStoreConfig CR that contains the certificate secrets used by this connector.

    • [14] The name of the CredentialStoreConfig CR that contains the credential secrets used by this connector.

    • [15] The name of the CredentialStoreConfig CR that contains the credential secrets used by this connector.

Update a connector

To update a connector:

  1. Edit the Connector CR configuration.

    If you change metadata.name, a new connector will be created.

  2. Apply the changes using the kubectl apply command.

Delete a connector

To delete a connector, using the connector CR:

kubectl delete -f <Connector CR yaml file>

To delete a connector, using the connector name:

kubectl delete connector <Connector name>

View the state of a connector

To see the current status of a connector:

kubectl describe connector.apps <Connector CR>

You can run the following command to get the up-to-date list of the status fields:

kubectl explain connector.status