How to extract journalctl logs using kubernetes apis


I have a kubernetes clutser (via minikube) where I have few container running and my logging driver is journald . So, whenever I need to check logs I am login into my minikube using minikube ssh and getting logs using command sudo journalctl -u docker.service CONTAINER_ID=

Now, I have to write a script in python which will execute the command in the cluster and write all the journalctl logs of particular container to a file.

I came across a kubernetes library which returns the logs of a pod when the logging driver is set to json-file .

Is there any way or any other library which helps in achieving the same.