UCloud logo UCloud logo UCloud
v2025.1.0
  1. UCloud/Core
  2. 1. Introduction
  3. 2. Projects
  4. 3. Accounting
  5. 4. Orchestration
  6. UCloud/IM for Slurm-based HPC
  7. 5. Installation
  8. 6. Architecture and Networking
  9. 7. User and Project Management
  10. 8. Filesystem Integration
    1. 8.1. Inter-provider file transfers
  11. 9. Slurm Integration
    1. 9.1. Application Management
    2. 9.2. Built-in Applications
  12. 10. Reference
    1. 10.1. Configuration
    2. 10.2. CLI
  13. 11. Appendix
    1. 11.1. Built-in Application Index
  14. UCloud/IM for Kubernetes
  15. 12. Installation
  16. 13. Architecture and Networking
  17. 14. Filesystem Integration
  18. 15. Compute Jobs
    1. 15.1. Public Links
    2. 15.2. Public IPs
    3. 15.3. License Servers
    4. 15.4. SSH Servers
  19. 16. Integrated applications
    1. 16.1. Syncthing
    2. 16.2. Integrated terminal
  20. 17. Reference
    1. 17.1. Configuration
  21. H: Procedures
  22. 18. H: Procedures
  23. 19. H: Introduction
  24. 20. H: Auditing
  25. 21. H: Auditing scenario
  26. 22. H: GitHub actions
  27. 23. H: Deployment
  28. 24. H: 3rd party dependencies (risk assesment)
  1. Links
  2. Source Code
  3. Releases

SSH servers

The SSH feature allows end-users to access a running job over SSH by uploading SSH public keys. When enabled, the integration module assigns a unique external TCP port to the job and exposes the rank-0 pod’s SSH daemon (port 22) through a Kubernetes Service.

SSH access is implemented similarly to public IPs: a Kubernetes Service is created that selects the rank-0 pod and uses service.spec.externalIPs so the job becomes reachable from outside the cluster.

When SSH access is enabled for a job:

  • The integration module determines whether SSH should be enabled for the job (based on application mode and user choice).
  • A random, available TCP port is assigned from a configured port range.
  • A Kubernetes Service is created that:
    • Selects only the rank-0 pod
    • Exposes the assigned external port
    • Forwards traffic to port 22 in the pod
    • Uses service.spec.externalIPs with the configured SSH IP address
  • The user’s uploaded SSH public keys are injected into the pod as an authorized_keys file using an init container.
  • The job receives an environment variable containing the SSH endpoint.

When a port is assigned, the integration module records a job message on the job in the form:

SSH: Connected! Available at: ssh ucloud@<hostname-or-ip> -p <port>

This message is visible to the end-user in the job interface.

SSH key injection

End-users can upload their public SSH key in the UCloud user-interface. Key injection is implemented using an init container and a shared EmptyDir volume. It goes through the following steps:

$ chmod 700 /etc/ucloud/ssh
$ touch /etc/ucloud/ssh/authorized_keys.ucloud
$ chmod 600 /etc/ucloud/ssh/authorized_keys.ucloud
$ chown <default uid>:<default uid> -R /etc/ucloud/ssh

# Appends all uploaded SSH keys into: /etc/ucloud/ssh/authorized_keys.ucloud

Applications written for UCloud are expected to configure the SSH daemon to accept this file as an authorized keys source.

Job environment variables

When SSH is enabled and keys are injected, the job container receives:

$ export UCLOUD_PUBLIC_SSH=<hostname-or-ip>:<port>

This allows applications and templates to display or use the SSH endpoint.

Requirements and prerequisites

For SSH access to work correctly, all the following must be true:

  1. The configured ssh.ipAddress must be routable to the Kubernetes nodes. The integration module publishes this address through service.spec.externalIPs.
  2. External routing must direct traffic for ssh.ipAddress to the correct nodes Kubernetes does not advertise or route external IPs automatically. This must be handled by the surrounding network.
  3. The cluster network must support service.spec.externalIPs
  4. Network policies and firewalls outside Kubernetes must allow traffic Inbound TCP traffic in the configured port range must be permitted to reach the nodes.

In addition to this, the feature must be enabled through the configuration:

services:
  type: Kubernetes
  
  compute:
    ssh:
      enabled: true
      ipAddress: 10.56.32.3
      hostname: ucloud.invalid
      portMin: 8000
      portMax: 16000

Example configuration for enabling the SSH server feature

Previous License Servers
Next Integrated applications