fluent / fluent-operator

Operate Fluent Bit and Fluentd in the Kubernetes way - Previously known as FluentBit Operator
Apache License 2.0
588 stars 250 forks source link

bug: Installation of Fluent-Operator does not install all CRDs #1377

Open sherwoodzern opened 1 month ago

sherwoodzern commented 1 month ago

Describe the issue

Doing a helm install such as: helm install fluent-operator --create-namespace -n fluent-operator https://github.com/fluent/fluent-operator/releases/download/v3.2.0/fluent-operator.tgz

results in an error in the deployment of the operator and the fluent-bit pods. The following are the errors:

2024-10-15T21:08:13Z ERROR controller-runtime.source.EventHandler if kind is a CRD, it should be installed before calling Start {"kind": "FluentBitConfig.fluentbit.fluent.io", "error": "no matches for kind \"FluentBitConfig\" in version \"fluentbit.fluent.io/v1alpha2\""} sigs.k8s.io/controller-runtime/pkg/internal/source.(Kind[...]).Start.func1.1 /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.18.5/pkg/internal/source/kind.go:71 k8s.io/apimachinery/pkg/util/wait.loopConditionUntilContext.func1 /go/pkg/mod/k8s.io/apimachinery@v0.30.3/pkg/util/wait/loop.go:53 k8s.io/apimachinery/pkg/util/wait.loopConditionUntilContext /go/pkg/mod/k8s.io/apimachinery@v0.30.3/pkg/util/wait/loop.go:54 k8s.io/apimachinery/pkg/util/wait.PollUntilContextCancel /go/pkg/mod/k8s.io/apimachinery@v0.30.3/pkg/util/wait/poll.go:33 sigs.k8s.io/controller-runtime/pkg/internal/source.(Kind[...]).Start.func1 /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.18.5/pkg/internal/source/kind.go:64

To Reproduce

helm install -f custom-values.yaml fluent-operator --create-namespace -n fluent-operator https://github.com/fluent/fluent-operator/releases/download/v3.2.0/fluent-operator.tgz

Expected behavior

I would expect the operator to be successfully installed and the fluent-bit pods to be deployed

Your Environment

- Fluent Operator version: 3.2.0
- Container Runtime: crio
- Operating system: linux
- Kernel version: 8.x

How did you install fluent operator?

helm install -f custom-values.yaml fluent-operator --create-namespace -n fluent-operator https://github.com/fluent/fluent-operator/releases/download/v2.6.0/fluent-operator.tgz

Additional context

No response

patrick-stephens commented 1 month ago

I'm not seeing this error locally with a fresh cluster (KIND) and a helm install:

$ kind create cluster
Creating cluster "kind" ...
 ✓ Ensuring node image (kindest/node:v1.31.0) 🖼
 ✓ Preparing nodes 📦  l
 ✓ Writing configuration 📜 
 ✓ Starting control-plane 🕹️ ^[[A
 ✓ Installing CNI 🔌 
 ✓ Installing StorageClass 💾 
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

Not sure what to do next? 😅  Check out https://kind.sigs.k8s.io/docs/user/quick-start/
➜  ~ helm install fluent-operator --create-namespace -n fluent https://github.com/fluent/fluent-operator/releases/download/v3.2.0/fluent-operator.tgz
NAME: fluent-operator
LAST DEPLOYED: Wed Oct 16 11:07:44 2024
NAMESPACE: fluent
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Thank you for installing  fluent-operator
Your release is named    fluent-operator

To learn more about the release ,try:
   $ helm status  fluent-operator  -n  fluent
   $ helm get  fluent-operator  -n fluent

All pods are up, no errors I can see in the logs:

kubectl get pods -A
NAMESPACE            NAME                                         READY   STATUS    RESTARTS   AGE
fluent               fluent-bit-ftllb                             1/1     Running   0          2m28s
fluent               fluent-operator-f79c6bfd6-cd7st              1/1     Running   0          2m39s
kube-system          coredns-6f6b679f8f-5sqcv                     1/1     Running   0          2m53s
kube-system          coredns-6f6b679f8f-b22ds                     1/1     Running   0          2m53s
kube-system          etcd-kind-control-plane                      1/1     Running   0          2m59s
kube-system          kindnet-tg89d                                1/1     Running   0          2m53s
kube-system          kube-apiserver-kind-control-plane            1/1     Running   0          2m59s
kube-system          kube-controller-manager-kind-control-plane   1/1     Running   0          2m59s
kube-system          kube-proxy-g69kw                             1/1     Running   0          2m53s
kube-system          kube-scheduler-kind-control-plane            1/1     Running   0          2m59s
local-path-storage   local-path-provisioner-57c5987fd4-59tqd      1/1     Running   0          2m53s
patrick-stephens commented 1 month ago

I think you have an older installation of the operator in your cluster in which case the docs show how to replace the CRDs for it: https://github.com/fluent/fluent-operator?tab=readme-ov-file#deploy-fluent-operator-with-helm You do have something in your issue saying you installed 2.6.0 which is what makes me think this is it.

Helm by default does not touch existing CRDs - that's a design decision made by the Helm team: https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#some-caveats-and-explanations