Author : MD TAREQ HASSAN | Updated : 2021/04/24
What is Strimzi Operators?
- See: Understanding Operator in Kubernetes
- Strimzi is an open source project that provides container images and operators for running Kafka on Kubernetes
- Strimzi simplifies the process of running Kafka in a Kubernetes cluster
- Operators are a method of packaging, deploying, and managing a Kubernetes application. Strimzi Operators extend Kubernetes functionality, automating common and complex tasks related to a Kafka deployment
- Strimzi supports Kafka using Operators (it’s plural, not singular) to deploy and manage the components and dependencies of Kafka to Kubernetes
- Strimzi is a collection of operators (different operator does diffent things). Strimzi Operators:
- Cluster Operator: Deploys and manages Apache Kafka clusters, Kafka Connect, Kafka MirrorMaker, Kafka Bridge, Kafka Exporter, and the Entity Operator
- Entity Operator: Comprises the Topic Operator and User Operator
- Topic Operator: Manages Kafka topics
- User Operator: Manages Kafka users
Strimzi Deployment of Kafka
- Kafka components: https://strimzi.io/docs/operators/latest/overview.html#kafka-components_str
- Strimzi Operators: https://strimzi.io/docs/operators/latest/overview.html#overview-components_str
Installing Helm
Azure cloudshell already have kubectl
and helm
installed
Check versions
az aks get-credentials --resource-group xyz-rg --name xyz-aks-cluster
kubectl version
kubectl version --short
helm version
helm version --short
Installing Strimzi Operators Using Helm
- Azure Cloudshell will be used to install Strimzi Operators in AKS cluster
- Make sure that you already provisioned AKS cluster
- In case you deleted namespace without uninstalling chart and facing problem while trying to re-install
- CRDs from previous installation remained that causing problem
- See: Helm Error rendered manifests contain a resource that already exists**
Open cloudshell and initialize to execute commands
az aks get-credentials --resource-group xyz-rg --name xyz-aks-cluster
Add and update repo
# add and update repo
helm repo add strimzi https://strimzi.io/charts/
helm repo update
Check versions
helm search repo strimzi --versions
Check current namespace
kubectl config view --minify | grep namespace # nothing returned -> means default namespace
Create namespace if needed
kubectl create ns xyz
# Or -> kubectl create namespace xyz
Switch to target namespace
kubectl config set-context --current --namespace xyz
# check switched to correct namespace
kubectl config view --minify | grep namespace
Install Command
- Mention target namespace: ‘
--namespace xyz-namespace
’ -g
(or--generate-name
): you do not specify release name, helm will generate release name- To target a specific version (i.e. version 0.22.1): ‘
--version 0.22.1
’ - First parameter after
helm install
is release name i.e. ‘helm install strimzi-kafka-release strimzi/strimzi-kafka-operator ...
’
# Again: Switch to target namespace if needed
kubectl config set-context --current --namespace xyz
#
# Release name "strimzi-kafka-release"
# helm install <release-name> <chart-name>
# helm install -generate-name <chart-name>
# helm install -g <chart-name>
#
helm install strimzi-kafka-release strimzi/strimzi-kafka-operator
# Let helm to generate release name
helm install -g strimzi/strimzi-kafka-operator
# Install in target namespace
helm install -g strimzi/strimzi-kafka-operator --namespace xyz
# Install target version
helm install -g strimzi/strimzi-kafka-operator --version 0.22.1
Checking Strimzi Installation
# Set target context (don't forget to change namespace if you have multiple namespaces)
kubectl config set-context --current --namespace xyz
# current context set in above command
helm list # check release
kubectl get deployments
kubectl get pods
# Check CRDs (Custom Resource Definition)
kubectl get crd
kubectl get crd | grep strimzi
More checking
kubectl get pod -n kafka --watch
# will show huge info -> 'Ctrl + C' to exit
kubectl logs deployment/strimzi-cluster-operator -n kafka -f
Deleting Strimzi Operators
In case you want to delete Strimzi and start again
- Find the target release name: ‘
helm list
’ or ‘helm list --namespace xyz
’ - Use helm command to delete: ‘
helm delete strimzi-release-name
’ or ‘helm delete strimzi-release-name --namespace xyz
’ - Do not delete Helm release with kubectl command, it will cause problem. Use helm command to delete Helm release.
Helm commands
# Check current namespace before executing command
kubectl config view --minify | grep namespace
kubectl config set-context --current --namespace xyz
# get release name
helm list
helm delete strimzi-release-name # current context is set in above command
# if -g (--generate-name) was used during installation, delete command example:
helm delete strimzi-kafka-operator-1619204
Check deleted successfully
helm list
kubectl get pods # check namespace is set
Now, check CRDs
kubectl get crd
If CRDs were not deleted, then need to delete CRDs manually. See: Solution of Helm Error rendered manifests contain a resource that already exists
Installing Strimzi Operators Using kubectl
In case you don’t have Helm (for some reason), use kubectl
commands
kubectl create namespace kafka
kubectl create -f 'https://strimzi.io/install/latest?namespace=kafka' -n kafka
Links
- https://strimzi.io/quickstarts/
- https://strimzi.io/docs/operators/in-development/full/deploying.html