Toolbox

Web Kubectl

The Kubernetes command-line tool, kubectl, allows you to run commands on Kubernetes clusters. You can use kubectl to deploy applications, inspect and manage cluster resources, and view logs.

KubeSphere provides web kubectl on the console for user convenience. By default, in the current version, only the account granted the platform-admin role (such as the default account admin) has the permission to use web kubectl for cluster resource operation and management.

Objective

In this tutorial, you will learn how to use web kubectl to operate on and manage cluster resources.

Use Web Kubectl

  1. Log in KubeSphere with an account granted the platform-admin role, hover over the Toolbox in the lower right corner and select Kubectl.

web-kubectl-enter

  1. You can see the kubectl interface as shown in the pop-up window. If you have enabled the multi-cluster feature, you need to select the target cluster first from the drop-down list in the upper right corner. This drop-down list is not visible if the multi-cluster feature is not enabled.

web-kubectl-cluster-select

  1. Enter kubectl commands in the command-line tool to query and manage Kubernetes cluster resources. For example, execute the following command to query the status of all PVCs in the cluster.
kubectl get pvc --all-namespaces

web-kubectl-example

  1. Use the following syntax to run kubectl commands from your terminal window:
kubectl [command] [TYPE] [NAME] [flags]

Note

  • Where command, TYPE, NAME, and flags are:
    • command: Specifies the operation that you want to perform on one or more resources, such as create, get, describe and delete.
    • TYPE: Specifies the resource type. Resource types are case-insensitive and you can specify the singular, plural, or abbreviated forms.
    • NAME: Specifies the name of the resource. Names are case-sensitive. If the name is omitted, details for all resources are displayed, such as kubectl get pods.
    • flags: Specifies optional flags. For example, you can use the -s or --server flags to specify the address and port of the Kubernetes API server.
  • If you need help, run kubectl help from the terminal window or refer to the Kubernetes kubectl CLI documentation.
What’s on this Page