Kubernetes

From TBP Wiki
Revision as of 16:42, 16 March 2023 by Goldbolt (talk | contribs) (Install Kubernetes to Ubuntu)
Jump to: navigation, search

Kubernetes (/ˌk(j)uːbərˈnɛtɪs, -ˈneɪtɪs, -ˈneɪtiːz, -ˈnɛtiːz/, commonly abbreviated K8s) is an open-source container orchestration system for automating software deployment, scaling, and management. Originally designed by Google, the project is now maintained by the Cloud Native Computing Foundation.

The name Kubernetes originates from Greek, meaning 'helmsman' or 'pilot'. Kubernetes is often abbreviated as K8s, counting the eight letters between the K and the s (a numeronym).

Kubernetes works with containerd and CRI-O. Its suitability for running and managing large cloud-native workloads has led to widespread adoption of it in the data center. There are multiple distributions of this platform – from ISVs as well as hosted-on cloud offerings from all the major public cloud vendors.

Install Kubernetes to Ubuntu

The following commands will install microk8s to Ubuntu:

   sudo snap install microk8s --classic

Add your user to the microk8s admin group and fix permissions:

   sudo usermod -a -G microk8s $USER
   sudo chown -f -R $USER ~/.kube

Log out and log back in to that user for this to take effect.

Check the status of the service:

   microk8s status --wait-ready

Enable services:

   microk8s enable dashboard dns ingress metallb

Use the following to check for available services to enable:

   microk8s enable --help

Start using microk8s:

   microk8s kubectl get all --all-namespaces

Access the dashboard:

   microk8s dashboard-proxy

Clustering

To create a cluster out of two or more already-running MicroK8s instances, use the microk8s add-node command. As of MicroK8s 1.19, clustering of three or more nodes will automatically enable high availability. The MicroK8s instance on which the command is run will host the Kubernetes control plane:

   microk8s add-node

The add-node command prints a microk8s join command which should be executed on the MicroK8s instance(s) that you wish to join to the cluster (NOT THE NODE YOU RAN add-node FROM). For example:

   microk8s join ip-172-31-20-243:25000/DDOkUupkmaBezNnMheTBqFYHLWINGDbf

Joining a node to the cluster should only take a few seconds. Afterwards you should be able to see the node has joined:

   microk8s kubectl get no