How to launch kubernetes cluster using vagrant?

3/7/2019

I am using Vagrant to a build Kubernetes cluster with one master and two nodes. Every time I run kubectl get nodes after switching my computer off and on again, I get the following error message:

Unable to connect to the server: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "kubernetes")

-- Aymen
cluster-computing
kubernetes
vagrant

2 Answers

3/8/2019

you just need to enter that command:

sudo cp /etc/kubernetes/admin.conf $HOME/
sudo chown $(id -u):$(id -g) $HOME/admin.conf
export KUBECONFIG=$HOME/admin.conf

its working for me.

-- Aymen
Source: StackOverflow

3/7/2019

I'm not sure how you did setup the kubernetes cluster. If you want to use vagrant you can use the setup here. This sets up one masternode and two slaves nodes.

Once the vagrant upcommand is complete, do vagrant ssh k8s-head and do kubectl get nodes.

You will get the list of slaves nodes.

Hope this helps.

-- Rajkumar Natarajan
Source: StackOverflow