You can run kubectl from the host WITHOUT moving the kubeconfig from the vagrant guest machine to the host:

# vagrant ssh -- <your-command-line>
vargrant ssh -- kubectl version
vagrant ssh -- kubectl get nodes
vagrant ssh -- kubectl create -f /vagrant/some-app.yaml
# so on...

Do you like it? You will like the next tips more

alias k='vagrant ssh -- kubectl'

By now, the following command will run smoothly:

k get nodes

Forgot to mention that you need to add the following config to your Vagrantfile

config.vm.synced_folder ".", "/vagrant"

Written by

Software engineer, Cloud Architect, 5/5 AWS|GCP|PSM Certified, Owner of

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store