jonsbjons / kubernetes

This repo contains the script to install docker engine alongside cri-containerd. That lead to the creation of a kubernetes cluster with kube components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kubernetes on Ubuntu 16+

The repository contains the steps to build a kubernetes cluster from scratch.

It includes installing Docker Engine, CRI-dockerd adapter to act as shim between docker and k8s.

Later on, the final kubernetes tools such as kubeadm, kubelet, kubectl are installed.


Installation

./deploy_k8s.sh

Post Installation

After the installation of tools, configure it based on what kind of node it would be. Out of many nodes, atleast one must be chosen as master.

The only difference between worker node and master is, during the initializing stage, installs the cluster control plane components.


Setup Master node

Make one of the node as master in a multi node cluster. To do that, initialize the kubeadm with server parameters.

kubeadm init --apiserver-advertise-address=[server_ip] --pod-network-cidr=[pod netwrok cidr] --cri-socket=unix:///var/run/cri-dockerd.sock

Initialition first runs a series of prechecks to ensure that the machine is ready to run kubernetes. These prechecks expose warnings and exit on errors. Kubeadm init then downloads and installs the cluster control plane components. This make take several minutes. After it finishes able to see:

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

Setup Worker nodes

Once a node has been selected as master, join workers to the master by the following sytax as root.

kubeadm join [master_ip]:6443 --token [from master node] --discovery-token-ca-cert-hash [hash generated by master] --cri-socket unix:///var/run/cri-dockerd.sock

Once the worker has joined, you will get the following output.

This node has joined the cluster.

  • Certificate signing request was sent to apiserver and a response was received.
  • The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

In case you missed to save the token when master was created, generate a new one in master node by:

kubeadm token create --print-join-command

NotnotReady solution

You must deploy a Container Network Interface (CNI) based Pod network add-on so that your Pods can communicate with each other.

Cluster DNS (CoreDNS) will not start up before a network is installed.

Supported plugins:

  • Calico
  • Cilium
  • Weave-net

Install weave

 kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"

References

Kubernetes logo

About

This repo contains the script to install docker engine alongside cri-containerd. That lead to the creation of a kubernetes cluster with kube components


Languages

Language:Shell 100.0%