Skip to content

Commit 064b628

Browse files
committed
Use ConnectTimeout, pick IP randomly
1 parent f1100c2 commit 064b628

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • src/dstack/_internal/core/backends/kubernetes

src/dstack/_internal/core/backends/kubernetes/compute.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import random
12
import shlex
23
import subprocess
34
import tempfile
@@ -748,7 +749,7 @@ def _check_and_configure_jump_pod_service(
748749
"Failed to acquire an IP for jump pod automatically."
749750
" Specify proxy_jump.hostname for Kubernetes backend."
750751
)
751-
jump_pod_hostname = cluster_external_ips[0]
752+
jump_pod_hostname = random.choice(cluster_external_ips)
752753
logger.info(
753754
(
754755
"Jump pod %s is running on node %s which has no external IP,"
@@ -915,6 +916,10 @@ def _run_ssh_command(
915916
"none",
916917
"-o",
917918
"StrictHostKeyChecking=no",
919+
"-o",
920+
# The same timeout as in core.services.ssh.tunnel.SSH_DEFAULT_OPTIONS,
921+
# which is used, for example, by server.services.runner.ssh.runner_ssh_tunnel()
922+
"ConnectTimeout=3",
918923
"-i",
919924
f.name,
920925
"-p",

0 commit comments

Comments
 (0)