kubernetesjava-client

How to listen or watch pod ip change event history in kubernetes?


I want to save the history pod ip changes for troubleshooting in future. How can i do that ? Is there api in k8s io.fabric client i can use?


Solution

  • You can watch on endpoints and not pods itself.

    Eg.

     try (Watch watch = client.endpoints().inNamespace(namespace).watch(new Watcher<Endpoints>() {
            @Override
            public void eventReceived(Action action, Endpoints resource) {
            ....//your code
             }
         ....