From f47df2f9d89cc3bc11475c131d1e82cfeb5ca138 Mon Sep 17 00:00:00 2001
From: Miguel Caballer <micafer1@upv.es>
Date: Thu, 23 May 2024 09:21:57 +0200
Subject: [PATCH] Fix error in k8s conn

---
 IM/connectors/Kubernetes.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/IM/connectors/Kubernetes.py b/IM/connectors/Kubernetes.py
index 31805f52..296e6133 100644
--- a/IM/connectors/Kubernetes.py
+++ b/IM/connectors/Kubernetes.py
@@ -20,6 +20,7 @@
 import time
 import os
 import re
+import socket
 from netaddr import IPNetwork, IPAddress
 try:
     from urlparse import urlparse
@@ -650,7 +651,7 @@ def setIPs(self, vm, pod_info):
             host_ip = str(pod_info["status"]["hostIP"])
             is_private = any([IPAddress(host_ip) in IPNetwork(mask) for mask in Config.PRIVATE_NET_MASKS])
             if is_private:
-                public_ips = [self.cloud.server]
+                public_ips = [socket.gethostbyname(self.cloud.server)]
             else:
                 public_ips = [host_ip]
         if 'podIP' in pod_info["status"]: