Cloud Shell is a browser-based command-line tool that assigns a Linux virtual machine to users at no cost, pre-installed with a variety of tools, environments, and the Web IDE provided by Cloud Shell. When you open Cloud Shell from the Container Compute Service (ACS) console, it automatically loads the kubeconfig file for the selected cluster. kubectl is available without any additional setup.
Prerequisites
Before you begin, ensure that you have:
-
Public network access enabled on the target cluster's API server. Cloud Shell only supports public network connections to clusters. For instructions, see Control public access to the API server of a cluster.
Open Cloud Shell and connect to the cluster
-
Log on to the ACS console. In the left navigation pane, click Clusters.
-
On the Clusters page, find the target cluster. In the Actions column, choose More > Open Cloud Shell. Cloud Shell opens in your browser with kubectl already configured for the cluster.
-
(Optional) To persist files across sessions, click
and then click Mount File Storage. By default, Cloud Shell runs as an ephemeral session: all files are deleted when the session ends. Mounting a NAS file system keeps your scripts and files available in future sessions. Select Create And Attach or Do Not Create For Now based on your needs. -
Run the following command to verify that kubectl can reach the cluster:
kubectl get namespaceExpected output:
NAME STATUS AGE default Active 3h14m kube-node-lease Active 3h14m kube-public Active 3h14m kube-system Active 3h14mAll four namespaces in
Activestatus confirm that kubectl is connected to the cluster.