I installed kubectl by using the following commands:
$ sudo apt-get update && sudo apt-get install -y apt-transport-https
$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
$ echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
$ sudo apt-get update && sudo apt-get install -y kubectl
We have created a rancher HA cluster with the help of RKE and moved the configuration file to .kube/config
but can't able to use the kubectl. Please help me on these issue.
While using kubeadm init you should perform those steps in order to use kubectl:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
As per rancher documentation:
"Installing and Configuring kubectl" here,
"Accessing Rancher Launched Kubernetes clusters without Rancher server running" here,
"Accessing Clusters with kubectl and a kubeconfig File" here,
You can try kubectl --kubeconfig <path to your kube_config_cluster.yml> version
where kube_config_rancher-cluster.yml is the file with credentials for kubectl and helm.