kubectl-trace
kubectl-trace copied to clipboard
FindPidByPodContainer unreliable
https://github.com/iovisor/kubectl-trace/blob/7fd30079cf6e00218d78500eb41786847df37fe4/pkg/procfs/procfs.go#L59
This code makes too many assumptions about what the file paths will look like.
Actual mount results on my cluster look like /kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod30cea2cf_1b80_4807_abad_d81453e199c5.slice/crio-a8077b08a56c0c6e33d6716557d882ac940cb09475c50372e22e84c40d0733f2.scope
Additionally, the following agruments get passed to the job container
--pod-uid=30cea2cf-1b80-4807-abad-d81453e199c5 --container-id=cri-o://a8077b08a56c0c6e33d6716557d882ac940cb09475c50372e22e84c40d0733f2
We need to also trim the cri-o://
prefix. The pod UID seems to replace -
with _
so that is another issue.
This project works for me: https://github.com/yahoo/kubectl-flame/blob/master/agent/utils/process.go#L35
Hi there, we've never tested with cri-o before so thanks for flagging this. Thanks also for linking some more generic code.