Skip to content

Commit

Permalink
Merge pull request opsnull#111 from kairen/master
Browse files Browse the repository at this point in the history
添加 vagrantfile 来帮助创建机器
  • Loading branch information
opsnull authored Aug 9, 2017
2 parents 907e95f + 8abaeb8 commit bdc6b75
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 3 deletions.
7 changes: 6 additions & 1 deletion 01-组件版本和集群环境.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ tags: kubernetes, environment
+ 10.66.3.86

本着测试的目的,etcd 集群、kubernetes master 集群、kubernetes node 均使用这三台机器。
> 若有安装 Vagrant 与 Virtualbox,这三台机器可以用本着提供的 Vagrantfile 来建置:
``` bash
$ cd vagrant
$ vagrant up
```

## 集群环境变量

Expand Down Expand Up @@ -68,4 +73,4 @@ CLUSTER_DNS_DOMAIN="cluster.local."
``` bash
$ cp environment.sh /root/local/bin
$
```
```
4 changes: 2 additions & 2 deletions 05-部署Flannel网络.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ EOF
```

+ mk-docker-opts.sh 脚本将分配给 flanneld 的 Pod 子网网段信息写入到 `/run/flannel/docker` 文件中,后续 docker 启动时使用这个文件中参数值设置 docker0 网桥;
+ flanneld 使用系统缺省路由所在的接口和其它节点通信,对于有多个网络接口的机器(如,内网和公网),可以用 `-iface` 选项值指定通信接口(上面的 systemd unit 文件没指定这个选项);
+ flanneld 使用系统缺省路由所在的接口和其它节点通信,对于有多个网络接口的机器(如,内网和公网),可以用 `--iface` 选项值指定通信接口(上面的 systemd unit 文件没指定这个选项),如本着 Vagrant + Virtualbox,就要指定`--iface=enp0s8`

完整 unit 见 [flanneld.service](https://github.com/opsnull/follow-me-install-kubernetes-cluster/blob/master/systemd/flanneld.service)

Expand Down Expand Up @@ -196,4 +196,4 @@ $ ping 172.30.19.1
$ ping 172.30.20.2
$ ping 172.30.21.3
$
```
```
34 changes: 34 additions & 0 deletions vagrant/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Vagrant.require_version ">= 1.7.0"

$os_image = (ENV['OS_IMAGE'] || "ubuntu16").to_sym

Vagrant.configure("2") do |config|
config.vm.provider "virtualbox"

def set_vbox(vb, config)
vb.gui = false
vb.memory = 2048
vb.cpus = 2

case $os_image
when :centos7
config.vm.box = "bento/centos-7.3"
when :ubuntu16
config.vm.box = "bento/ubuntu-16.04"
end
end

ips = ["10.64.3.7", "10.64.3.8", "10.64.3.86"]
(0..2).each do |id|
mid = id + 1
config.vm.define "kube-node#{mid}" do |node|
node.vm.hostname = "kube-node#{mid}"
node.vm.network :private_network, ip: "#{ips[id]}", auto_config: true

node.vm.provider :virtualbox do |vb, override|
vb.name = "kube-node#{mid}"
set_vbox(vb, override)
end
end
end
end

0 comments on commit bdc6b75

Please sign in to comment.