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

Kubelet pod names break log directory path #80042

Open
rphillips opened this issue Jul 11, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@rphillips
Copy link
Member

commented Jul 11, 2019

What happened:
Kubelet log directories are joined with a flat NAMESPACE_PODNAME_UID directory path. The limit on pod names are 253 characters #78188 (comment).

https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kuberuntime/helpers.go#L180-L183

func BuildPodLogsDirectory(podNamespace, podName string, podUID types.UID) string {
	return filepath.Join(podLogsRootDirectory, strings.Join([]string{podNamespace, podName,
		string(podUID)}, logPathDelimiter))
}

Joining a long pod name with the namespace and UID will be over 255 characters causing the directory creation and file open to fail. Most modern filesystems have a limit of 255 characters for file directory names and filenames.

The pod with a long pod name will silently fail to log.

ref: #74441
ref: https://bugzilla.redhat.com/show_bug.cgi?id=1711544

What you expected to happen:
Long pod names should not impact the ability to log.

How to reproduce it (as minimally and precisely as possible):
Test Case

Anything else we need to know?:

Environment:
Kubernetes 1.14.0 and later

@rphillips

This comment has been minimized.

Copy link
Member Author

commented Jul 11, 2019

@k8s-ci-robot k8s-ci-robot added sig/node and removed needs-sig labels Jul 11, 2019

@smarterclayton

This comment has been minimized.

Copy link
Contributor

commented Jul 11, 2019

Hrm, I thought we had an auto "hashify" the extended part of the string when it exceeded length, but maybe I'm wrong. That might have been the very, very, very, very old implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.