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.
In this tutorial, you will learn how to use web kubectl to operate on and manage cluster resources.
Use Web Kubectl
- Log in KubeSphere with an account granted the
platform-adminrole, hover over the Toolbox in the lower right corner and select Kubectl.
- 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.
- 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
- Use the following syntax to run kubectl commands from your terminal window:
kubectl [command] [TYPE] [NAME] [flags]
command: Specifies the operation that you want to perform on one or more resources, such as
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
--serverflags to specify the address and port of the Kubernetes API server.
- If you need help, run
kubectl helpfrom the terminal window or refer to the Kubernetes kubectl CLI documentation.