Skip to content
Neutree Documentation

Using a non-standard SSH port

Neutree connects to nodes via SSH to manage static node clusters. The default SSH port is 22. If your nodes use a different port, adding nodes may fail.

Neutree uses Ray as the underlying cluster management tool. Because Ray does not support configuring the SSH port directly, use an SSH configuration file to configure a non-standard SSH port for each node.

Steps

  1. Create an SSH configuration file and add node configurations.

    mkdir -p ./ssh-config
    cat > ./ssh-config/config << 'EOF'
    Host <host_alias>
    HostName <host_ip>
    Port <ssh_port>
    User <user>
    Host <host_alias>
    HostName <host_ip>
    Port <ssh_port>
    User <user>
    EOF
    chmod 600 ./ssh-config/config

    Parameter description:

    ParameterDescription
    <host_alias>Node alias, used to identify the node in the SSH configuration and when adding the node to the cluster after configuration is complete.
    <host_ip>IP address of the node.
    <ssh_port>SSH port used by the node.
    <user>SSH username. Must be root or another user with root privileges.

    Example

    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

    The example above creates ./ssh-config/config with the following configuration: node alias gpu-node-1, IP 192.168.1.100, port 2222, username root.

  2. Mount the SSH configuration file to the Neutree’s neutree-core container.

    Choose the appropriate method based on your deployment mode.

    @tab Docker Compose

    1. Update the docker-compose.yaml file to mount the SSH configuration file to the neutree-core container.

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

      docker-compose up -d

    @tab Kubernetes

    1. Create a ConfigMap containing the SSH configuration.

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

      Or create the ConfigMap using a YAML file:

      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 SSH configuration file.

      apiVersion: apps/v1
      kind: Deployment
      metadata:
      name: neutree-core
      namespace: neutree
      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 configuration:

      kubectl apply -f neutree-core-deployment.yaml -n neutree
  3. Test the SSH connection to each node to verify that the SSH configuration file and node configuration are correct.

  4. Add nodes to the cluster in Neutree. Use the node alias (such as gpu-node-1 in the example above) instead of the IP address.

For Ray-related limitations, see Ray Discuss: Specify SSH port to cluster YAMLs.