Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HostTailes / fileTailers: ability to mount additional hostPaths more easily #1462

Open
PlayMTL opened this issue Sep 6, 2023 · 5 comments
Open
Labels

Comments

@PlayMTL
Copy link

PlayMTL commented Sep 6, 2023

Is your feature request related to a problem? Please describe.

The Rancher Kubernetes Engine (RKE) creates a directory "/var/lib/rancher/rke/log" from which log files under "/var/lib/docker/containers" are then pointed to via symlink. The Problem is, that the path /var/lib/docker/containers is not mounted, because the defined path in the fileTailers of the HostTailers is "/var/lib/rancher/rke/log". So the target file cannot be found in the fluentbit container because the host path has not been mounted.

Describe the solution you'd like
It would be cool if you could simply define additional "mount paths" in the fileTailers without configuring additional volume mounts.

Describe alternatives you've considered
My current workaround looks like this:

apiVersion: logging-extensions.banzaicloud.io/v1alpha1
kind: HostTailer
metadata:
  name: rke-logs
spec:
  fileTailers:
    - containerOverrides:
        volumeMounts:
          - mountPath: /var/lib/docker/containers
            name: host-docker-path
            readOnly: true
          - mountPath: /var/pos
            name: positions
          - mountPath: /var/lib/rancher/rke/log
            name: var-lib-rancher-rke-log
      name: kublet
      path: /var/lib/rancher/rke/log/kubelet_*.log
  workloadOverrides:
    volumes:
      - hostPath:
          path: /var/lib/docker/containers
          type: Directory
        name: host-docker-path
      - hostPath:
          path: /var/pos
          type: ''
        name: positions
      - hostPath:
          path: /var/lib/rancher/rke/log
          type: ''
        name: var-lib-rancher-rke-log

Additional context

Is a little bit related to: #984

@pepov pepov added enhancement New feature or request rke pinned labels Sep 7, 2023
@pepov pepov added this to the 4.x milestone Sep 7, 2023
@pepov pepov added the tailer label Sep 7, 2023
@OverOrion
Copy link
Contributor

Hey @PlayMTL, thanks for opening this issue!

Could you please share some more details?

  • Your Logging operator version?
  • Can you upgrade to a recent one (4.4 is the latest)?

You mentioned that it is a symlinked directory. Would it be possible to mount the original folder instead?
We have also checked it and it seems that on rke2 that path is no longer a symlink, so mounting it should work on rke2.

@PlayMTL
Copy link
Author

PlayMTL commented Oct 3, 2023

Hey @OverOrion,

thanks for your reply.

  • Your Logging operator version? I think i tested it on 4.3.0 or 4.2.2
  • Can you upgrade to a recent one (4.4 is the latest)? I will do this, but need some time therefor ;)

You mentioned that it is a symlinked directory. Would it be possible to mount the original folder instead?
I think this will not work, because RKE maps an Logfile from an "unkown" container (for example kubelet) to this file. I have no chance to determine which log file from the docker directory i need to mount.

$ ll /var/lib/rancher/rke/log
kubelet_XXXXXXX.log -> /var/lib/docker/containers/XXXXXXX/XXXXXXX-json.log

We have also checked it and it seems that on rke2 that path is no longer a symlink, so mounting it should work on rke2.
--> That should be right. I think its a specific rke(1) case.

@pepov
Copy link
Member

pepov commented Oct 4, 2023

is RKE1 something that will stick, or do you expect to upgrade from it one day?

anyone else having the same issue? just would like to understand how much benefit we would have if we fix this on the long run...

@aslafy-z
Copy link
Collaborator

aslafy-z commented Oct 4, 2023

I have the same issue with some production clusters. There is no upgrade path given by the vendor and no plans for EOL it from now on.

@pepov pepov modified the milestones: 4.x, 4.4.1 Oct 5, 2023
@pepov
Copy link
Member

pepov commented Oct 5, 2023

@PlayMTL you can also reach out over our project discord in case you want to have a chat: https://discord.gg/sXFdDKEKK8

@OverOrion OverOrion removed this from the 4.4.1 milestone Oct 9, 2023
@OverOrion OverOrion removed their assignment Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants