Skip to content

Vagrantfile and scripts to automate Kubernetes setup using kubeadm and containerd.

License

Notifications You must be signed in to change notification settings

acmano7/vagrant-kubeadm-k8s-containerd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vagrantfile and Scripts to Automate k8s Setup using Kubeadm and Containerd.

Credits

This code is a modified copy to be used when containerd is required. The original source code/project using CRI-O can be found here.

Prerequisites

  1. Working Vagrant setup
  2. CPU, RAM and Disk - Resources available according to the desired configuration.

For MAC/Linux Users

The latest version of Virtualbox for Mac/Linux can cause issues.

Create/edit the /etc/vbox/networks.conf file and add the following to avoid any network-related issues.

* 0.0.0.0/0 ::/0

or run below commands

sudo mkdir -p /etc/vbox/
echo "* 0.0.0.0/0 ::/0" | sudo tee -a /etc/vbox/networks.conf

So that the host only networks can be in any range, not just 192.168.56.0/21 as described here: https://discuss.hashicorp.com/t/vagrant-2-2-18-osx-11-6-cannot-create-private-network/30984/23

Bring Up the Cluster

To provision the cluster, execute the following commands.

git clone https://github.com/acmano7/vagrant-kubeadm-kubernetes.git
cd vagrant-kubeadm-kubernetes
vagrant up

Set Kubeconfig file variable

cd vagrant-kubeadm-kubernetes
cd configs
export KUBECONFIG=$(pwd)/config

or you can copy the config file to .kube directory.

cp config ~/.kube/

Install Kubernetes Dashboard

The dashboard is automatically installed by default, but it can be skipped by commenting out the dashboard version in settings.yaml before running vagrant up.

If you skip the dashboard installation, you can deploy it later by enabling it in settings.yaml and running the following:

vagrant ssh -c "/vagrant/scripts/dashboard.sh" master

Kubernetes Dashboard Access

To get the login token, copy it from config/token or run the following command:

kubectl -n kubernetes-dashboard get secret/admin-user -o go-template="{{.data.token | base64decode}}"

Proxy the dashboard:

kubectl proxy

Open the site in your browser:

http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/overview?namespace=kubernetes-dashboard

To shutdown the cluster,

vagrant halt

To restart the cluster,

vagrant up

To destroy the cluster,

vagrant destroy -f

Contributing

Contributions are always welcome!

About

Vagrantfile and scripts to automate Kubernetes setup using kubeadm and containerd.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages