Vagrant file to build Kubernetes 1.9 cluster on Centos 7.4
Clone or download
duffqiu update
Latest commit 98b18af Feb 2, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
.kube init Jan 11, 2018
addon update Jan 22, 2018
node1 add proxy, dns Jan 20, 2018
node2 add proxy, dns Jan 20, 2018
node3 add proxy, dns Jan 20, 2018
pic update arch Jan 23, 2018
pki init Jan 11, 2018
systemd add proxy, dns Jan 20, 2018
yum add yum repo Jan 31, 2018
.gitignore remove unused file Jan 30, 2018 Update Feb 2, 2018
Vagrantfile update Feb 2, 2018
apiserver add http for apiserver Jan 24, 2018
bootstrap.kubeconfig init Jan 11, 2018
config init Jan 11, 2018
controller-manager init Jan 11, 2018
kube-proxy.kubeconfig init Jan 11, 2018
kubelet.kubeconfig miss kubelet.kubeconfig Feb 2, 2018
scheduler init Jan 11, 2018
scheduler.conf init Jan 11, 2018
token.csv init Jan 11, 2018

Vagrant to setup kubernetes cluster

vagrant file to build a kubernets cluster which consists of 1 master and 3 nodes. You don't have to create complicated ca files and dont't have to do a lot of configuration

Why don't do that with kubeadm

Because I want to setup the etcd, apiserver, controller, scheduler without docker container



Cluster network

The default setting will create the private network from to for nodes, and it will use the host's dhcp for the public ip

The kubenetes service's vip range is

The container network range is owned by flanneld with GW mode



  • Host server with 8G+ mem(More is better), 60G disk, 8 core cpu at lease
  • vagrant 2.0+
  • virtualbox 5.0+
  • Maybe need to access the internet through GFW to download the kubernetes files

Support Addon

  • CoreDNS
  • Dashboard with service VIP

Need to modify Vagrantfile as need

You may need to change below line in Vagrantfile according to your host network "public_network", bridge: "en1: Wi-Fi (AirPort)", auto_config: false


git clone

cd centos-vagrant

vagrant up

Connect to kubernetes

via Host (Recommended) You must install kubectl in your mac host first.

mkdir -P ~/.kube
cd centos-vagrant
cp .kube/config ~/.kube/config
kubectl get nodes

via VM

vagrant ssh node1
sudo su
kubectl get nodes

Access dashboard without login

show the dashboard address

kubectl cluster-info

and then access dashboard via https from host

Rebuild the cluster

vagrant destroy
rm -rf .vagrant/


Don't use it in production environment