How to use kubectl

which container i can attend to use kubectl command to vi yuml files.
I want to use kubectl to create Deployment or other things.
In the http mode. vi command is too difficult to use.

1 Like

You can have kubectl on your local machine, and download the kubeconfig file from the cluster dashboard and place it in ~/.kube/config as instructed on the screen.

2018-05-23%2010_17_14-Rancher

So technically I can only manage one cluster at a time from my local machine, or update the config each time I want to switch to another cluster?

Good question - I didn’t think of that before… and since I will be managing more than one cluster…

Well the YAML has clusters: as an array, so presumably you can put in multiple cluster definitions. Same goes for contexts array and users array.

So, presumably, you can combine multiple configuration into one.

I do believe my config file is correct but I am only able to access one cluster at a time, the last one listed in the config file. This transition which was planned to only take two weeks at most is turning into a lot longer, not too happy with the direction Rancher is headed towards but I remain optimistic.

Kubectl is not rancher… that’s kubernetes. Rancher does not do more than give you configs for kubectl. https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/

Seems like someone is listening…

This may be of help to access multiple cluster: https://github.com/ahmetb/kubectx

I created a light Kubectl container (~45Mb didn’t find equivalent) so that it enables you with many possibilities (multiple config files, running from docker on your sys or directly from K8s Pods, Jobs, CronJobs…): https://hub.docker.com/r/d3fk/kubectl
Hope this helps.