Multi-node kubernetes cluster on Vagrant in five minutes

Categories: Kubernetes

This is a guide for anyone that wants to setup multi-node kubernetes cluster on PC or laptop without significant amounts of time and money on kubernetes-the-hard-way ;)

This is one of the fastest ways to have multi-node cluster up and running for learning purposes. It will use coreos and vagrant to spin up the cluster.

Time required to finish the tutorial

5 minutes plus 30 minutes of waiting

Final setup

  • one master node
  • one etcd (on separate node)
  • 3 worker nodes
  • Kubernetes 1.7.3
  • Calico Network plugin 2.4.1

Requirements

  • Linux machine ( tested on Linux Mint installed on laptop with 32GB of RAM )
  • newest Vagrant ( tested on 1.9.5 )
  • 10GB of RAM avaialble on your machine ( you can decrease RAM for worker nodes to 1GB, then 8GB might suffice )

Instructions

  • Login to your Linux machine.
  • Clone the repository
```bash git clone https://github.com/mcwienczek/coreos-kubernetes cd coreos-kubernetes/multi-node/vagrant vagrant up ```
  • Get a coffee or two. It requires 15-30 minutes depending on your PC and network speed to download and run all components.

After you're back run commands below from the same directory:

export KUBECONFIG="${KUBECONFIG}:$(pwd)/kubeconfig"
kubectl config use-context vagrant-multi
kubectl get nodes

result should be:

172.17.4.101   NotReady   1m        v1.7.3+coreos.0
172.17.4.201   NotReady   1m        v1.7.3+coreos.0
172.17.4.202   NotReady   1m        v1.7.3+coreos.0
172.17.4.203   NotReady   1m        v1.7.3+coreos.0

If you're still getting connection refused or the result above, go and make another coffee.

Finally you should get:

172.17.4.101   Ready     7m        v1.7.3+coreos.0
172.17.4.201   Ready     7m        v1.7.3+coreos.0
172.17.4.202   Ready     7m        v1.7.3+coreos.0
172.17.4.203   Ready     7m        v1.7.3+coreos.0

To check that everything is ok run:

kubectl get pods -n kube-system

you should see result similar to:

calico-node-192jz                       2/2       Running   0          8m
calico-node-44zlw                       2/2       Running   0          8m
calico-node-6t101                       2/2       Running   0          8m
calico-node-gxbcf                       2/2       Running   0          8m
calico-policy-controller-07g7r          1/1       Running   0          8m
heapster-v1.2.0-2574512118-c3843        2/2       Running   0          5m
kube-apiserver-172.17.4.101             1/1       Running   0          7m
kube-controller-manager-172.17.4.101    1/1       Running   1          8m
kube-dns-2283264574-2zwwt               4/4       Running   0          8m
kube-dns-autoscaler-1527205818-5btbj    1/1       Running   0          8m
kube-proxy-172.17.4.101                 1/1       Running   0          7m
kube-proxy-172.17.4.201                 1/1       Running   0          7m
kube-proxy-172.17.4.202                 1/1       Running   0          6m
kube-proxy-172.17.4.203                 1/1       Running   0          7m
kube-scheduler-172.17.4.101             1/1       Running   0          7m
kubernetes-dashboard-1293281617-dcthb   1/1       Running   0          8m

  • Cluster is working properly! Now you can start playing with it.

Happy Kuberneting!

See also

Share your excitement about this post

comments powered by Disqus