jprdonnelly 1cd9d35088 Update Vagrantfile
Still refactoring configureBox.  Moving apt commands around and minimizing thes network dependent steps by combining updates/upgrades when possible.
2019-08-13 00:02:57 -04:00
2018-09-13 18:59:59 -05:00
2018-09-17 07:08:14 -05:00
2019-08-12 10:02:40 -04:00
2018-11-07 08:32:12 -05:00
2019-08-12 10:02:40 -04:00
2019-08-12 10:02:40 -04:00
2019-08-12 10:02:40 -04:00
2019-07-17 13:52:33 -04:00
2018-09-02 17:25:15 -05:00
2019-08-12 10:27:02 -04:00
2019-08-13 00:02:57 -04:00

Kubernetes cluster

A Vagrant script for setting up a barebones Kubernetes cluster with a load-balancer and dynamic provisioner using Kubeadm.

Pre-requisites

Start the Base Cluster

Run the following command using CMD/Powershell in the dir where your Vagrantfile lives.

vagrant up
  • When this command finishes you will have (4) running VMs joined together as a K8s cluster.
  • If more than three worker nodes are required, you can edit the servers array in the Vagrantfile
servers = [
    {
        :name => "k8s-node3",
        :type => "node",
        :box => "ubuntu/bionic64",
        :eth1 => "192.168.205.13",
        :mem => "2048",
        :cpu => "2"
    }
]
  • As you can see above, you can also configure a static IP address, memory and CPU in the servers array.

Check Cluster Health

PS> vagrant ssh k8s-head
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-38-generic x86_64)
 
<snip output>
vagrant@k8s-head:~$ kubectl cluster-info
Kubernetes master is running at https://192.168.205.10:6443
KubeDNS is running at https://192.168.205.10:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
 
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
 
vagrant@k8s-head:~$ kubectl get nodes
NAME        STATUS   ROLES    AGE   VERSION
k8s-head    Ready    master   68m   v1.15.2
k8s-nfs     Ready    <none>   53m   v1.15.2
k8s-node1   Ready    <none>   65m   v1.15.2
k8s-node2   Ready    <none>   61m   v1.15.2

Install NFS Provisioner

vagrant@k8s-head:~$ kubectl label nodes k8s-nfs role=nfs
node/k8s-nfs labeled
 
vagrant@k8s-head:~$ kubectl apply -f https://raw.githubusercontent.com/jprdonnelly/kubernetes-cluster/master/nfs-provisioner/nfs-deployment.yaml
service/nfs-provisioner created
deployment.apps/nfs-provisioner created
 
vagrant@k8s-head:~$ kubectl apply -f https://raw.githubusercontent.com/jprdonnelly/kubernetes-cluster/master/nfs-provisioner/nfs-class.yaml
storageclass.storage.k8s.io/nfs-dynamic created
vagrant@k8s-head:~$ kubectl get svc
NAME              TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                              AGE
kubernetes        ClusterIP   10.96.0.1        <none>        443/TCP                              18m
nfs-provisioner   ClusterIP   10.109.234.184   <none>        2049/TCP,20048/TCP,111/TCP,111/UDP   11s
 
vagrant@k8s-head:~$ kubectl patch storageclass nfs-dynamic -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
storageclass.storage.k8s.io/nfs-dynamic patched
 

Clean-up

Execute the following command to remove the virtual machines created for the Kubernetes cluster.

vagrant destroy -f

You can destroy individual machines by

vagrant destroy k8s-node3 -f
Licensing

Apache License, Version 2.0.

Description
No description provided
Readme Apache-2.0 424 KiB
Languages
Dockerfile 76.7%
Shell 23.3%