kubectl is a CLI utility for running commands against Kubernetes clusters. It’s required for many maintenance and administrative tasks in Rancher 2.x.
See kubectl Installation for installation on your operating system.
When you create a Kubernetes cluster with RKE, RKE creates a
kube_config_rancher-cluster.yml in the local directory that contains credentials to connect to your new cluster with tools like
You can copy this file to
$HOME/.kube/config or if you are working with multiple Kubernetes clusters, set the
KUBECONFIG environmental variable to the path of
Test your connectivity with
kubectl and see if you can get the list of nodes back.
kubectl get nodes NAME STATUS ROLES AGE VERSION 18.104.22.168 Ready controlplane,etcd,worker 11m v1.10.1 22.214.171.124 Ready controlplane,etcd,worker 11m v1.10.1 126.96.36.199 Ready controlplane,etcd,worker 11m v1.10.1