Pre-General Availability: 2026-03-13

B Connect to Oracle Kubernetes Engine

You can use the OCI command line interface (CLI) to access an Oracle Kubernetes Engine (OKE) cluster.

The following instructions assume that a kubeconfig file is already available.
  1. Install the OCI CLI.
    • On Linux or macOS, enter the following command:
      bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh
    • On Microsoft Windows, use the .msi installer linked to from Installing the CLI.
    For more information about the OCI CLI, see Working with the CLI.
  2. Install kubectl.
    • On macOS, enter the following homebrew command.
      brew install kubectl
    • On Linux, enter the following curl command:
      VERSION=(curl−L−shttps://dl.k8s.io/release/stable.txt)curl−LO"https://dl.k8s.io/release/{VERSION}/bin/linux/amd64/kubectl"; chmod +x kubectl && sudo mv kubectl /usr/local/bin/
    • On Microsoft Windows, use the following Chocolatey command.
      choco install kubernetes-cli
    For more information about installing kubectl, see Install Tools in the Kubernetes documentation.
  3. Enter the following command to configure your OCI CLI credentials.
    oci setup config
    Provide the following information to the command.
    • The tenancy OCID
    • Your user OCID
    • The region (for example, ap-mumbai-1)
    • Your API key (fingerprint/private key path)
    To get a new API key, enter the following command, and then select Identity & Security, and then Users, and then Your User Account, and then API Keys to upload the public key to the console.
    oci setup keys
  4. Add the kubeconfig file to the default path, so that it is accessible by kubectl.
    • On macOS and Linux, add the kubeconfig file to the following directory.
      ~/.kube/config
    • On Microsoft Windows, add the kubeconfig file to the following directory.
      %USERPROFILE%.kube\config
  5. Generate the kubeconfig file for the Kubernetes cluster.
    1. From the cluster page in OCI, select Actions, and then Access cluster. The Access cluster window is displayed.
    2. Select Local access.
    3. Select Copy for Public endpoint access command.
    4. Run the copied command to generate the kubeconfig file.
  6. Run the following commands to validate connectivity to the cluster.
    kubectl cluster-info
    kubectl get nodes -o wide
    kubectl get ns
    Private endpoint clusters require network access to the virtual cloud network (VCN). Public endpoint clusters require internet connectivity to the API server endpoint.
  7. If you use multiple OCI profiles, set the following environment variable.
    • Linux and macOS: export OCI_CLI_PROFILE=
    • Microsoft Windows: $env:OCI_CLI_PROFILE=""
If kubectl returns a 401 or 403 error, verify that your identity and access management (IAM) policies allow you to use and manage a cluster family in the compartment, and that your kubeconfig file was generated for the correct cluster and region.

To scale your OKE cluster, complete the following steps.

  1. In the OCI console, select your OKE cluster and then select Node pools.
  2. Select the node pool that you want to scale.
  3. From the Actions menu, select Edit. The Edit node pool page is displayed.
  4. Make changes as needed to the node count or node shape. To change the node shape (which affects the number of OCPUs and the amount of memory), select Change shape.
  5. Select Update to confirm your changes.
  6. From the Actions menu, select Cycle nodes to apply the updated configuration. The Cycle nodes page is displayed.
  7. Under Cycling options, select Replace nodes. Enter numbers for Maximum surge and Maximum unavailable, then select Cycle nodes. When the state of the node pool is updated to Active, the scaling is complete.

Alternately, if you installed by deploying a stack, you can click Destroy to delete your current stack in the OCI console. and then select Edit, and then Edit stack to edit the stack definition to change the node count or node shape as needed. Select Run apply and Save changes to create a stack that uses the new parameters.