使用此指南在Vagrant集群上安装Kubernetes:

https://kubernetes.io/docs/getting-started-guides/kubeadm/

(2/4) Initializing your master处,出现一些错误:

[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`

我检查了/proc/sys/net/bridge/bridge-nf-call-iptables文件的内容,其中只有一个0

(3/4) Installing a pod network,我下载了kube-flannel文件:

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

并运行kubectl apply -f kube-flannel.yml,出现错误:
[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?

直到这里,我都不知道该怎么做。

我的Vagrantfile:
  # 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

最佳答案

为了通过编辑/proc/sys/net/bridge/bridge-nf-call-iptables设置/etc/sysctl.conf。在那里您可以添加[1]

net.bridge.bridge-nf-call-iptables = 1

然后执行
sudo sysctl -p

并应用更改。这样,飞行前检查就可以通过了。

[1] http://wiki.libvirt.org/page/Net.bridge.bridge-nf-call_and_sysctl.conf

关于docker - 无法在Vagrant上安装Kubernetes,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/44125020/

10-12 01:04