Using a non-standard SSH port
Issue
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.
Solution
Neutree uses Ray as the underlying cluster management tool and does not support directly configuring the SSH port. In addition to being used for SSH connections, the head_ip and worker_ips values in the cluster configuration are also used as the Ray cluster GCS address (<head_ip>:6379) and Dashboard access address (http://<head_ip>:8265). Use an SSH configuration file to override the non-standard SSH port for node IP addresses.
Steps
-
Create an SSH configuration file and add port configuration for each node IP address.
Terminal window mkdir -p ./ssh-configcat > ./ssh-config/config << 'EOF'Host <host_ip>Port <ssh_port>EOFchmod 600 ./ssh-config/configParameter descriptions:
Parameter Description Host <host_ip>Node IP address. It must be the same as the head_ipandworker_ipsvalues in the cluster configuration. Wildcards are supported. If multiple nodes use the same port, you can use a simplified form such asHost 192.168.1.*.Port <ssh_port>SSH port used by the node. Information:
- When Neutree connects to a node, it runs
ssh <ssh_user>@<host_ip>. TheHostentry in the SSH configuration must match the node IP address. - Neutree provides the username and key through the
ssh_userandssh_private_keyvalues in the cluster configuration.
Example
mkdir -p ./ssh-configcat > ./ssh-config/config << 'EOF'Host 192.168.1.100Port 2222Host 192.168.1.101Port 2222EOFchmod 600 ./ssh-config/configThis example creates
./ssh-config/configand adds the following configuration: nodes whose IP addresses are192.168.1.100and192.168.1.101use SSH port2222. - When Neutree connects to a node, it runs
-
Mount the SSH configuration file to the Neutree’s
neutree-corecontainer.Choose the appropriate method based on your deployment mode.
-
Update the
docker-compose.yamlfile to mount the SSH configuration file to theneutree-corecontainer.services:neutree-core:# ... other configurationsvolumes:- ./ssh-config:/root/.ssh:ro -
Restart the service.
docker-compose up -d
Note:
When upgrading the Neutree control plane using
docker-compose.yamlin the future, your custom volume mounts may be overwritten. After each upgrade, be sure to remount the SSH configuration file to theneutree-corecontainer.-
Create a ConfigMap containing the SSH configuration.
kubectl create configmap ssh-config --from-file=config=./ssh-config/config -n neutreeOr create the ConfigMap using a YAML file:
apiVersion: v1kind: ConfigMapmetadata:name: ssh-confignamespace: neutreedata:config: |Host 192.168.1.100Port 2222 -
Update the
neutree-coreDeployment to mount the SSH configuration file.apiVersion: apps/v1kind: Deploymentmetadata:name: neutree-corenamespace: neutreespec:template:spec:containers:- name: neutree-core# ... other configurationsvolumeMounts:- name: ssh-configmountPath: /root/.sshreadOnly: truevolumes:- name: ssh-configconfigMap:name: ssh-configdefaultMode: 0600 -
Apply the configuration:
kubectl apply -f neutree-core-deployment.yaml -n neutree
-
-
Test whether the SSH connection to the node is normal to verify that the SSH configuration file and node configuration are correct.
You can run the following command on the host where Neutree is located to check whether the node port is reachable:
nc -zv 192.168.1.100 2222Or, after adding the node to Neutree, check whether the cluster enters the Ready state.
-
Add nodes to the cluster in Neutree. For
head_ipandworker_ips, enter node IP addresses.
Related links
For Ray-related limitations, see Ray Discuss: Specify SSH port to cluster YAMLs.