3
votes

I'm following this guide on how to set up a kubernetes swarm.

My swarm will be as follows:

  • 10.0.2.1: swarm1 (master)
  • 10.0.2.2: swarm2 (worker) (currently trying to setup a single node swarm)
  • 10.0.2.3: swarm2 (worker) (not yet provisioned)

I followed it and got up to the part where I enter the command:

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

And once I enter that, I get an error:

unable to recognize "https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml": Get https://10.0.2.1:6443/api?timeout=32s: dial tcp 10.0.2.1:6443: connect: connection refused unable to recognize

Which seems to mean that the kubernetes master isn't running properly. How can I start the server so it can connect?

1

1 Answers

4
votes

This is a not enough privilege error. Either you did not run this:

mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config

Or there is an admin.conf from previous inits. In this case while running second command and seeing cp: overwrite /home/aurelius/.kube/config'? make sure you type yes and press Enter.