This document describes how to connect a local client to an edge cluster through kubectl, which is the Kubernetes command-line tool.
Replace
v1.8.13
in the command with the kubectl version required by your business.
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.13/bin/darwin/amd64/kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.13/bin/linux/amd64/kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.8.13/bin/windows/amd64/kubectl.exe
- If you have already installed kubectl, skip this step.
- This step uses the Linux operating system as an example.
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl version
If the output is similar to the following version information, the installation was successful.Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"08e099554f3c31f6e6f07b448ab3ed78d0520507", GitTreeState:"clean", BuildDate:"2017-01-12T04:57:25Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
You can save the cluster access credential locally by clicking Copy or Download as needed.
The kubectl command format is as follows:
--kubeconfig=<Local cluster access credential>
Run the following command to view existing namespaces under the cluster.
kubectl get namespace --kubeconfig=cls-8ipgf8u4.kubeconfig
The cluster credential used in this example is cls-8ipgf8u4.kubeconfig
. In real-life cases, replace it with the actual credential.
If a message similar to the following is returned, the request was successful.
NAME STATUS AGE
default Active 11d
kube-system Active 11d
You can configure kubectl autocomplete to improve usability by running the following command.
source <(kubectl completion bash)
Was this page helpful?