概要
Confluent for Kubernetes (CFK)は、プライベートクラウド環境(今回は Azure Kubernetes Service(AKS))に Confluent をデプロイして管理するためのクラウドネイティブのコントロールプレーンです。宣言型 API で Confluent Platform をカスタマイズ、デプロイ、管理するための標準的で簡素なインターフェイスが備わっています。
この記事 にあるように CFK を利用して AKS 上に Confluent Platform を構築する クイックスタート を実施してみました。
ローカル環境
- macOS Monterey 12.3.1
- python 3.8.12
- Azure CLI 2.34.1
- helm v3.6.3
- kubectl v1.21.3
事前準備
- この記事 を実行して、AKSクラスタ環境が構築されていること
- この記事 を実行して、CFKを利用して AKS 上に Confluent Platform を構成・デプロイできる準備が完了していること。ただし、namespace は confluent である必要があります
Confluent Platform のインストール
## すべての Confluent Platform コンポーネントをインストールします
$ kubectl apply -f https://raw.githubusercontent.com/confluentinc/confluent-kubernetes-examples/master/quickstart-deploy/confluent-platform.yaml
etes-examples/master/quickstart-deploy/confluent-platform.yaml
zookeeper.platform.confluent.io/zookeeper created
kafka.platform.confluent.io/kafka created
connect.platform.confluent.io/connect created
ksqldb.platform.confluent.io/ksqldb created
controlcenter.platform.confluent.io/controlcenter created
schemaregistry.platform.confluent.io/schemaregistry created
kafkarestproxy.platform.confluent.io/kafkarestproxy created
## サンプルプロデューサーアプリとトピックをインストールします
$ kubechave tl apply -f https://raw.githubusercontent.com/confluentinc/confluent-kubernetes-examples/master/quickstart-deploy/producer-app-data.yaml
secret/kafka-client-config created
statefulset.apps/elastic created
service/elastic created
kafkatopic.platform.confluent.io/elastic-0 created
インストール後の確認
## Pod の確認
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
confluent-operator-64c5c5756d-wcn79 1/1 Running 0 3h33m
connect-0 1/1 Running 2 (3h26m ago) 3h32m
controlcenter-0 1/1 Running 0 3h26m
elastic-0 1/1 Running 3 (3h29m ago) 3h31m
kafka-0 1/1 Running 0 3h29m
kafka-1 1/1 Running 0 3h29m
kafka-2 1/1 Running 0 3h29m
kafkarestproxy-0 1/1 Running 0 3h26m
ksqldb-0 1/1 Running 0 3h26m
schemaregistry-0 1/1 Running 0 3h26m
schemaregistry-1 1/1 Running 0 3h26m
schemaregistry-2 1/1 Running 0 3h26m
zookeeper-0 1/1 Running 0 3h32m
zookeeper-1 1/1 Running 0 3h32m
zookeeper-2 1/1 Running 0 3h32m
## 起動サービスの確認
$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
confluent-operator ClusterIP 10.1.0.49 <none> 7778/TCP 3h33m
connect ClusterIP None <none> 8083/TCP,7203/TCP,7777/TCP,7778/TCP 3h33m
connect-0-internal ClusterIP 10.1.0.108 <none> 8083/TCP,7203/TCP,7777/TCP,7778/TCP 3h33m
controlcenter ClusterIP None <none> 9021/TCP,7203/TCP,7777/TCP,7778/TCP 3h27m
controlcenter-0-internal ClusterIP 10.1.0.15 <none> 9021/TCP,7203/TCP,7777/TCP,7778/TCP 3h27m
elastic ClusterIP None <none> <none> 3h32m
kafka ClusterIP None <none> 9092/TCP,8090/TCP,9071/TCP,7203/TCP,7777/TCP,7778/TCP,9072/TCP 3h30m
kafka-0-internal ClusterIP 10.1.0.34 <none> 9092/TCP,8090/TCP,9071/TCP,7203/TCP,7777/TCP,7778/TCP,9072/TCP 3h30m
kafka-1-internal ClusterIP 10.1.0.172 <none> 9092/TCP,8090/TCP,9071/TCP,7203/TCP,7777/TCP,7778/TCP,9072/TCP 3h30m
kafka-2-internal ClusterIP 10.1.0.235 <none> 9092/TCP,8090/TCP,9071/TCP,7203/TCP,7777/TCP,7778/TCP,9072/TCP 3h30m
kafkarestproxy ClusterIP None <none> 8082/TCP,7203/TCP,7777/TCP,7778/TCP 3h27m
kafkarestproxy-0-internal ClusterIP 10.1.0.115 <none> 8082/TCP,7203/TCP,7777/TCP,7778/TCP 3h27m
ksqldb ClusterIP None <none> 8088/TCP,7203/TCP,7777/TCP,7778/TCP 3h27m
ksqldb-0-internal ClusterIP 10.1.0.175 <none> 8088/TCP,7203/TCP,7777/TCP,7778/TCP 3h27m
schemaregistry ClusterIP None <none> 8081/TCP,7203/TCP,7777/TCP,7778/TCP 3h27m
schemaregistry-0-internal ClusterIP 10.1.0.14 <none> 8081/TCP,7203/TCP,7777/TCP,7778/TCP 3h27m
schemaregistry-1-internal ClusterIP 10.1.0.28 <none> 8081/TCP,7203/TCP,7777/TCP,7778/TCP 3h27m
schemaregistry-2-internal ClusterIP 10.1.0.127 <none> 8081/TCP,7203/TCP,7777/TCP,7778/TCP 3h27m
zookeeper ClusterIP None <none> 2181/TCP,7203/TCP,7777/TCP,3888/TCP,2888/TCP,7778/TCP 3h33m
zookeeper-0-internal ClusterIP 10.1.0.171 <none> 2181/TCP,7203/TCP,7777/TCP,3888/TCP,2888/TCP,7778/TCP 3h33m
zookeeper-1-internal ClusterIP 10.1.0.113 <none> 2181/TCP,7203/TCP,7777/TCP,3888/TCP,2888/TCP,7778/TCP 3h33m
zookeeper-2-internal ClusterIP 10.1.0.33 <none> 2181/TCP,7203/TCP,7777/TCP,3888/TCP,2888/TCP,7778/TCP 3h33m
## Confluent Platform のバージョンを確認します
$ kubectl confluent version
COMPONENT NAME VERSION OPERATOR-VERSION
Zookeeper zookeeper 7.1.0 v0.435.23
Kafka kafka 7.1.0 v0.435.23
Connect connect 7.1.0 v0.435.23
SchemaRegistry schemaregistry 7.1.0 v0.435.23
KsqlDB ksqldb 7.1.0 v0.435.23
ControlCenter controlcenter 7.1.0 v0.435.23
Confluent Control Center を開きます
$ kubectl confluent dashboard controlcenter
http://localhost:9021
ブラウザが自動的に立ち上がり、Contorol-Center に認証なしで接続(ログイン)されます
後処理
Pod / namespace のアンインストール方法
## Pod : confluent-operator
$ helm delete confluent-operator
## Pod : confluent-platform
$ kubectl delete -f https://raw.githubusercontent.com/confluentinc/confluent-kubernetes-examples/master/quickstart-deploy/confluent-platform.yaml
## Pod : producer-app-data
$ kubectl delete -f https://raw.githubusercontent.com/confluentinc/confluent-kubernetes-examples/master/quickstart-deploy/producer-app-data.yaml
## namespace の削除方法(namespace配下のPodも全て削除される)
$ kubectl delete namespace confluent
AKSクラスターの停止・起動
$ az aks stop -g rg_ituru_aks01 -n aks_ituru_cp01
$ az aks start -g rg_ituru_aks01 -n aks_ituru_cp01
まとめ
これで CFK を利用して AKS 上に Confluent Platform を構築する クイックスタート を確認しました。
参考情報
以下の情報を参考にさせていただきました
Confluent for Kubernetes 概要
Introducing Confluent for Kubernetes
Confluent for Kubernetes クイックスタート