11# odh-cli
22
3- CLI tool for RHOAI (Red Hat OpenShift AI) for interacting with RHOAI deployments on Kubernetes.
3+ CLI tool for ODH/RHOAI (Red Hat OpenShift AI) for interacting with ODH/RHOAI deployments on Kubernetes.
4+
5+ ## Available Subcommands
6+
7+ - ** ` odh-cli lint ` ** - Validate cluster configuration and assess upgrade readiness
8+ - ** ` odh-cli version ` ** - Display CLI version information
49
510## Quick Start
611
712### Using Containers
813
9- Run the CLI using the pre-built container image:
14+ Run the CLI using the pre-built container image. Set your container runtime (podman or docker) :
1015
11- ** Podman:**
1216``` bash
13- podman run --rm -ti \
14- -v $KUBECONFIG :/kubeconfig \
15- quay.io/rhoai/rhoai-upgrade-helpers-rhel9:dev lint --target-version 3.3.0
16- ```
17+ # Use podman or docker
18+ CONTAINER_TOOL=podman # or 'docker'
1719
18- ** Docker:**
19- ``` bash
20- docker run --rm -ti \
20+ # Run lint command
21+ $CONTAINER_TOOL run --rm -ti \
2122 -v $KUBECONFIG :/kubeconfig \
22- quay.io/rhoai/rhoai-upgrade-helpers -rhel9:dev lint --target-version 3.3.0
23+ quay.io/rhoai/odh-cli -rhel9:dev lint --target-version 3.3.0
2324```
2425
2526The container has ` KUBECONFIG=/kubeconfig ` set by default, so you just need to mount your kubeconfig to that path.
2627
27- > ** SELinux :** On systems with SELinux enabled (Fedora, RHEL, CentOS), add ` :Z ` to the volume mount :
28+ > ** Note :** If ` KUBECONFIG ` is not set, use the default path :
2829> ``` bash
29- > # Podman
30- > podman run --rm -ti \
30+ > $CONTAINER_TOOL run --rm -ti \
31+ > -v ~ /.kube/config:/kubeconfig \
32+ > quay.io/rhoai/odh-cli-rhel9:dev lint --target-version 3.3.0
33+ > ` ` `
34+
35+ > ** SELinux:** On SELinux systems (Fedora, RHEL, CentOS), add ` :Z` to volume mounts:
36+ > ` ` ` bash
37+ > # With KUBECONFIG set
38+ > $CONTAINER_TOOL run --rm -ti \
3139> -v $KUBECONFIG :/kubeconfig:Z \
32- > quay.io/rhoai/rhoai-upgrade-helpers -rhel9:dev lint --target-version 3.3.0
40+ > quay.io/rhoai/odh-cli -rhel9:dev lint --target-version 3.3.0
3341>
34- > # Docker
35- > docker run --rm -ti \
36- > -v $KUBECONFIG :/kubeconfig:Z \
37- > quay.io/rhoai/rhoai-upgrade-helpers -rhel9:dev lint --target-version 3.3.0
42+ > # With default kubeconfig path
43+ > $CONTAINER_TOOL run --rm -ti \
44+ > -v ~ /.kube/config :/kubeconfig:Z \
45+ > quay.io/rhoai/odh-cli -rhel9:dev lint --target-version 3.3.0
3846> ` ` `
3947
48+ ** Working with Multiple Clusters:**
49+
50+ If your kubeconfig contains multiple cluster contexts, the CLI uses the ` current-context` . You have two options:
51+
52+ ** Option 1: Switch context before running (Recommended)**
53+
54+ ` ` ` bash
55+ # Switch to desired cluster
56+ kubectl config use-context < context-name>
57+
58+ # Run the CLI (uses new context-name)
59+ $CONTAINER_TOOL run --rm -ti \
60+ -v ~ /.kube/config:/kubeconfig \
61+ quay.io/rhoai/odh-cli-rhel9:dev lint --target-version 3.3.0
62+ ```
63+
64+ ** Option 2: Set context with --context flag**
65+
66+ ``` bash
67+ $CONTAINER_TOOL run --rm -ti \
68+ -v ~ /.kube/config:/kubeconfig:Z \
69+ quay.io/rhoai/odh-cli-rhel9:dev lint --target-version 3.3.0 \
70+ --context < context-name>
71+ ```
72+
4073** Available Tags:**
41- - ` :latest` - Latest stable release
42- - ` :dev` - Latest development build from main branch (updated on every push)
43- - ` :vX.Y.Z` - Specific version (e.g., ` :v1.2.3` )
74+ - ` :dev ` - Latest development build from main branch
75+ - ` :rhoai-X.Y-ea.Z ` - Specific version (e.g., ` :rhoai-3.4-ea.1 ` )
4476
45- > ** Note:** The images are OCI-compliant and work with both Podman and Docker. Examples for both are provided below.
77+ > ** Note:** The images are OCI-compliant and work with both Podman and Docker.
4678
47- ** Shell Access:**
79+ ** Interactive Shell Access:**
4880
49- The container also bundles migration tools and CLI utilities that can be used directly from a shell session :
81+ For interactive debugging and running upgrade helper scripts :
5082
51- ** Podman: **
83+ ** Step 1: Login to cluster (on your host) **
5284``` bash
53- podman run -it --rm \
54- -v $KUBECONFIG :/kubeconfig \
55- --entrypoint /bin/bash \
56- quay.io/rhoai/rhoai-upgrade-helpers-rhel9:dev
85+ # Login on your cluster which should update ~/.kube/config
86+ oc login --token=sha256~xxxx --server=https://api.my-cluster.example.com:6443
5787```
5888
59- ** Docker: **
89+ ** Step 2: Shell into container **
6090``` bash
61- docker run -it --rm \
62- -v $KUBECONFIG :/kubeconfig \
91+ # Mount the kubeconfig that was created by oc login
92+ $CONTAINER_TOOL run -it --rm \
93+ -v ~ /.kube/config:/kubeconfig \
6394 --entrypoint /bin/bash \
64- quay.io/rhoai/rhoai-upgrade-helpers -rhel9:dev
95+ quay.io/rhoai/odh-cli -rhel9:dev
6596```
6697
98+ ** Step 3: Inside container - you're already authenticated**
99+
67100Available tools:
68- - ` rhai-cli `
69- - ` kubectl ` (latest stable)
70- - ` oc ` (latest stable)
71- - ` jq `
72- - ` wget `
73- - ` curl `
74- - ` tar `
75- - ` gzip `
76- - ` bash `
77-
78- Example usage:
79- ``` bash
80- oc login --token=sha256~xxxx --server=https://api.my-cluster.p3.openshiftapps.com:6443
101+ - ` odh-cli ` - The CLI tool (at ` /opt/odh-cli/bin/odh-cli ` )
102+ - ` kubectl ` / ` oc ` - Kubernetes/OpenShift client tools from OCP 4.19
103+ - Upgrade helper scripts at ` /opt/rhai-upgrade-helpers `
104+ - Standard utilities: ` jq ` , ` yq ` , ` python3 ` , ` wget ` , ` curl ` , ` tar ` , ` gzip ` , ` bash `
81105
82- kubectl get pods -n opendatahub
106+ Example workflow:
107+ ``` bash
108+ # Verify connection
83109oc get dsci
84110
85- rhai-cli lint --target-version 3.3.0
111+ # Run lint command
112+ odh-cli lint --target-version 3.3.0
113+
114+ # Example: Run upgrade helper script
115+ cd /opt/rhai-upgrade-helpers
116+ ./ray/ray_cluster_migration.py backup
86117```
87118
88- The ` rhai-cli ` binary is located at ` /opt/rhai-cli/bin/rhai-cli ` (already on ` PATH ` ).
89- Upgrade helper scripts are located at ` /opt/rhai-upgrade-helpers ` .
119+ ** Using Upgrade Helper Scripts:**
90120
91- ** Token Authentication: **
121+ The lint command identifies upgrade issues and provides remediation steps that reference upgrade helper scripts. Follow this workflow:
92122
93- For environments where you have a token and server URL instead of a kubeconfig file:
123+ ** Step 1: Run lint to identify issues**
124+ ``` bash
125+ $CONTAINER_TOOL run --rm -ti \
126+ -v ~ /.kube/config:/kubeconfig \
127+ quay.io/rhoai/odh-cli-rhel9:dev lint --target-version 3.3.0
128+ ```
94129
95- ** Podman:**
130+ ** Step 2: Review remediation guidance**
131+
132+ Lint output shows which helper scripts to run:
133+ ```
134+ CHECK: Ray workloads migration
135+ REMEDIATION: Run ray_cluster_migration.py from rhoai-upgrade-helpers repository
136+ ```
137+
138+ ** Step 3: Run helper scripts in shell mode**
139+
140+ Shell into the container with backup directory mounted:
96141``` bash
97- podman run --rm -ti \
98- quay.io/rhoai/rhoai-upgrade-helpers-rhel9:dev \
99- lint \
100- --target-version 3.3.0 \
101- --token=sha256~xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
102- --server=https://api.my-cluster.p3.openshiftapps.com:6443
142+ $CONTAINER_TOOL run -it --rm \
143+ -v ~ /.kube/config:/kubeconfig:Z \
144+ -v ./backup:/tmp/rhoai-upgrade-backup:Z \
145+ --entrypoint /bin/bash quay.io/rhoai/odh-cli-rhel9:dev
146+
147+ # Inside container - run the recommended script
148+ cd /opt/rhai-upgrade-helpers
149+ ./ray/ray_cluster_migration.py backup
150+ ./trustyai/backup-metrics.sh
103151```
104152
105- ** Docker:**
153+ Scripts write backups to ` /tmp/rhoai-upgrade-backup/<component>/ ` which persists to ` ./backup/ ` on your localhost via the volume mount.
154+
155+ ** Token Authentication:**
156+
157+ For environments with token and server URL (no kubeconfig file):
158+
106159``` bash
107- docker run --rm -ti \
108- quay.io/rhoai/rhoai-upgrade-helpers-rhel9:dev \
109- lint \
110- --target-version 3.3.0 \
160+ $CONTAINER_TOOL run --rm -ti \
161+ quay.io/rhoai/odh-cli-rhel9:dev \
162+ lint --target-version 3.3.0 \
111163 --token=sha256~xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
112164 --server=https://api.my-cluster.p3.openshiftapps.com:6443
113165```
@@ -120,4 +172,3 @@ For detailed documentation, see:
120172- [ Development Guide] ( docs/development.md )
121173- [ Lint Architecture] ( docs/lint/architecture.md )
122174- [ Writing Lint Checks] ( docs/lint/writing-checks.md )
123-
0 commit comments