coreosrkt

viewing log of exited pod


I'm trying to install kubernetes on my CoreOS cluster but it's not that relevant to my question.

I'm on Container Linux by CoreOS alpha (1339.0.0) with rkt:

rkt Version: 1.25.0
appc Version: 0.8.10
Go Version: go1.7.3
Go OS/Arch: linux/amd64
Features: -TPM +SDJOURNAL

I have a specific pod that keeps exiting.

for example, rkt list --full shows me:

914c4f3f-6e3a-44c2-a111-bfc91ceb411a    kubedns         gcr.io/google_containers/kubedns-amd64:1.9              sha512-c7b7c9c4393b exited      2017-03-13 13:34:10.306 +0000 UTC   2017-03-13 13:34:11.246 +0000 UTC   

it's exited and i want see the pod's logs.

now... according to https://github.com/coreos/rkt/blob/master/Documentation/commands.md I should the machinectl Id which i can't find, so it tells me to append rkt- to the uuid string.

so I tried every combination I could think of:

# journalctl -m _MACHINE_ID=914c4f3f-6e3a-44c2-a111-bfc91ceb411a
-- No entries --
# journalctl -M rkt-914c4f3f-6e3a-44c2-a111-bfc91ceb411a
Failed to open root directory: No machine 'rkt-914c4f3f-6e3a-44c2-a111-bfc91ceb411a' known
# journalctl -u rkt-914c4f3f-6e3a-44c2-a111-bfc91ceb411a
-- No entries --

so.. what an I do to see the logs output of an exited pod? :) thanks!


Solution

  • I didn't notice that rkt-gc.timer keeps garbage collecting my old pods cause I was running out of space quickly. once I disabled and stopped rkt-gc.timer in my cloud-config, I was able to view the logs using journalctl -m _MACHINE_ID=UID_WITHOUT_-

    just removed the - from the UID output of rkt list --full.