instructions to access a cluter using kubectl

This commit is contained in:
Mark Bishop
2018-06-14 17:02:12 -07:00
committed by Mark Bishop
parent 6a28246249
commit 1e58c0e379
@@ -3,11 +3,34 @@ title: Using kubectl to Access a Cluster
weight: 3450
draft: true
---
Rancher provides two ways for you to access your clusters. One is through kubectl shell, another is by setting your own kubeconfig file. Both of them are available in UI.
You can access and manage your Kubernetes clusters using the kubectl shell.
## Using kubectl Shell
Navigate to the **Clusters** page, a list of existing clusters will be shown there. Choose a cluster you want to access to. Click that cluster name will lead you to that cluster's page. As you can see, a **Launch kubectl** button is in the top right corner. Click it for you to access this cluster through kubectl shell.
## Configuring My kubectl
You can also customize kubectl by clicking **Kubeconfig file** button in the top right corner, and then provide your own kubeconfig file.
2. Click **Launch kubectl**.
1. From the **Global** view, open the cluster that you want to access with kubectl.
2. Copy the cluster's kubeconfig file to your workstation.
1. Click **Kubeconfig File**.
2. Copy the contents of the generated file to your clipboard.
3. Paste the contents into a new file on your local computer. Move the file to `~/.kube/config`.
> **Note:** The default location that kubectl uses for the kubeconfig file is `~/.kube/config`, but you can use any condition and specify it using the `--kubeconfig` flag, as in the sample that follows:
>
> ```
kubectl --kubeconfig /custom/path/kube.config get pods
```
## Configuring My `kubectl`
After you open kubectl, direct it toward a kubeconfig file to access and manage one of your Kubernetes clusters. To specify a kubeconfig file, click **Kubeconfig File**, copy the contents to an empty file, and then save it to `~/.kube/config`.
For more information, see:
- [Kubeconfig Files]({{< baseurl >}}/rancher/v2.x/en/concepts/clusters/kubeconfig-files).
- [Kubernetes Documentation: Organizing Cluster Access Using kubeconfig Files](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/)