Skip to content

SSH Non-Standard Port Configuration

When managing Static Node clusters, Neutree uses SSH to connect to nodes. By default, SSH connections use port 22. If your nodes use a non-standard SSH port, you need to configure SSH settings manually.

Since Ray (the underlying cluster management tool) does not support specifying SSH ports directly in its configuration, you need to use the SSH config file to define custom ports for each host.

Create an SSH config file that will be mounted into the Neutree container:

Terminal window
mkdir -p ./ssh-config
vim ./ssh-config/config

Add an entry for each node that uses a non-standard SSH port:

Host node1
HostName 192.168.1.100
Port 2222
User ubuntu
Host node2
HostName 192.168.1.101
Port 2222
User ubuntu

When adding nodes to your Static Node cluster in Neutree, use the Host alias (e.g., node1, node2) instead of the IP address directly.

If you have a node at 192.168.1.100 with SSH running on port 2222:

  1. Add to ./ssh-config/config:

    Host gpu-node-1
    HostName 192.168.1.100
    Port 2222
    User root
  2. Mount the config file into the container (see Persistence in Different Deployments below).

  3. In Neutree, when configuring the Static Node cluster, enter gpu-node-1 as the node address.

The SSH config file needs to be mounted into the neutree-core container.

  1. Create the SSH config file on the host:

    Terminal window
    mkdir -p ./ssh-config
    cat > ./ssh-config/config << 'EOF'
    Host gpu-node-1
    HostName 192.168.1.100
    Port 2222
    User root
    EOF
    chmod 600 ./ssh-config/config
  2. Update your docker-compose.yaml to mount the config:

    services:
    neutree-core:
    # ... other configurations
    volumes:
    - ./ssh-config:/root/.ssh:ro
  3. Restart the service:

    Terminal window
    docker compose up -d
  1. Create a ConfigMap with the SSH config:

    Terminal window
    kubectl create configmap ssh-config --from-file=config=./ssh-config -n neutree

    Or using YAML:

    apiVersion: v1
    kind: ConfigMap
    metadata:
    name: ssh-config
    namespace: neutree
    data:
    config: |
    Host gpu-node-1
    HostName 192.168.1.100
    Port 2222
    User root
  2. Update the neutree-core Deployment to mount the ConfigMap:

    spec:
    template:
    spec:
    containers:
    - name: neutree-core
    # ... other configurations
    volumeMounts:
    - name: ssh-config
    mountPath: /root/.ssh
    readOnly: true
    volumes:
    - name: ssh-config
    configMap:
    name: ssh-config
    defaultMode: 0600
  3. Apply the changes:

    Terminal window
    kubectl apply -f neutree-core-deployment.yaml -n neutree