Kubic:kubeadm

Jump to: navigation, search

What is kubeadm?

kubeadm is a toolkit produced by Kubernetes upstream for the creation and upgrade of Kubernetes clusters

What is Kubernetes?

Kubernetes is an open-source system for automating deployment, scaling, and management of containerised applications. It groups containers that make up an application into logical units for easy management and discovery. Services then receive features like self-healing, high-availability, and load balancing with Kubernetes taking steps to ensure services keep running even in the event of failures. Kubernetes builds upon 15 years of experience of running production workloads at Google, combined with best-of-breed ideas and practices from the community.

Put simply, if you want to run containers across multiple servers in a coordinated way, you probably want to use Kubernetes.

If you only need to run containers on a single server, then we recommend using MicroOS, which offers both the Podman/CRI-O and Docker container runtimes for running containers on a stand-alone system.

Getting Started

Please Note: kubeadm on Kubic is under heavy active development. We are doing our best to keep this guide up to date, but if you notice any anomalies please get in touch or feel free to correct them yourselves.

First, you need to download a recent installation media of Kubic. Any version after 20180815 should work. NOTE: Offical VM images are something we're already working on, but are not ready yet

For installing on bare metal, burn this media to a DVD or USB Stick, and then boot your first system from it. For VMs or VPS providers just boot the iso directly. This first system will be the machine we will refer to as the Master, and will run the core Kubernetes services but not any containerised applications. That will be done by additional machines referred to as Nodes.

After selecting your language and agreeing to our license, you will be presented with the following "System Roles" screen. Select kubeadm Node

Kubeadm-system-role.png

Follow the next step of setting a root password, and if you wish you can customise networking and other options before starting the installation. We recommend leaving the defaults unless you know what you're doing. The installation will then proceed, and you will end up with the following login prompt.

Kubeadm-master-login.png

Login using the root password set during the installation. We recommend using ssh to login to the machine remotely, as it will likely simplify things like copy-and-pasting between machines needed later.

Now run kubeadm init --cri-socket=/var/run/crio/crio.sock --pod-network-cidr=10.244.0.0/16

NOTE: The --pod-network-cidr=10.244.0.0/16 parameter is for setting up our currently recommended flannel networking interface (aka CNI). This recommendation is likely to be changed in the future

Kubeadm-master-secondrun.png

After a brief period, your Master should now be initialised.

Kubeadm-master-initcomplete.png

Take a note/copy of the line beginning with kubeadm join. You are going to need it to join Nodes to your cluster.

As mentioned in the success message, configure the root user to be able to talk to the cluster by running mkdir -p ~/.kube, then cp -i /etc/kubernetes/admin.conf ~/.kube/config

You can then setup flannel by running kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube-flannel.yml

Alternatively you can use the URL shortened command kubectl apply -f https://0y.at/kubicflannel

Kubeadm-master-cni.png

This now means your master is fully set up and ready for other nodes to join it. You install them the same way as your Master, selecting the kubeadm Node role just as before.

However, unlike on your master, you run the kubeadm join command by pasting the line that was presented at the end of the kubeadm init run from the Master. Before pressing enter, be sure to add --cri-socket=/var/run/crio/crio.sock to the end of the line.

Kubeadm-node-join.png

After a short run, you should get the following confirmation that your node has joined the cluster.

Kubeadm-node-joined.png

Now from your master node (or any system with kubectl installed and the /etc/kubernetes/admin.config file from the master copied to your users $HOME/.kube/config file) you can run kubectl get nodes to confirm your cluster is operational.

Kubeadm-master-nodes.png

Congratulations! You now have a working Kubernetes cluster.

Further Documentation

For further documentation, we highly recommend you read the upstream kubeadm documentation which we aim for Kubic to be compatible with.