无法在 Vagrant 上安装 Kubernetes

2024-01-01

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

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

At (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 in it.

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

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

And run 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?

直到这里,我还不知道如何继续。

My 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 http://wiki.libvirt.org/page/Net.bridge.bridge-nf-call_and_sysctl.conf

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法在 Vagrant 上安装 Kubernetes 的相关文章

随机推荐