strimzi / strimzi-kafka-operator

Apache Kafka® running on Kubernetes
https://strimzi.io/
Apache License 2.0
4.86k stars 1.3k forks source link

[Question] Failing to set Resource limits on Openshfit #2861

Closed AJCandfield closed 4 years ago

AJCandfield commented 4 years ago

My team and I deployed the strimzi-kafka-operator, a kafka-cluster and a kafka-bridge on an Openshift platform following the guides we found on the Strimzi website while using the YAML files in the "examples" folder.

When we try to edit the resource limits after deployment of either the kafka-cluster or the kafka-bridge the deployment would rollback to a previous state, therefore not applying the new configuration.

We also tried deleting the deployment and defining the Resource Limits in the deployment YAML file and that worked in setting the limits but we still couldn't edit them after.

There doesn't seem to be any log or failed health check that would hint at some malfunction.

Can anyone explain this behavior and help us understand how to edit Resource Limits?

Any help would be much appreciated,

Alex

ppatierno commented 4 years ago

Hi, so you should never edit the Kubernetes resources created by the operator because on next reconcile it will update them again based on what you have in the Strimzi custom resources (Kafka, KafkaBridge and so on). You have to define the resources section in your custom resource. See the following example in the doc:

https://strimzi.io/docs/master/#ref-sample-kafka-resource-config-deployment-configuration-kafka

As you can see under the kafka and zookeeper sections you have a resources one where you can specify what you want and it will be reflected to the related StatefulSets, Pods and so on. More info here : https://strimzi.io/docs/master/#assembly-resource-limits-and-requests-deployment-configuration-kafka.

Of course the same is valid for the bridge: https://strimzi.io/docs/master/#assembly-resource-limits-and-requests-deployment-configuration-kafka-bridge

as well as all the other components that Strimzi is able to handle (see KafkaConnect, KafkaMirrorMaker and son on).

RdL87 commented 4 years ago

Hi @ppatierno. I noticed that scaling down the strimzi-cluster-operator to 0 it does not happen. I imagine that is this compoenent that controls the desired situation? So i can modify the custom resource and if in in the future i want to modify it again i have always to modify the custom resource, right?

ppatierno commented 4 years ago

@RdL87 what's the value of using the operator pattern if you turn off the cluster operator? The operator is in charge of reconciling periodically what you describe in the custom resources (Kafka, KafkaBridge, ...) and what's the reality running on the cluster (Deployment, StatefulSet, Pod...). For this reason I said that you should never touch the K8S resources created by the operator because they are the reflection of what's needed to have your custom resource deployed. If you scale operator to 0, there is no one taking a look at your cluste. If you change a configuration in the Kafka resource, there is no one starting the rolling update for restarting the cluster with new configuration on all brokers for example. This is one of the role of the operator and in general the idea of the operator pattern. So the rule is ... change what you need on the custom resource ... never touch the auto-created ones.

RdL87 commented 4 years ago

yes ppatierno i just did a try to be sure that the operator was responsible for this :)

AJCandfield commented 4 years ago

Thanks Paolo, that worked!