Skip to content

Commit ce49d22

Browse files
committed
docs: format, typo, clarification, z2jh ingress example
1 parent d53f89b commit ce49d22

File tree

1 file changed

+118
-19
lines changed

1 file changed

+118
-19
lines changed

README.md

Lines changed: 118 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The JupyterHub SSH service provides SSH access to your user environment in a Jup
2121

2222
![Overview](https://raw.githubusercontent.com/yuvipanda/jupyterhub-ssh/main/docs/source/_static/images/technical-overview.png)
2323

24-
Apart from SSH access to JupyterHub, once `jupyterhub-ssh` was deployed, you can also use it to tranfer files from your local
24+
Apart from SSH access to JupyterHub, once `jupyterhub-ssh` was deployed, you can also use it to transfer files from your local
2525
home directory into your remote hub home directory. This is achieved through `jupyterhub-sftp`, a service that provides a SFTP
2626
setup using [OpenSSH](https://www.openssh.com/). `jupyterhub-sftp` currently supports only [NFS](https://tldp.org/LDP/nag/node140.html)
2727
based home directories.
@@ -30,14 +30,16 @@ based home directories.
3030

3131
Instructions on how to install and deploy JupyterHub SSH & SFTP services.
3232

33-
### Regular deployment
33+
### Regular deployment (jupyterhub ssh only)
3434

3535
1. Clone the repo and install the jupyterhub-ssh package:
36+
3637
```bash
3738
$ git clone https://github.com/yuvipanda/jupyterhub-ssh.git
3839
$ cd jupyterhub-ssh
3940
$ pip install -e .
4041
```
42+
4143
1. Or install the package directly:
4244

4345
```bash
@@ -59,47 +61,144 @@ Instructions on how to install and deploy JupyterHub SSH & SFTP services.
5961

6062
1. Start the JupyterHubSSH app from the directory where the config file
6163
`jupyterhub_ssh_config.py` is located:
62-
`bash $ python -m jupyterhub_ssh `
6364

64-
### Kubernetes based deployment
65-
66-
If your JupyterHub was deployed using Kubernetes, you can use the Helm charts available in this repo to deploy JupyterHub SSH & SFTP
67-
directly into your Kubernetes cluster.
65+
```bash
66+
python -m jupyterhub_ssh
67+
```
6868

69-
- Let helm the command line tool know about a Helm chart repository that we decide to name jupyterhub.
70-
```bash
71-
$ helm repo add jupyterhub-ssh https://yuvipanda.github.io/jupyterhub-ssh/
72-
$ helm repo update
73-
```
74-
- Simplified example on how to install a Helm chart from a Helm chart repository named jupyterhub-ssh. See the Helm chart's documentation
75-
for additional details required.
76-
```bash
77-
$ helm install jupyterhub-ssh/jupyterhub-ssh --version <helm chart version> --set hubUrl=https://jupyter.example.org --set-file hostKey=<path to a private SSH key>
78-
```
69+
### Kubernetes based deployment (jupyterhub ssh and/or sftp)
70+
71+
If your JupyterHub has been deployed to Kubernetes, you can use the Helm chart
72+
available in this repo to deploy JupyterHub SSH and/or JupyterHub SFTP directly
73+
into your Kubernetes cluster.
74+
75+
```bash
76+
helm install <helm-release-name> \
77+
--repo https://yuvipanda.github.io/jupyterhub-ssh/ jupyterhub-ssh \
78+
--version <helm chart version> \
79+
--set hubUrl=https://jupyter.example.org \
80+
--set ssh.enabled=true \
81+
--set sftp.enabled=false
82+
```
83+
84+
If you install JupyterHub SFTP, then it needs access to the home folders. These
85+
home folders are assumed to be exposed via a k8s PVC resource that you should
86+
name via the `sftp.pvc.name` configuration.
87+
88+
If your JupyterHub has been deployed using [the official JupyterHub Helm
89+
chart](https://z2jh.jupyter.org) version 1.1.0 or later, and you have
90+
_configured the official JupyterHub Helm chart_ with `proxy.https.enabled=true`
91+
and `proxy.https.type=letsencrypt`, then you can add the following to to acquire
92+
access to the jupyterhub-ssh and jupyterhub-sftp services via that setup.
93+
94+
```yaml
95+
# Configuration for the official JupyterHub Helm chart to accept traffic via
96+
proxy:
97+
https:
98+
enabled: true
99+
type: letsencrypt
100+
letsencryptEmail: <my-email-here>
101+
102+
service:
103+
# jupyterhub-ssh/sftp integration part 1/3:
104+
#
105+
# We must accept traffic to the k8s Service (proxy-public) receiving traffic
106+
# from the internet. Port 22 is typically used for both SSH and SFTP, but we
107+
# can't use the same port for both so we use 23.
108+
#
109+
extraPorts:
110+
- name: ssh
111+
port: 22
112+
targetPort: ssh
113+
- name: sftp
114+
port: 23
115+
targetPort: sftp
116+
117+
traefik:
118+
# jupyterhub-ssh/sftp integration part 2/3:
119+
#
120+
# We must accept traffic arriving to the autohttps pod (traefik) from the
121+
# proxy-public service. Expose a port and update the NetworkPolicy
122+
# to tolerate incoming (ingress) traffic on the exposed port.
123+
#
124+
extraPorts:
125+
- name: ssh
126+
containerPort: 8022
127+
- name: sftp
128+
containerPort: 8023
129+
networkPolicy:
130+
allowedIngressPorts: [http, https, ssh]
131+
132+
# jupyterhub-ssh/sftp integration part 3/3:
133+
#
134+
# We must let traefik know it should listen for traffic (traefik entrypoint)
135+
# and route it (traefik router) onwards to the jupyterhub-ssh k8s Service
136+
# (traefik service).
137+
#
138+
extraStaticConfig:
139+
entryPoints:
140+
ssh-entrypoint:
141+
address: :8022
142+
ssh-entrypoint:
143+
address: :8023
144+
extraDynamicConfig:
145+
tcp:
146+
services:
147+
ssh-service:
148+
loadBalancer:
149+
servers:
150+
- address: jupyterhub-ssh:22
151+
sftp-service:
152+
loadBalancer:
153+
servers:
154+
- address: jupyterhub-sftp:22
155+
routers:
156+
ssh-router:
157+
entrypoints:
158+
- ssh-entrypoint
159+
rule: HostSNI(`*`)
160+
service: ssh-service
161+
sftp-router:
162+
entrypoints:
163+
- sftp-entrypoint
164+
rule: HostSNI(`*`)
165+
service: sftp-service
166+
```
79167
80168
## How to use it
81169
82170
### How to SSH
83171
84172
1. Login into your JupyterHub and go to `https://<hub-address>/hub/token`.
173+
85174
2. Copy the token from JupyterHub.
175+
86176
3. SSH into JupyterHub:
177+
87178
```bash
88-
$ ssh <username-you-used>@<hub-address>
179+
ssh <hub-username>@<hub-address>
89180
```
181+
90182
4. Enter the token received from JupyterHub as a password.
183+
91184
5. TADA :tada: Now you have an interactive terminal! You can do anything you would generally interactively do via ssh: run editors,
92185
fully interactive programs, use the commandline, etc. Some features like non-interactive command running, tunneling, etc are currently
93186
unavailable.
94187

95188
### How to SFTP
96189

97190
1. Login into your JupyterHub and go to `https://<hub-address>/hub/token`.
191+
98192
2. Copy the token from JupyterHub.
193+
99194
3. Transfer file into Jupyterhub:
195+
100196
- Using the `sftp` command:
197+
101198
```bash
102-
$ sftp <hub-username>@<hub-address>
199+
sftp <hub-username>@<hub-address>
103200
```
201+
104202
4. Enter the token received from JupyterHub as a password.
203+
105204
5. TADA :tada: Now you can transfer files to and from your home directory on the hubs.

0 commit comments

Comments
 (0)