概要
Confluent for Kubernetes (CFK)は、プライベートクラウド環境(今回は Azure Kubernetes Service(AKS))に Confluent をデプロイして管理するためのクラウドネイティブのコントロールプレーンです。宣言型 API で Confluent Platform をカスタマイズ、デプロイ、管理するための標準的で簡素なインターフェイスが備わっています。
Kubernetes における Confluent for Kubernetes および Confluent Platform のアーキテクチャの概要は下図となります。ここから の抜粋となります。
CFK を使用して Confluent Platform を構成、デプロイ するために必要な準備のワークフローのは以下となります。
- Kubernetes 環境を準備します(事前準備で完了)
- Confluent for Kubernetes をデプロイします
- Confluent kubectl プラグインをローカル環境にインストールします
ローカル環境
- macOS Monterey 12.3.1
- python 3.8.12
- Azure CLI 2.34.1
- helm v3.6.3
- kubectl v1.21.3
事前準備
- この記事 を実行して、AKSクラスタ環境が構築されていること
AKS クラスターの準備
## AKSクラスタ接続のためのための認証情報の取得
$ az aks get-credentials --resource-group rg_ituru_aks01 --name aks_ituru_cp01
## CFK の namespace の作成
$ kubectl create namespace akscfk231
## その namespace をデフォルトとしての指定
$ kubectl config set-context --current --namespace akscfk231
Confluent for Kubernetes のインストール
## Confluent for Kubernetes Helm リポジトリを追加します
$ helm repo add confluentk8s https://packages.confluent.io/helm
$ helm repo update
## Helm リポジトリの確認
$ helm search repo confluentk8s
NAME CHART VERSION APP VERSION DESCRIPTION
confluentk8s/confluent-for-kubernetes 0.435.23 2.3.1 A Helm chart to deploy Confluent for Kubernetes
## Confluent for Kubernetes をインストールします
$ helm upgrade --install confluent-operator confluentk8s/confluent-for-kubernetes
Release "confluent-operator" does not exist. Installing it now.
NAME: confluent-operator
LAST DEPLOYED: Mon Jun 20 11:28:55 2022
NAMESPACE: confluent
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The Confluent Operator
The Confluent Operator brings the component (Confluent Services) specific controllers for kubernetes by providing components specific Custom Resource
Definition (CRD) as well as managing other Confluent Platform services
## Pod の確認
$ kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
confluent-operator-64c5c5756d-wcn79 1/1 Running 0 10s 10.0.1.22 aks-cpdemo01-26130544-vmss000000 <none> <none>
Confluent kubectl プラグインをローカル環境にインストール
## Download the CFK bundle using the following command, and unpack the downloaded bundle:
$ curl -O https://confluent-for-kubernetes.s3-us-west-1.amazonaws.com/confluent-for-kubernetes-2.0.1.tar.gz
$ tar zxf confluent-for-kubernetes-2.0.1.tar.gz
## kubectl プラグインを、クライアント環境のローカルの実行ディレクトリに展開します
$ cd confluent-for-kubernetes-2.0.1-20210609
$ tar -xvf kubectl-plugin/kubectl-confluent-darwin-amd64.tar.gz -C /usr/local/bin/
## プラグインのバージョン確認
$ kubectl confluent --version
confluent version v0.174.12-1-g4deb5bc
後処理
Pod / namespace のアンインストール方法
## Pod : confluent-operator
$ helm delete confluent-operator
## 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 概要
Confluent for Kubernetes クイックスタート