Using the Kafka Connect REST API
Kafka Connect offers a REST API that you can use to manage and monitor connectors. Learn about the REST API, available endpoints, and recommended use. Additionally learn about connect_shell.sh, which is a command line tool that you can use to establish quick access to the REST API.
The Kafka Connect REST API is available as a ClusterIP type
Kubernetes service. The service is named [****CONNECT CLUSTER
NAME***]-connect-api
. Its default port is 8083.
[****CONNECT CLUSTER NAME***] is the name of your Kafka Connect cluster. The
name is specified in the metadata.name
property of the
KafkaConnect resource used to deploy the cluster. The service is created when
you deploy the cluster.
The REST API offers various endpoints and operations that you can use to manage (create, update, delete) as well as to monitor the connectors running in your Kafka Connect cluster. You can find a comprehensive reference in the Kafka Connect Rest API reference.
API access and security
By default the Kafka Connect API is only accessible from within the Kubernetes Cluster. Additionally, the default network policies only allow access by the Strimzi Cluster Operator and Kafka Connect pods. This is done because the REST API is insecure by default and it cannot be secured. As a result Cloudera recommends the following:
- Do not expose the REST API to applications running outside the Kubernetes cluster.
- Use KafkaConnector resources to manage connectors instead of the REST API.
Recommended use
Cloudera recommends that you use the API selectively for specific use-cases. In general for
any connector management operations, use KafkaConnector resources. However,
you can use any endpoints or operations that return information about the cluster and connectors
For example, you can use the GET /connector-plugins endpoint with
connectorsOnly
set to false
to list all plugins that are installed in the Kafka
Connect cluster.
If you want to query the REST API, Cloudera recommends that you use the
connect_shell.sh
tool.
Using connect_shell.sh
Use connect_shell.sh to set up a pod that allows easy access to the Kafka Connect REST API. The pod created with this tool includes preset configurations, such as the $CONNECT_REST_URL environment variable, which is set to the base URL of the API.
- Ensure that you have access to your Cloudera credentials (username and password).
- Ensure that the environment where you run the tool has the following:
- Bash 4 or higher.
- GNU utilities:
echo
grep
sed
head
kubectl
oroc
kubeconfig
configured to target Kubernetes cluster