k8s single node cluster with Antrea CNI
spin up test clusters on ubuntu 18
Recently, VMware announced an open source Kubernetes Networking project called Antrea. This project uses Open vSwitch (more here) as the data plane for a compatible Container Network Interface (CNI). To run Kubernetes (k8s) clusters, it is required that you provide a CNI to allow the pod to pod communication. It is assumed the hosts (physical or VMs) making up the cluster are already networked together.
This script will help in setting up a single node k8s cluster using Kubeadm on an Ubuntu 18.04 and Antrea CNI. For me, this is an easy way to spin up a cluster to mess around with or do some testing. A couple other ways that I've used and love are KinD (here) and simply enabling it in Docker for Desktop (probably the easiest way for most).
I have the script broken down into 2 parts, because I can't get Docker to run properly without a full reboot. To run the scripts, log into your Ubuntu machine that has 2 CPU and at least 2Gb RAM and:
git clone https://github.com/fitz0017/k8s.git source k8s/install_k8s_1.sh
At this point you may need to input your sudo password, and select 'yes' when asking if you will allow for system services to be restarted.
Then you should see a full reboot of your Ubuntu machine. So log yourself back in and:
This will kick off the initialization of the cluster and application of the Antrea CNI. Make sure to note the discovery token if you want to grow this cluster with additional workers.
From here, when ssh'd into that machine. You have access to a k8s cluster for testing and learning!