<p>Use this guide to install Kubernetes on Vagrant cluster:</p>

<p><a href="https://kubernetes.io/docs/getting-started-guides/kubeadm/" rel="noreferrer">https://kubernetes.io/docs/getting-started-guides/kubeadm/</a></p>

<p>At <code>(2/4) Initializing your master</code>, there came some errors:</p>

<pre><code>[root@localhost ~]# kubeadm init
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[init] Using Kubernetes version: v1.6.4
[init] Using Authorization mode: RBAC
[preflight] Running pre-flight checks
[preflight] Some fatal errors occurred:
    /proc/sys/net/bridge/bridge-nf-call-iptables contents are not set to 1
[preflight] If you know what you are doing, you can skip pre-flight checks with `--skip-preflight-checks`
</code></pre>

<p>I checked the <code>/proc/sys/net/bridge/bridge-nf-call-iptables</code> file content, there is only one <code>0</code> in it.</p>

<p>At <code>(3/4) Installing a pod network</code>, I downloaded <code>kube-flannel</code> file:</p>

<p><a href="https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml" rel="noreferrer">https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml</a></p>

<p>And run <code>kubectl apply -f kube-flannel.yml</code>, got error:</p>

<pre><code>[root@localhost ~]# kubectl apply -f kube-flannel.yml
The connection to the server localhost:8080 was refused - did you specify the right host or port?
</code></pre>

<p>Until here, I don't know how to goon.</p>

<p>My <code>Vagrantfile</code>:</p>

<pre><code>  # Master Server
  config.vm.define "master", primary: true do |master|
    master.vm.network :private_network, ip: "192.168.33.200"
    master.vm.network :forwarded_port, guest: 22, host: 1234, id: 'ssh'
  end
</code></pre>

<p>In order to set <code>/proc/sys/net/bridge/bridge-nf-call-iptables</code> by editing <code>/etc/sysctl.conf</code>. There you can add [1]</p>

<pre><code>net.bridge.bridge-nf-call-iptables = 1
</code></pre>

<p>Then execute </p>

<pre><code>sudo sysctl -p
</code></pre>

<p>And the changes will be applied. With this the pre-flight check should pass.</p>

<hr>

<p>[1]  <a href="http://wiki.libvirt.org/page/Net.bridge.bridge-nf-call_and_sysctl.conf" rel="noreferrer">http://wiki.libvirt.org/page/Net.bridge.bridge-nf-call_and_sysctl.conf</a></p>
