Skip to content

Commit b14a656

Browse files
committed
fixed boostrap network
1 parent 21014c8 commit b14a656

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

vagrant-bash/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Kubernetes cluster
2+
- Vagrant
3+
- Centos/7
4+
- Bash

vagrant-bash/Vagrantfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,18 @@ Vagrant.configure(2) do |config|
2525

2626
# Kubernetes Worker Nodes
2727
(1..WorkerNodeCount).each do |i|
28-
config.vm.define "k8s-worker#{i}" do |worker|
28+
config.vm.define "k8s-worker-#{i}" do |worker|
2929
worker.vm.box = "centos/7"
30-
worker.vm.hostname = "k8s-worker#{i}.xvitcoder.com"
30+
worker.vm.hostname = "k8s-worker-#{i}.xvitcoder.com"
3131
worker.vm.network "private_network", ip: "172.42.42.10#{i}"
3232
worker.vm.provider "virtualbox" do |v|
33-
v.name = "k8s-worker#{i}"
33+
v.name = "k8s-worker-#{i}"
3434
v.memory = 1024
3535
v.cpus = 1
3636
# Prevent VirtualBox from interfering with host audio stack
3737
v.customize ["modifyvm", :id, "--audio", "none"]
3838
end
39+
worker.vm.provision "shell", path: "bootstrap.sh"
3940
worker.vm.provision "shell", path: "bootstrap-k8s-worker.sh"
4041
end
4142
end

vagrant-bash/bootstrap-k8s-nfs.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# Update hosts file
44
echo "[TASK 1] Update /etc/hosts file"
55
cat >>/etc/hosts<<EOF
6-
172.42.42.100 k8s-master.xvitcoder.com k8s-master
7-
172.42.42.101 k8s-worker1.xvitcoder.com k8s-worker1
8-
172.42.42.102 k8s-worker2.xvitcoder.com k8s-worker2
9-
172.42.42.10 k8s-nfs.xvitcoder.com k8s-nfs
6+
172.42.42.100 k8s-master.xvitcoder.com k8s-master
7+
172.42.42.101 k8s-worker-1.xvitcoder.com k8s-worker-1
8+
172.42.42.102 k8s-worker-2.xvitcoder.com k8s-worker-2
9+
172.42.42.10 k8s-nfs.xvitcoder.com k8s-nfs
1010
EOF
1111

1212
# Install NFS utils
@@ -15,8 +15,8 @@ apt install -y nfs-utils > /dev/null 2>&1
1515

1616
echo "[TASK 4] Create export share"
1717
mkdir -p /srv/nfs/kubedata
18-
chown nobody:nogroup /srv/nfs/kubedata
19-
chmod 777 /srv/nfs/kubedata
18+
chown nfsnobody:nfsnobody /srv/nfs/kubedata
19+
chmod 755 /srv/nfs/kubedata
2020
echo "/srv/nfs/kubedata *(rw,no_subtree_check,no_root_squash,no_all_squash,insecure,sync)" >> /etc/exports
2121
exportfs -rav
2222

vagrant-bash/bootstrap.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
# Update hosts file
44
echo "[TASK 1] Update /etc/hosts file"
55
cat >>/etc/hosts<<EOF
6-
172.42.42.100 k8s-master.example.com k8s-master
7-
172.42.42.101 k8s-worker1.example.com k8s-worker1
8-
172.42.42.102 k8s-worker2.example.com k8s-worker2
6+
172.42.42.100 k8s-master.xvitcoder.com k8s-master
7+
172.42.42.101 k8s-worker-1.xvitcoder.com k8s-worker-1
8+
172.42.42.102 k8s-worker-2.xvitcoder.com k8s-worker-2
9+
172.42.42.10 k8s-nfs.xvitcoder.com k8s-nfs
910
EOF
1011

1112
# Install docker from Docker-ce repository

0 commit comments

Comments
 (0)