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

Log collection of container file system #208

Closed
ethfoo opened this issue May 24, 2022 · 3 comments · Fixed by #209
Closed

Log collection of container file system #208

ethfoo opened this issue May 24, 2022 · 3 comments · Fixed by #209
Assignees
Labels
enhancement New feature or request

Comments

@ethfoo
Copy link
Collaborator

ethfoo commented May 24, 2022

Describe the feature

Collect the log files in container even if the pod is not mounting any volumes. So Loggie need to find the path in the node via the log files in the container.

enable

Enable this feature by just set rootFsCollectionEnabled to true, see below:

  discovery:
    enabled: true
    kubernetes:
      # can be "" or "docker" or "containerd"
      containerRuntime: "docker" 
      rootFsCollectionEnabled: true
  • When setting the containerRuntime field to null, Loggie will get the container runtime by cri.version dynamically which is like crictl version.
    But we still recommend setting it to a specific value, such as docker or containerd base on your kubernetes cluster.

docker runtime

When setting thecontainerRuntime field to docker, add volumeMount/volume of Loggie daemonset for docker sock.

        volumeMounts:
        - mountPath: /var/run/docker.sock
          name: dockersocket
      - hostPath:
          path: /var/run/docker.sock
          type: ""
        name: dockersocket

In addition,make sure the there is mountPropagation: HostToContainer in docker volumeMount:

            - mountPath: /var/lib/docker
              mountPropagation: HostToContainer
              name: docker

containerd runtime

When setting thecontainerRuntime field to containerd, add volumeMount/volume of Loggie daemonset for containerd sock.

        volumeMounts:
        - mountPath: /run/containerd/containerd.sock
          name: containerdsocket
      volumes:
      - hostPath:
          path: /run/containerd/containerd.sock
          type: ""
        name: containerdsocket

Usually the socket path is /run/containerd/containerd.sock, which you can also find by checking the kubelet --container-runtime-endpoint args.
Don't forget to add hostPID: true in template.spec of Loggie daemonset, otherwise Loggie won't be able to read the /proc/<pid>/root in the node.

spec:
  selector:
    matchLabels:
      app: loggie
  template:
    metadata:
      labels:
        app: loggie
    spec:
      ...
      hostPID: true
      ...
@ethfoo
Copy link
Collaborator Author

ethfoo commented Jul 5, 2023

containerd运行时需加上:

    securityContext:
      privileged: true

@SihengCui
Copy link

containerd运行时需加上:

    securityContext:
      privileged: true

helm upgrade之后也没发现这个选项,1.5.0的helm chart会加入么?

@ethfoo
Copy link
Collaborator Author

ethfoo commented Jul 26, 2023

helm upgrade之后也没发现这个选项,1.5.0的helm chart会加入么?

之前估计漏了,后面版本会加一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants