Using some simple code examples, I am trying to list all the pods in my namespace and find their IPs e.g.
ApiClient client = Config.defaultClient();
Configuration.setDefaultApiClient(client);
// now you are safe to construct a CoreV1Api.
CoreV1Api api = new CoreV1Api();
V1PodList list =
api.listNamespacedPod("myNS", null, null, null, null, null, null, null, 30, false);
for (V1Pod item : list.getItems()) {
System.out.println(item.getMetadata().getName());
}
Result:
SocketTimeoutException: connect timed out
Guessing it's something to do with the config maybe. I've also tried Config.fromCluster()
but got the same result.
I should mention that this code is running in a pod in that namespace