3

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?

cclloyd
  • 8,171
  • 16
  • 57
  • 104

1 Answers1

4

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.

aurelius
  • 3,433
  • 1
  • 13
  • 22
  • I made sure to run those commands, and when I tried running it again I made sure to remove the entire `.kube` directory before reinitializing. – cclloyd Nov 02 '18 at 23:32
  • interesting, could you please try if `sudo kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml` works? – aurelius Nov 03 '18 at 08:25
  • i should only install cni in master node rit?? – AATHITH RAJENDRAN May 28 '19 at 08:44
  • yes, you install CNI on master node. The CNI will be a deamonset which then will make sure there is a flannel pod on each node. – aurelius Jul 30 '19 at 12:18