Skip to Content

Install the Kubernetes Command Line Tool

Download and install kubectl - the Kubernetes command line tool that allows access to SAP BTP, Kyma runtime.
You will learn
  • How to download kubectl - the Kubernetes command line tool
  • How to install the plugin kubectl oidc-login and use it to connect to a SAP BTP, Kyma runtime instance
  • How to use a few basic kubectl commands
grego952Grzegorz KaraluchAugust 7, 2024
Created by
grego952
May 8, 2024
Contributors
grego952

Prerequisites

SAP BTP, Kyma runtime provides a managed Kubernetes cluster in which you can install the Kyma modules. To manage resources and configurations from the command line, you can use the kubectl tool. This tutorial provides the steps necessary to configure the tool to access SAP BTP, Kyma runtime. In subsequent tutorials, you will learn various commands provided by kubectl.

  • Step 1
    1. Download the latest kubectl version from the Kubernetes website. Use the following URL:

      https://kubernetes.io/docs/tasks/tools/install-kubectl

    2. On the Kubernetes website, follow the instructions listed for your operating system, for example: Install kubectl on macOS.

  • Step 2

    The use of the kubectl command line tool requires an authenticated user to perform any tasks on SAP BTP, Kyma runtime. SAP BTP, Kyma runtime is configured to use OpenID Connect (OIDC) authentication and requires the installation of the plugin kubectl oidc-login to perform the authentication.

    1. To install kubectl oidc-login, follow the instructions detailed in the project repository. Use the relevant commands for macOS, Linux, or Windows users.

      The kubectl oidc-login runs on port 8000. In case of issues, make sure the port is not occupied.

  • Step 3
    1. Open a command prompt on your computer.

      On Windows, you can search for the cmd or command prompt applications in the Start menu.

      On macOS, use Spotlight to find the Terminal application.

      On Linux/Unix, you know how this works - just open your favorite command shell.

    2. To verify that kubectl is installed correctly, run the following command in your CLI:

      Shell/Bash
      Copy
      kubectl version --client
      

      The command should return a list of version properties, for example:

      Shell/Bash
      Copy
      Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.2",GitCommit:"8b5a19147530eaac9476b0ab82980b4088bbc1b2", GitTreeState:"clean",BuildDate:"2021-09-15T21:31:32Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"darwin/amd64"}
      

    Enter the code to get the kubectl command line tool version.

  • Step 4

    The kubectl tool relies on a configuration file called kubeconfig to configure access to the cluster. Follow the instructions to learn how to obtain it from both SAP BTP cockpit and Kyma dashboard.

    To obtain kubeconfig from SAP BTP cockpit:

    1. Within your SAP BTP account, navigate to the sub-account with SAP BTP, Kyma runtime enabled.

    2. In the Overview section, scroll down to the Kyma Environment details.

    3. Choose the link next to KubeconfigURL to download the kubeconfig file.

      kubeconfig

    To obtain kubeconfig from Kyma dashboard:

    1. Navigate to Kyma dashboard of your SAP BTP, Kyma runtime.

    2. Log into SAP BTP, Kyma runtime.

    3. At the top of the SAP BTP, Kyma runtime window you will find a dropdown which displays the name of the currently connected runtime. Select the dropdown and choose Clusters Overview.

    4. Choose the download icon to download the file.

  • Step 5

    For more information on kubectl, visit the Kubernetes command line tool overview and kubectl commands websites.


    What is the kubeconfig file used for?

Back to top