Skip to content

Access the Wok platform via the CLI

The Openshift/OKD Command Line Interface (CLI) may be used to access a WoK cluster API and interact with the cluster resources.

The CLI is invoked, and also referred to, as oc. It includes most (if not all) of the features of the Kubernetes CLI (ie. kubectl) and oc may be used instead of kubectl in most situations even if OKD clusters are specific types of Kubernetes clusters that may react differently than expected from the reading of Vanilla Kubernetes documentation.

Getting the CLI

Using the CC-IN2P3 interactive machines

The OKD CLI is available on CC-IN2P3 interactive machines (both access cca* and development ccdevli* nodes):

$ module view openshift
--------- /pbs/software/centos-7-x86_64/modules/modulefiles ---------------------------------------
Containers/openshift-origin/
3.11.0 4.12.0 latest 

$ module load Containers/openshift-origin/latest
$ oc version
Client Version: 4.12.0-0.okd-2023-04-16-041331
Kustomize Version: v4.5.7
error: You must be logged in to the server (Unauthorized)

The last error is expected, since we did not connect to a cluster yet.

Tip

You would generally use the latest version of the CLI, unless you know better.

To automatically load the oc CLI on login, use the following modules configuration:

$ cat $HOME/.module/default
module use --append /etc/modulefiles
module use --append /pbs/software/centos-7-x86_64/modules/modulefiles
module load Containers/openshift-origin/latest

Note

Available releases of the OKD CLI on CC-IN2P3 interactive machines are ensured to be compatible with WoK clusters._

Getting the CLI on your machine

The oc binary is available from various places.
However, it is recommended to get it from the official Github repository.

You can also get it using the asdf CLI management tool on Linux:

$ asdf plugin-add oc
$ asdf install oc stable-4.12
$ asdf global oc stable-4.12
$ oc version
$ oc version
Client Version: 4.12.19
Kustomize Version: v4.5.7
error: You must be logged in to the server (Unauthorized)

The last error is expected, since we did not connect to a cluster yet.

Warning

Make sure to use the release number of the OKD CLI that matches the release of the WoK cluster you're about to access._

Accessing

Several clusters are available on the WoK platform.
They are dedicated to specific uses and are listed in the Clusters list page.

WoK clusters are accessible throught the CC-IN2P3 authentication platform.
It is only accessible to users with a valid CC-IN2P3 account and that were granted access to the platform.
If you need to access the WoK platform, you may send a ticket on the support desk.

Get the CLI

You can get the CLI from the official Github releases or use ASDF.

Using ASDF

  1. Get ASDF and follow the quick-start guide in order to install and configure the tool.
  2. Setup the oc plugin for asdf:

    $ asdf plugin add oc
    $ asdf install oc stable-4.14
    $ asdf global oc stable-4.14
    $ oc version
    Client Version: 4.14.29
    Kustomize Version: v5.0.1
    

You know have a CLI to work with the WoK clusters.
Adapt the version of the CLI as needed.

Log into a cluster

To log into a cluster, use the oc login command:

$ oc login https://api.wok3.in2p3.fr:6443 -u jdoe
Authentication required for https://api.wok3.in2p3.fr:6443 (openshift)
Console URL: https://api.wok3.in2p3.fr:6443/console
Username: jdoe
Password:
Login successful.

You have access to 131 project, the list has been suppressed. You can list all projects with 'oc projects'

Using project "default".

Where jdoe is your user account name at CC-IN2P3.