fix: containerd log symlink

Kubelet creates symlinks from /var/log/containers/<pod>.log to the log file /var/log/pod/<pod-folder>/0.log
Log senders (like fluentd) usually watch the folder /var/log/containers/*.log
Kubelet needs to share containers folder.

Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev>
Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
Serge Logvinov 2021-09-20 20:56:39 +00:00 committed by Andrey Smirnov
parent efa7f48e08
commit d9eb18bfdd
No known key found for this signature in database
GPG Key ID: 7B26396447AB6DFD
2 changed files with 2 additions and 1 deletions

View File

@ -732,7 +732,7 @@ func SetupSharedFilesystems(seq runtime.Sequence, data interface{}) (runtime.Tas
// SetupVarDirectory represents the SetupVarDirectory task.
func SetupVarDirectory(seq runtime.Sequence, data interface{}) (runtime.TaskExecutionFunc, string) {
return func(ctx context.Context, logger *log.Logger, r runtime.Runtime) (err error) {
for _, p := range []string{"/var/log/pods", "/var/lib/kubelet", "/var/run/lock"} {
for _, p := range []string{"/var/log/containers", "/var/log/pods", "/var/lib/kubelet", "/var/run/lock"} {
if err = os.MkdirAll(p, 0o700); err != nil {
return err
}

View File

@ -168,6 +168,7 @@ func (k *Kubelet) Runner(r runtime.Runtime) (runner.Runner, error) {
{Type: "bind", Destination: "/var/run", Source: "/run", Options: []string{"rbind", "rshared", "rw"}},
{Type: "bind", Destination: "/var/lib/containerd", Source: "/var/lib/containerd", Options: []string{"rbind", "rshared", "rw"}},
{Type: "bind", Destination: "/var/lib/kubelet", Source: "/var/lib/kubelet", Options: []string{"rbind", "rshared", "rw"}},
{Type: "bind", Destination: "/var/log/containers", Source: "/var/log/containers", Options: []string{"rbind", "rshared", "rw"}},
{Type: "bind", Destination: "/var/log/pods", Source: "/var/log/pods", Options: []string{"rbind", "rshared", "rw"}},
}