Oracle Cloud Infrastructure Documentation

Accessing a Cluster Using kubectl

You can use the Kubernetes command line tool kubectl to perform operations on a cluster you've created with Container Engine for Kubernetes. Before you can use kubectl to access a cluster, you need to specify the cluster on which to perform operations by downloading the cluster's kubeconfig file. Note that a Oracle Cloud Infrastructure CLI command in the kubeconfig file generates authentication tokens that are short-lived, cluster-scoped, and specific to individual users. As a result, you cannot share kubeconfig files between users to access Kubernetes clusters.

To access a cluster using kubectl:

  1. If you haven't already done so, install kubectl (see the kubectl documentation).
  2. If you haven't already done so, follow the steps to download the cluster's kubeconfig configuration file and set the KUBECONFIG environment variable to point to the file. Note that you must download your own kubeconfig file. You cannot access a cluster using a kubeconfig file that a different user downloaded. See Downloading a kubeconfig File to Enable Cluster Access.
  3. In a terminal window, enter kubectl followed by the command for the operation you want to perform on the cluster. For a list of available commands and options, see the kubectl documentation.

    Note that you must have the appropriate permissions to run the command you enter. See About Access Control and Container Engine for Kubernetes.