Mount SSH configuration

Mount custom SSH configurations into workspaces by using a ConfigMap. Extend the default SSH settings with additional parameters or host-specific configurations.

The system sets the default SSH configuration automatically from the SSH secret in User Preferences. You can extend it by mounting an additional .conf file to /etc/ssh/ssh_config.d/.

Prerequisites
Procedure
  1. Create a ConfigMap with the SSH configuration:

    kind: ConfigMap
    apiVersion: v1
    metadata:
      name: workspace-userdata-sshconfig-configmap
      namespace: <your_namespace>
      labels:
        controller.devfile.io/mount-to-devworkspace: 'true'
        controller.devfile.io/watch-configmap: 'true'
      annotations:
        controller.devfile.io/mount-as: subpath
        controller.devfile.io/mount-path: /etc/ssh/ssh_config.d/
    data:
      ssh-config.conf: |
        <ssh_config_content>

    where:

    <your_namespace>

    Your namespace name. To find your namespace, go to https://__<che_fqdn>__/api/kubernetes/namespace.

    <ssh_config_content>

    The SSH configuration file content, for example Host, IdentityFile, or ProxyCommand directives.

  2. Apply the ConfigMap:

    kubectl apply -f - <<EOF
    kind: ConfigMap
    apiVersion: v1
    metadata:
      name: workspace-userdata-sshconfig-configmap
      namespace: <your_namespace>
      labels:
        controller.devfile.io/mount-to-devworkspace: 'true'
        controller.devfile.io/watch-configmap: 'true'
      annotations:
        controller.devfile.io/mount-as: subpath
        controller.devfile.io/mount-path: /etc/ssh/ssh_config.d/
    data:
      ssh-config.conf: |
        <ssh_config_content>
    EOF
Verification
  • Start a workspace and verify the SSH configuration file is mounted:

    $ cat /etc/ssh/ssh_config.d/ssh-config.conf