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

Document hidden /logs API #6709

Closed
RichardoC opened this issue Jan 9, 2023 · 2 comments
Closed

Document hidden /logs API #6709

RichardoC opened this issue Jan 9, 2023 · 2 comments

Comments

@RichardoC
Copy link

Environmental Info:
K3s Version:
$ kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.4", GitCommit:"95ee5ab382d64cfe6c28967f36b53970b8374491", GitTreeState:"clean", BuildDate:"2022-08-17T18:54:23Z", GoVersion:"go1.18.5", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.4
Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.8+k3s1", GitCommit:"648004e4faeaf9e8705386342e95ec9bd211c2b8", GitTreeState:"clean", BuildDate:"2022-11-18T18:29:47Z", GoVersion:"go1.18.8", Compiler:"gc", Platform:"linux/amd64"}

Thanks,

Node(s) CPU architecture, OS, and Version:
Rancher Desktop

Version info

$ rdctl version
rdctl client version: 1.1.0, targeting server version: v0

Rancher Desktop version 1.7.0 on Ubuntu 22.04.1 x64

Cluster Configuration:
N/A

Describe the bug:
Originally reported as rancher-sandbox/docs.rancherdesktop.io#136
While experimenting with the following command, I spotted an API that's not present in upstream Kubernetes, which doesn't conform to their schema standards (it's non-json)

$ kubectl get --raw / | grep logs
"/logs",

$ kubectl get --raw /logs

acpid.log
buildkitd.log
cloud-init-output.log
containerd.log
containers/
dmesg
lima-init.log
messages
openresty/
pods/
rancher-desktop-guestagent.log
wtmp

This should be documented, and preferably be json to conform to the other APIs exposed.

Steps To Reproduce:
$ kubectl get --raw /logs

Expected behavior:
This would be documented, and return a json file rather than html

Actual behavior:
Returns an html page of files

Additional context / logs:

@brandond
Copy link
Contributor

brandond commented Jan 9, 2023

That's not something we add. I see that someone pointed you here from the RD repo, but I think they were mistaken. The few routes that K3s adds to the apiserver port are all listed at https://github.com/k3s-io/k3s/blob/master/pkg/server/router.go#L41. Except for /static, /cacerts, and /ping, they are all prefixed with /v1-k3s/.

@brandond brandond closed this as completed Jan 9, 2023
@brandond
Copy link
Contributor

brandond commented Jan 9, 2023

Copying my response from the other issue:

Yes, this is a core Kubernetes thing:
https://github.com/kubernetes/kubernetes/blob/v1.25.5/pkg/routes/logs.go#L32-L42
https://github.com/kubernetes/kubernetes/blob/v1.25.5/pkg/controlplane/instance.go#L342-L344
https://github.com/kubernetes/kubernetes/blob/v1.25.5/cmd/kube-apiserver/app/options/options.go#L113
https://github.com/kubernetes/kubernetes/blob/v1.25.5/cmd/kube-apiserver/app/options/options.go#L173-L175

Despite being listed as slated for removal it appears to still be there, and enabled by default.

You can start K3s with --kube-apiserver-arg=enable-logs-handler=false if you want to turn it off.

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

2 participants