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

client: Is there a way to obtain container logs using client? #611

Closed
nimrodshn opened this issue Sep 24, 2019 · 1 comment
Closed

client: Is there a way to obtain container logs using client? #611

nimrodshn opened this issue Sep 24, 2019 · 1 comment

Comments

@nimrodshn
Copy link

Using the kubernetes/client-go one can use the PodExpansion interface to obtain the logs inside a pod:

// The PodExpansion interface allows manually adding extra methods to the PodInterface.
type PodExpansion interface {
	Bind(binding *v1.Binding) error
	Evict(eviction *policy.Eviction) error
	GetLogs(name string, opts *v1.PodLogOptions) *restclient.Request
}

A code to get the logs would look like:

options := &corev1.PodLogOptions{
	Container: logID,
}
request := pods.GetLogs(pod.Name, options)
buff, err := request.DoRaw()
if err != nil {
	// Handle error.
}

Is there a way to do the same with the controller-runtime client?

@nimrodshn
Copy link
Author

Just found this issue #452.
Closing as this is a dup.

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

No branches or pull requests

1 participant