Accessing your IBM® Cloud private cluster by using the kubectl CLI

To access your cluster by using the command line interface (CLI), you must install and configure kubectl, the Kubernetes command line tool.

  1. Install the Kubernetes command line interface kubectl version 1.6.1. You can obtain the kubectl binary file from the IBM® Cloud private installer or download a new installation file.

    • To use the binary file from the IBM® Cloud private installer for Linux™ 64-bit, run this command:

        docker run -e LICENSE=accept --net=host -v /usr/local/bin:/data ibmcom/kubernetes:v1.6.1-ee cp /kubectl /data
      
    • To use the binary file from the IBM® Cloud private installer for Linux™ on Power® 64-bit LE, run this command:

        docker run -e LICENSE=accept --net=host -v /usr/local/bin:/data ppc64le/kubernetes:v1.6.1-ee cp /kubectl /data
      
    • To download and install a new binary file, see Install and Set Up kubectl.

  2. Log in to your cluster management console. See Accessing your IBM® Cloud private cluster by using the management console.

  3. Select User Name > Configure Client, which is in the upper right of the window. The cluster configuration details display, as shown in the following code:

     kubectl config set-cluster
     cfc --server=https://master_ip:8001 --insecure-skip-tls-verify=true
    
     kubectl config set-context cfc --cluster=cfc
    
     kubectl config set-credentials user --token={token}
    
     kubectl config set-context cfc --user=user
    
     kubectl config use-context cfc
    

    In these details, master_ip is the IP address of the master node for your IBM® Cloud private cluster.

  4. Copy and paste the configuration information to your command line, and press Enter.

    Note: This configuration expires in 12 hours. To continue to use the CLI, you must log in and reconfigure kubectl every 12 hours. To avoid this limitation, you can configure your CLI by using service accounts. See https://www.ibm.com/developerworks/community/blogs/fe25b4ef-ea6a-4d86-a629-6f87ccf4649e/entry/Configuring_the_Kubernetes_CLI_by_using_service_account_tokens1.