#3120·flux2

The flux logs command does not respect FLUX_SYSTEM_NAMESPACE

Author: kingdonbCreated Sep 19, 2022Updated Sep 30, 2026

Describe the bug

When Flux is installed from the Operator Hub installation instructions, it lands in the namespace operators by default.

The flux logs command accepts --flux-namespace which works, but FLUX_SYSTEM_NAMESPACE being exported in the shell does not have the same effect.

Steps to reproduce

On a new cluster (kind is OK, I used k3s and vcluster) you can follow the 2-step directions to install OLM, and install a Flux operator "subscription" which is located in the operators namespace.

$ curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.22.0/install.sh | bash -s v0.22.0
$ kubectl create -f https://operatorhub.io/install/flux.yaml

...

$ export FLUX_SYSTEM_NAMESPACE=operators

$ flux logs
(no output)

(Note that I have done this after the "expected behavior" steps below, so I am certain there are already some logs to capture.)

Expected behavior

Calling flux logs with the flux-namespace option gets the desired results:

$ flux logs --flux-namespace operators
2022-09-19T22:27:52.830Z info Kustomization/flux-system.flux-system - Source 'GitRepository/flux-system' not found
2022-09-19T22:28:10.023Z info Kustomization/flux-system.flux-system - server-side apply completed
2022-09-19T22:28:25.033Z error Kustomization/flux-system.flux-system - unable to record event POST http://notification-controller.flux-system.svc.cluster.local./ giving up after 5 attempt(s): Post "http://notification-controller.flux-system.svc.cluster.local./": dial tcp: lookup notification-controller.flux-system.svc.cluster.local. on 10.107.253.154:53: no such host
2022-09-19T22:28:25.063Z info Kustomization/flux-system.flux-system - Reconciliation finished in 15.459341189s, next run in 5m0s
2022-09-19T22:28:09.556Z error GitRepository/flux-system.flux-system - unable to record event POST http://notification-controller.flux-system.svc.cluster.local./ giving up after 5 attempt(s): Post "http://notification-controller.flux-system.svc.cluster.local./": dial tcp: lookup notification-controller.flux-system.svc.cluster.local. on 10.107.253.154:53: no such host
2022-09-19T22:28:09.556Z info GitRepository/flux-system.flux-system - stored artifact for commit 'add kustomization.yaml'

The content of the logs above is not important, the fact that they are successfully recovered is the expected behavior.

You should get the same results by setting FLUX_SYSTEM_NAMESPACE=operators and exporting it in the shell environment but it does not.

There is no output, unless you call it with the --flux-namespace option as above.

Screenshots and recordings

No response

OS / Distro

MacOS 10.15.7

Flux version

v0.34.0

Flux check

$ flux check
► checking prerequisites
✔ Kubernetes 1.21.14+k3s1 >=1.20.6-0
► checking controllers
✔ kustomize-controller: deployment ready
► ghcr.io/fluxcd/kustomize-controller:v0.26.3
✔ helm-controller: deployment ready
► ghcr.io/fluxcd/helm-controller:v0.22.2
✔ notification-controller: deployment ready
► ghcr.io/fluxcd/notification-controller:v0.24.1
✔ image-automation-controller: deployment ready
► ghcr.io/fluxcd/image-automation-controller:v0.23.5
✔ image-reflector-controller: deployment ready
► ghcr.io/fluxcd/image-reflector-controller:v0.19.2
✔ source-controller: deployment ready
► ghcr.io/fluxcd/source-controller:v0.25.10
► checking crds
✔ imageupdateautomations.image.toolkit.fluxcd.io/v1beta1
✔ alerts.notification.toolkit.fluxcd.io/v1beta1
✔ helmrepositories.source.toolkit.fluxcd.io/v1beta2
✔ helmreleases.helm.toolkit.fluxcd.io/v2beta1
✔ receivers.notification.toolkit.fluxcd.io/v1beta1
✔ gitrepositories.source.toolkit.fluxcd.io/v1beta2
✔ providers.notification.toolkit.fluxcd.io/v1beta1
✔ buckets.source.toolkit.fluxcd.io/v1beta2
✔ imagerepositories.image.toolkit.fluxcd.io/v1beta1
✔ imagepolicies.image.toolkit.fluxcd.io/v1beta1
✔ kustomizations.kustomize.toolkit.fluxcd.io/v1beta2
✔ helmcharts.source.toolkit.fluxcd.io/v1beta2
✔ all checks passed

Git provider

N/A

Container Registry provider

N/A

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct