yahoo / kubectl-flame

Kubectl plugin for effortless profiling on kubernetes
Apache License 2.0
796 stars 96 forks source link

path issues causing kubeclt-flame to fail - container error - patched image can't locate fsroot #78

Open swcustodian opened 2 years ago

swcustodian commented 2 years ago

We have been attempting to try our your kubectl flame plugin.

We immediately ran into the problem described in https://github.com/yahoo/kubectl-flame/pull/77/commits because our k8s clusters are using containerd not docker.

After doing some digging, we found out how to apply the above mentioned patch and build (hoefully) using your compile options and were able to build the cli. Here is our best guess as to you build options

$ FLAME_SEMVER=0.2.5 $ BUILD_DATE=2022-08-15 $ CGO_ENABLED=0 go build -ldflags="-X github.com/VerizonMedia/kubectl-flame/cli/cmd/version.semver=${FLAME_SEMVER} -X github.com/VerizonMedia/kubectl-flame/cli/cmd/version.date=${BUILD_DATE} -X github.com/VerizonMedia/kubectl-flame/cli/cmd/version.commit=OUR-BUILD" -o kubectl-flame ./cli

However then we ran into the next problem. Now we run into the problem that the image pull does not work because it is not found.

After building a docker image from our patched code, we spoke with of internal IT we found the naming tricks/tags to get this docker image published to our internal registry where all our k8s deployments pull images from. So now we have the agent built and published and the image pull now works.

But now we have errors with the file system paths. {"type":"progress","data":{"time":"2022-08-16T20:40:11.087607299Z","stage":"started"}} {"type":"error","data":{"reason":"open /var/lib/docker/io.containerd.runtime.v2.task/k8s.io/47838c0fdf292987d5e03dbf8291286f842e6688a993c14bbb02d354c97b2aaa/rootfs: no such file or directory "}} [scwald@spaserver2609 71]> kubectl -n onebismp logs kubectl-flame-f7db470c-014c-4b1a-91ed-7a6550106d50--1-5qqgg {"type":"progress","data":{"time":"2022-08-16T20:40:09.602407356Z","stage":"started"}} {"type":"error","data":{"reason":"open /var/lib/docker/io.containerd.runtime.v2.task/k8s.io/47838c0fdf292987d5e03dbf8291286f842e6688a993c14bbb02d354c97b2aaa/rootfs: no such file or directory "}}

The paths above were created from the patch pull/77 item above. I have exec-ed into my containers to look for the available mount points from containerd, but within our deployments there doesn’t appear to be any mount points specific to docker or containerd. The only generally available folders in my containers is / and /opt. I tried hardcoding the above directory names to /opt, but while that might make the directory found. If there is some assumed content, nothing is there. So I would like to know what is the purpose behind these directories and is the some content that is expected at either location?

No the agent just exits with very little logging information to help with debugging. {"type":"progress","data":{"time":"2022-08-17T10:36:08.827199035Z","stage":"started"}} {"type":"error","data":{"reason":"exit status 1"}}

Do you have plans to add support for containerd in the near future and do you have any suggestions for us to try in the meantime?

benbaker76 commented 2 years ago

You can just set FLAME_SEMVER=v0.2.4 and let it pull from verizondigital/kubectl-flame:v0.2.4-....

When you run kubectl flame make sure you pass in the location of containerd ie. --docker-path /run/containerd