This project shows how you can tail all the PODs logs you want leveraging the API offered by fabric8io/kubernetes-client;
Basically it showcases you can do in Java the same thin stern achieves using GO;
To see it in action, download minikube and run:
minikube start
mvn testThis command starts test PodLogsTestCase and this is what happens:
- the test has the custom annotation
@PodLog - the custom annotation
@PodLoghas the JUnit 5 annotation@ExtendWith(PodLogExtension.class): this annotation tells JUnit to register thePodLogExtensioncustom extension - the
PodLogExtensioncustom extension startswatchLogfor every newly running POD
Loggable#watchLog is an API offered by fabric8io/kubernetes-client which tails a POD's log and redirects it to an OutputStream;