Setup
Prerequisites for NRP Training
Before attending the training session, please ensure you have completed the following setup steps.
Two ways to follow along
There are two ways to run the hands-on exercises in this training:
- NRP USCMS Analysis Hub (recommended). A JupyterHub-based environment with the training materials,
kubectl, andkubeloginalready installed — nothing to set up on your laptop ahead of time. It still needs one login step done at the start of the session (see below). This is also the only path that works for the whole training: the later CMS Data Access lesson uses hub-only tools (grid-cert-import,grid-proxy-init) with no local equivalent, so anyone on their own machine ends up switching over for that lesson anyway. - Your own machine (alternative). You run
kubectllocally against the Nautilus cluster. This only works if you've completed the setup steps below before the session —kubectl,kubelogin, and your kubeconfig all need to be installed and verified in advance. Useful if you prefer working in your own local environment, but see the caveats in that section below before committing to it.
Everything past this setup page — namespaces, kubectl commands, YAML manifests — is identical either way.
Jump to: NRP USCMS Analysis Hub (recommended) · Your own machine (alternative)
1. NRP Access Requirements
Institutional Account Access
- You must have an institutional account with NRP access via Authentik
- You can use CERN account or institutional account, but choose one and stick with it
- NRP access is available to users from US academic institutions or those collaborating with US institutions
- If you don't have access, see Getting Started with NRP
Namespace Membership
- You must be part of at least one namespace to participate in the training
- Check your namespaces at: https://nrp.ai/namespaces/
- Students: Contact your research supervisor to be added to their namespace
- Faculty/Researchers: Request namespace admin status in Matrix
We are using the namespace us-cms
Ask Daniel or Martin to add you if you have not been added already
Method 1: NRP USCMS Analysis Hub (recommended)
You still need the account and namespace access from NRP Access Requirements above — this method just skips installing anything on your laptop. kubectl and kubelogin are already installed on the hub image; you only need to point kubectl at the cluster and log in once per session.
▶ Launch the workspace on the NRP USCMS Analysis Hub — signs you in at uscms-af.nrp-nautilus.io, pulls the tutorial workspace, and opens JupyterLab.
Get kubectl working in the hub terminal
Open a terminal in JupyterLab (File → New → Terminal) and run:
grid-kube-setupThis fetches a fresh kubeconfig from https://nrp.ai/config and installs it at ~/.kube/config (backing up anything already there). It doesn't log you in by itself — the next kubectl command you run triggers a device-code login:
kubectl get pods -n us-cmskubelogin prints a URL and a short code. Open the URL on your laptop, enter the code, and the hub terminal picks up the token automatically — nothing more to click on the hub side.
Expected output
jovyan@jupyter-...:~$ grid-kube-setup
Fetching https://nrp.ai/config
user 'oidc':
+ --grant-type=device-code
+ --skip-open-browser
Backed up /home/jovyan/.kube/config.xxxxxxxxxxx.bak
Updated /home/jovyan/.kube/config
Next: run any kubectl command to trigger the login, e.g.
kubectl get pods
kubelogin will print a URL and a code. Open the URL on your laptop, enter the
code, and this terminal will pick up the token.
jovyan@jupyter-...:~$ kubectl get pods -n us-cms
Please visit the following URL in your browser: https://authentik.nrp-nautilus.io/device?code=XXXXXXXXX
NAME READY STATUS RESTARTS AGE
mlflow-667f8c984c-thzsr 2/2 Running 0 2d22h
mlflow-postgres-0 1/1 Running 0 10dThe login lasts for the rest of your hub session — you don't need to repeat this for every new terminal, only after grid-kube-setup re-installs the kubeconfig or your token expires.
Kubernetes Basics, the first hands-on lesson, starts with a one-time callout covering the rest of the hub setup (grid certificate, proxy, username) — do that once and the rest of the training just works.
Method 2: Your own machine (alternative)
Complete these steps before the session — they can't be done live.
You'll still need the Analysis Hub for the last lesson. CMS Data Access on NRP uses grid-cert-import and grid-proxy-init, tools built into the Analysis Hub's image with no local install path. If you use your own machine for the rest of the training, plan to switch to the Analysis Hub for that lesson.
Also watch out for ~: it means a different directory in each place. On your own machine it's your local home directory; in the Analysis Hub's JupyterLab terminal it's /home/jovyan. A command like cd ~/cms-hats/workspace lands somewhere different depending on which terminal you're actually typing it into — don't copy a command you ran in one context straight into the other without checking where it actually points.
Get an NRP account and namespace access → install kubectl → install kubelogin → download your kubeconfig from nrp.ai/config → verify with kubectl get nodes. The sections below walk through each step in detail.
1. Install kubectl
The Kubernetes command-line tool, kubectl, is required for the training exercises.
Linux
Download and install:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectlmacOS
Using Homebrew:
brew install kubectlOr download directly:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
chmod +x kubectl
sudo mv kubectl /usr/local/bin/Windows
Download from: https://kubernetes.io/docs/tasks/tools/install-kubectl-windows/
2. Install kubelogin Plugin
You must install the kubelogin plugin, or your kubeconfig file will not work.
macOS
brew install kubeloginLinux/Windows
Download from: https://github.com/int128/kubelogin?tab=readme-ov-file#setup
3. Download Kubernetes Config File
- Download the config file from: https://nrp.ai/config
- Save it as
config(without any extension) in your~/.kubefolder - If the folder doesn't exist, create it:
mkdir ~/.kube- The final path should be:
~/.kube/config
4. Cross-Platform kubelogin Fixes
If you run into authentication issues with kubelogin, try these fixes:
Keyring errors (e.g., /run/user/1000/bus not found):
- Add
--token-cache-storage=diskto store tokens on disk instead of Linux keyring
Browser issues (won't launch or opens incorrectly):
- Add
--browser-command="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"(Windows WSL: points to Windows Chrome)
Port binding errors (port 8000 already in use):
- Add
--listen-port=18000(change to any unused port)
No local browser available (remote console):
- Add
--grant-type=device-code --skip-open-browser
Example config snippet:
args:
- oidc-login
- get-token
- --browser-command="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
- --listen-port=18000
- --token-cache-storage=disk5. Verify Installation
- Check kubectl context:
kubectl config get-contextsYou should see nautilus in the list. If you have multiple contexts, set it:
kubectl config use-context nautilus- Test authentication:
kubectl get nodesThis will open a browser window for authentication via CiLogon.
- Verify namespace access:
kubectl get pods -n <YOUR_NAMESPACE>If you see "No resources found", that's okay - it means you have access but there are no pods yet.
- Set default namespace (optional):
kubectl config set-context nautilus --namespace <YOUR_NAMESPACE>6. Clone the training materials
Clone the branch containing the files for this training:
git clone --branch materials/cms-hats --single-branch https://github.com/nrp-nautilus/nrp-training.git ~/cms-hats
cd ~/cms-hats/workspaceIf you already cloned the training materials, update your local copy instead:
cd ~/cms-hats
git pull
cd workspaceCLI Tools
Below are two tools which reduce the amount of kubernetes commands you need to type out.
These are not required. All parts of the tutorial and using Kubernetes in general can be done via the command line, however these tools make things easier. If you wish to use these PLEASE INSTALL PRIOR TO THE EXERCISE.
Getting Help
If you encounter issues during setup:
- Support Chat: Join NRP's Support Chat for community support
- Email: usersupport@nrp-nautilus.io
- Documentation: NRP Getting Started Guide