Yeey! I just got access to Digital Ocean Kubernetes service (still on a limited offer) so my minons there need to get busy now!
5$ for a k8s is the cheapest offer I have seen so far. The first problem I run into was how to smoothly run kubectl commands and aslo easily move from one k8s context to another.
DigitalOcean documentation suggest to pass argument to the config file on each command
So instead of
So what is going on?
If you used GKE or AKS, they will let you use a cli command to set the cluster and context into your local Kubectl client config (stored at $HOME/.kube/config). Other providers might not have a nice tool that does that so they might give you a config in form of a downloadable yaml instead such as DigitalOcean.
As per kubectl Cheat Sheet, you can run the following command to sort of merge the configurations of many files in different locations in your system. All it does is to save an environment variable has a list of paths to these config files:
$env:KUBECONFIG ="$HOME\.kube\config; path\to\your\config\yalm\file "
Notice that for windows we separate paths using semicolons
Now when you run kubectl config view you will see a merged view for all your config files. So, you can run kubectl config use-context on any of the listed contexts.
Now if you open another shell, you will lose your changes. On windows PowerShell, in order to persist the change you made on windows, you need to store the file permanently to your system environment variables:
[Environment]::SetEnvironmentVariable("KUBECONFIG", "$HOME\.kube\config;$HOME\.kube\do-api-yeelo-kubeconfig.yaml", "Machine")
Please note that frequestly these tokens get expired so you will need to donwload the config file from DO again and save it in the same name and location.