CLI access¶
For large-scale jobs, automation, and advanced workflows beyond what the
JupyterHub web UI offers, you can interact with FLAME from the command line
using SSH. For more advanced use cases, you can also use the Kubernetes API directly with kubectl.
Not sure if you need this?
If you're just getting started with FLAME, we recommend trying JupyterHub first. This is the easiest way to use FLAME. You can set up CLI access later if you need it.
Drexel network required
You must be on the Drexel network to access FLAME. This includes JupyterHub, SSH, the Kubernetes API, and every other FLAME service. If you are not on the Drexel network, you cannot connect. There are two ways to get connected:
- On campus: Be physically on campus and connect to an active Drexel Ethernet jack or DragonFly3 Wi-Fi.
- Off campus: Connect to the Drexel VPN.
SSH access¶
FLAME uses short-lived SSH certificates instead of SSH keys. You never upload a public key; instead you log in with your institutional credentials in your browser and receive a certificate that lives in your ssh-agent and expires after 48 hours. When it expires, you need to log in again.
Install and set up the step CLI¶
FLAME uses the step
command line tool to handle issuing SSH certificates and adding them to your SSH
agent. You'll need to install step to SSH into FLAME. See the official
install instructions for all
options; the most common methods are below.
In PowerShell:
Open a new PowerShell window afterwards so that step is on your PATH.
If you prefer Windows Subsystem for Linux (WSL), follow the instructions in the "Linux" tab from within WSL.
Verify the installation:
Then you need a couple of once-per-machine setup steps. First, point step at
the FLAME certificate authority:
step ca bootstrap --ca-url https://ca.flamecluster.io --fingerprint 6a997ce44bade7ec7ef26aeaa4a8a5cfbf270604e73c344a8dc08a72df86f775
Then fetch the SSH configuration you'll need to connect to FLAME (this writes
the flame host aliases and trust settings into ~/.ssh, managed between
markers so your own config is untouched — re-run it any time to pick up
updates):
Start your SSH agent¶
Before logging in, make sure an SSH agent is running:
If this lists identities or says The agent has no identities., the agent is
running. If it says that it cannot connect to an authentication agent, start
one:
You may need to start the agent again in each new terminal session unless your environment does this automatically.
Log in¶
Now you can login:
A browser window opens for the standard FLAME sign-in. When it completes, a certificate is loaded into your ssh-agent. Confirm with:
Connect to your JupyterHub server¶
That's it. You land in a shell inside your JupyterHub server. If it isn't
running, ssh flame starts it first and shows you the progress, then drops
you in. The web interface and your SSH sessions work side by side on the
same server.
While waiting, ssh flame and ssh flamectl server start check the pod every
five seconds and print changes to its scheduling and startup status, including
messages such as Insufficient cpu or ImagePullBackOff. You can also see the
current message with ssh flamectl server status.
Notebook SSH connections disable connection sharing so each connection checks
the current server through the gateway. Run step ssh config and accept the
replacement prompts to refresh an existing SSH configuration.
You should be able to interact with FLAME in the same way you'd interact with any other server reachable over SSH:
ssh flame nvidia-smi # run one command and return
scp results.tar.gz flame:~/ # copy a file in
scp flame:/workspace/plots/loss.png . # ...or out
rsync -av --progress data/ flame:/workspace/data/ # sync a directory
ssh -L 6006:localhost:6006 flame # forward a port, e.g. TensorBoard
sftp flame # interactive file transfer
Graphical programs over ssh -X flame need a custom image with X11 tools
installed; see SSH into custom
images.
Anything you put under /home/ubuntu or
/workspace lands on persistent storage and is there next time — see
Storage. Files written anywhere else live only as
long as the server.
VSCode works too
VSCode can connect over SSH as well — see VSCode.
Choosing what ssh flame starts¶
When ssh flame has to start a server, it uses your saved settings —
workspace, size, GPU, and image. If you haven't saved any and you belong to
exactly one workspace, it starts a default (medium, no GPU) server there. If you
belong to several workspaces, it asks you to choose first.
Settings are managed through the flamectl host:
lists the workspaces, sizes, and GPU types available to you, then:
See GPUs for the hardware behind each GPU type and help choosing between them.
To use a custom image on your next start:
ssh flamectl server config set --image registry.flamecluster.io/mylab/devbox:v1
ssh flamectl server start
ssh flame
Settings persist until you change them. Any subset works (set --size small
alone keeps your other settings). --gpu none clears a GPU request,
ssh flamectl server config set --image none restores the default image, and
ssh flamectl server config unset returns all settings to the defaults.
Changing settings does not replace a running server; stop it first if you want
the next start to use the new image.
Same choices as the web form
ssh flame and the JupyterHub start page are two entry points into the same
server. The workspaces, sizes, GPU types, and custom image are the same
choices, and whichever way you start the server, the other side sees it running.
Managing your server¶
ssh flamectl on its own prints the full command list:
| Command | What it does |
|---|---|
ssh flamectl server status |
current server status, scheduling or startup messages, and settings |
ssh flamectl server start |
start it without connecting |
ssh flamectl server stop |
stop it |
ssh flamectl server config |
show your saved settings |
ssh flamectl server config options |
what you can choose from |
ssh flamectl server config set [options] |
save settings |
ssh flamectl server config unset |
back to the defaults |
Troubleshooting¶
Permission denied (publickey)when connecting- Your certificate has expired (they last 48 hours). Run
step ssh login your-email@drexel.eduagain. getsockname failed: Not a socketon Windows- Your SSH configuration predates Windows support. Run
step ssh configagain to refresh it. error connecting with ssh-agenton Windows- The
ssh-agentservice isn't running — see Start your SSH agent. ssh: Could not resolve hostname flame- The
flame/flamectlhost aliases come fromstep ssh config. Run it once (it's safe to repeat), then try again. You are a member of multiple workspaces, so I can't pick one for you- Save a default:
ssh flamectl server config set --workspace <name>. Usessh flamectl server config optionsto see the names. your server is running but does not accept SSH connections- The server is using a custom image that wasn't built
FROMa URCF base image, so it's missing FLAME's SSH support — see Building a custom container image. Starting your server...sits for a long time- Large images take a few minutes to start, and GPU servers wait for a free
GPU. The same waits apply in the web interface;
ssh flamectl server statusshows where it's at.
Kubernetes API access (advanced)¶
kubectl talks to the Kubernetes API directly — how you submit
TrainJobs, inspect pods and logs, and
work with FLAME's Kubernetes objects. It authenticates separately from SSH
(a different helper, Pinniped), so set it up in addition to SSH if you
need it. You need to install two pieces of software:
- kubectl: the Kubernetes command-line tool, used to run commands against the cluster
- Pinniped: authentication helper that integrates
kubectlwith the FLAME Authentication system
Install kubectl¶
Follow the official instructions for your operating system:
Verify the installation:
Install the Pinniped CLI¶
Pinniped is what connects kubectl to Drexel's single sign-on. See the official install instructions for all options; the most common methods are below.
Homebrew
Direct download
Download pinniped-cli-windows-amd64.exe from the Pinniped releases page, rename it to pinniped.exe, and add it to your PATH.
Verify the installation:
Download the FLAME kubeconfig¶
The kubeconfig
file,
stored at ~/.kube/config, tells kubectl how to connect and authenticate to a
cluster. To use FLAME, you need to create ~/.kube/config with a standard configuration file.
There are three options:
Run the following commands to download the kubeconfig directly:
Click the button below to download the kubeconfig file, then move it to ~/.kube/config:
Create ~/.kube/config using a text editor and paste the following contents:
apiVersion: v1
clusters:
- cluster:
server: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: flame
contexts:
- context:
cluster: flame
user: flame
name: flame
current-context: flame
kind: Config
preferences: {}
users:
- name: flame
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
args:
- login
- oidc
- --enable-concierge
- --concierge-authenticator-name=keycloak-authenticator
- --concierge-authenticator-type=jwt
- --concierge-endpoint=https://k8s.flamecluster.io
- --concierge-ca-bundle-data=LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNCVENDQVl5Z0F3SUJBZ0lVQVpENFpPSnNZUEJRQ09sZXV5ZXdrNGl1U1d3d0NnWUlLb1pJemowRUF3TXcKTWpFVU1CSUdBMVVFQ2d3TFJISmxlR1ZzSUZWU1EwWXhHakFZQmdOVkJBTU1FWFZ5WTJZdGNtOXZkQzFqWVMxdwpjbTlrTUI0WERUSTJNREl4T0RFNU1qa3dORm9YRFRRMk1ESXhNekU1TWprd05Gb3dNakVVTUJJR0ExVUVDZ3dMClJISmxlR1ZzSUZWU1EwWXhHakFZQmdOVkJBTU1FWFZ5WTJZdGNtOXZkQzFqWVMxd2NtOWtNSFl3RUFZSEtvWkkKemowQ0FRWUZLNEVFQUNJRFlnQUU4Q3ZxZ2ZOT0xTZkhBcnM2MW9XOCtOZlhyN3p4aU52TEk3WlJUSU1MdGdmVgpBakJoeWYyODJMWjZaa1VPdjdpZ3NMaGlWSmcrL09QNTY1V0NpeEJ1MThlRmRYYjFBSS8xeFljMkpDa1hSbEwvCngxOGlaTUJuL2JCazlVU3ZhNi9RbzJNd1lUQWRCZ05WSFE0RUZnUVVQMXlqcnNlaE84WHJvYit6UXp4a3IxMXAKeSt3d0h3WURWUjBqQkJnd0ZvQVVQMXlqcnNlaE84WHJvYit6UXp4a3IxMXB5K3d3RHdZRFZSMFRBUUgvQkFVdwpBd0VCL3pBT0JnTlZIUThCQWY4RUJBTUNBWVl3Q2dZSUtvWkl6ajBFQXdNRFp3QXdaQUl3Vmd5KzZqN2VrQTh2CkhNZi9ReHhVTmFmNjRCaW5QZHFMSGJXcGdEMWhQMFlRZkkveVJ6SWo3K3ZZN1hYbGJkamJBakF4S0RTQ0V0YSsKUVhYQ0pEVHR3TEZoRnFTY0REMFMveVh0SlZXcnAweW02UWpDa29Ha1ZKekxwejFORjNTejRqOD0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
- --issuer=https://keycloak.flamecluster.io/realms/flame
- --client-id=pinniped-cli
- --scopes=openid,email,profile,offline_access
- --request-audience=pinniped-cli
command: pinniped
env: []
installHint: |
The pinniped CLI does not appear to be installed.
See https://pinniped.dev/docs/howto/install-cli/ for installation instructions.
interactiveMode: IfAvailable
provideClusterInfo: true
Existing kubeconfig
If you already have a ~/.kube/config for another cluster, back it up first:
Or keep configs separate with the KUBECONFIG environment variable (substitute the method above accordingly):
Authenticate¶
Now you're ready to authenticate. Run the following command, which prints info about the machines available in the cluster:
Your browser will open to the Globus Auth login page. Choose "Drexel University" as your institution and sign in with your Drexel username and password (the same process described in Authentication). After login, the browser tab will confirm success and you can close it.
Back in your terminal, the command will complete and show you the cluster nodes. You should see something like this, although the exact contents will vary:
$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
prod-cpu01 Ready <none> 3h35m v1.35.7+rke2r1
prod-cpu02 Ready <none> 3h35m v1.35.7+rke2r1
prod-cpu03 Ready <none> 3h35m v1.35.7+rke2r1
prod-cpu04 Ready <none> 3h35m v1.35.7+rke2r1
prod-cpu06 Ready <none> 3h35m v1.35.7+rke2r1
prod-cpu07 Ready <none> 3h35m v1.35.7+rke2r1
prod-ctrl01 Ready control-plane,etcd,master 3h41m v1.35.7+rke2r1
prod-ctrl02 Ready control-plane,etcd,master 3h39m v1.35.7+rke2r1
prod-ctrl03 Ready control-plane,etcd,master 3h39m v1.35.7+rke2r1
prod-gh200-01 Ready <none> 3h29m v1.35.7+rke2r1
prod-gh200-02 Ready <none> 3h29m v1.35.7+rke2r1
prod-rtxa6000-01 Ready <none> 3h29m v1.35.7+rke2r1
Sessions last 48 hours
After the initial login, Pinniped caches your credentials, so you won't need to re-authenticate for every command. Sessions last up to 48 hours from when you log in, after which your next kubectl command will open a browser to sign in again.
Set your namespace¶
Most Kubernetes resources live in a namespace. On FLAME, each workspace has its own namespace.
Not sure what your workspace is?
If you don't know your workspace, email URCF staff and they can tell you.
You can set the namespace for a kubectl command using the -n argument, e.g.:
will list all the pods in my-workspace. However, this gets tedious
quickly, so you should set a default namespace as follows:
Now when you run:
You'll automatically see only the pods in your workspace namespace.
Getting a throwaway shell¶
ssh flame gives you a shell in your own server; for a shell in a fresh,
disposable pod (a different image, or nothing of yours mounted), run one:
This starts a temporary bash shell in a minimal Ubuntu pod. When you exit, the pod is automatically cleaned up.
Next steps¶
- Learn about Kubernetes and storage
- Connect your local VSCode to FLAME