Skip to main contentCloud-Native Toolkit

IBM Cloud cluster fast-switching (icc) tool

Easily log in to an IBM Cloud account and cluster

The ICC command-line tool makes it easy to log into an IBM Cloud account and a cluster in that account. It is the equivalent of running this for Kubernetes:

ibmcloud login <a whole bunch of paratemers>
ibmcloud ks cluster <some more parameters>

or this for OpenShift:

ibmcloud login <a whole bunch of paratemers>
oc login <some more parameters>

If you have multiple clusters, especially in multiple accounts, ICC makes it easy to switch your command line between clusters. All ICC requires is your API key for each account.

Install ICC

To install ICC, perform Developer Tools Setup to install all of the CLIs including ICC.

Install yq

ICC (currently) requires yq, and it has to be v3 (v4 doesn’t have the commands ICC needs). Check to see if yq is currently installed and if it’s version 3:

$ which yq
/usr/local/bin/yq
$ yq -V
yq version 3.3.2

If you don’t have yq installed, follow either of these instructions:

ICC help

Once ICC (and yq) is installed, you can view help for how to use it:

icc --help
Usage: icc [nickname] [--account {ACCOUNT_FILTER}] [--resourceGroup {RG_FILTER}] [--generate [{ACCOUNT_FILTER}]] [--nickname [{cluster name}]]
Logs into an IBM Cloud cluster
Modes:
cluster login - icc {nickname}
print config - icc [--account {account name}] [--resourceGroup {resourceGroupName}]
generate config - icc --generate [{account name}]

Configure ICC

Once ICC is installed, before you can use it, you need to set it up:

  1. Get your API key for your IBM Cloud account. If you don’t have one, then create an API key. Remember, your API key is uniquely for you, so keep it secret.

  2. Run icc --add-account to add you API key to ICC

    icc --add-account
    Please provide the nickname for the IBM Cloud account: my-account
    Provide the IBM Cloud API Key for the my-account account: <hidden>
    Account information added for my-account
    Next steps:
    - Run '/Users/bwoolf/bin/icc --generate' to generate the cluster config from the account

    This creates the files ~/ibmcloud-account.yaml and ~/ibmcloud.yaml. The first file contains your API keys, so keep it secret.

  3. Get the cluster metadata for the account by running icc --generate

    icc --generate
    Generate config for accounts: my-account
    Logging in to account: my-account
    Processing provider: classic
    Processing provider: vpc-gen2
    Processing provider: satellite
    Config file generated/updated: /Users/bwoolf/ibmcloud.yaml
    Next steps:
  1. List the available clusters with icc

    icc
    my-cluster - my-account/my-resource-group/my-cluster
  2. Optionally, give a short nickname for your cluster by running icc --nickname

    icc --nickname my-cluster
    Provide the new nickname for my-cluster: my-nickname
    Nickname for my-cluster updated to my-nickname in /Users/bwoolf/ibmcloud.yaml
    icc
    my-nickname - my-account/my-resource-group/my-cluster

Use ICC

You can now log in to a cluster by running icc [cluster name|cluster nickname]

icc my-cluster
Logging into ibmcloud: us-south/my-resource-group
Logging into OpenShift cluster my-cluster with server url https://x123-z.us-south.containers.cloud.ibm.com:31047