Kubernetes: The Clusters

Persyaratan untuk dapat mengoperasikan Kubernetes adalah sebuah cluster. Berikut adalah daftar cluster yang populer digunakan.

#1. Kubeadm

Kubeadm | Kubernetes

Menginisiasi cluster

kubeadm init

[ERROR NumCPU]: the number of available CPUs 1 is less than the required 2
[ERROR Mem]: the system RAM (981 MB) is less than the minimum 1700 MB

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
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config

Alternatively, if you are the root user, you can run:

export KUBECONFIG=/etc/kubernetes/admin.conf

Setelah inisiasi selesai, node belum dapat langsung digunakan. Jika kita cek daftar node pada cluster, maka akan terlihat bahwa node kita belum siap atau masih dalam status NotReady.

kubectl get nodes
NAME         STATUS     ROLES                  AGE   VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION     CONTAINER-RUNTIME
<hostname>   NotReady   control-plane,master   14m   v1.21.3   10.1.1.88     <none>        Ubuntu 20.04.1 LTS   5.4.0-48-generic   docker://20.10.2

Kita masih harus menginstall salah satu dari kedua pilihan dibawah ini agar node-nya dapat digunakan

Install Calico networking and network policy for on-premises deployments (projectcalico.org)

kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml

atau

GitHub – flannel-io/flannel: flannel is a network fabric for containers, designed for Kubernetes

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml

Menghapus cluster

kubeadm reset

#2. Microk8s

MicroK8s – Zero-ops Kubernetes for developers, edge and IoT

Installasi / Menginisiasi cluster

snap install microk8s --classic

Setelah inisiasi selesai, node belum dapat langsung digunakan. Jika kita cek daftar node pada cluster, maka akan terlihat bahwa node kita belum siap atau masih dalam status NotReady.

microk8s kubectl get nodes
NAME         STATUS     ROLES    AGE   VERSION
<hostname>   NotReady   <none>   29s   v1.21.1-3+ba118484dd39df

Anda harus mengaktifkan modul DNS microk8s terlebih dahulu.

microk8s enable dns

Cek lagi untuk memastikan status node sudah dapat digunakan atau status Ready.

microk8s kubectl get nodes
NAME        STATUS   ROLES    AGE     VERSION
<hostname>  Ready    <none>   8m37s   v1.21.1-3+ba118484dd39df

Menghapus cluster

snap remove microk8s

#3. K3s

K3s

Installasi / Menginisiasi cluster

curl -sfL https://get.k3s.io | sh -

Menghapus cluster

/usr/local/bin/k3s-uninstall.sh

#4. Minikube

Welcome! | minikube (k8s.io)

#5. KIND

kind (k8s.io)

Installasi

Releases · kubernetes-sigs/kind (github.com)

wget https://github.com/kubernetes-sigs/kind/releases/download/v0.17.0/kind-linux-amd64
chmod +x ./kind-linux-amd64
mv ./kind-linux-amd64 /usr/local/bin/kind

Menginisiasi cluster

kind create cluster --name <cluster-name>

Menghapus cluster

kind delete cluster --name <cluster-name>

#6. K3d

k3d

Installasi

Releases · k3d-io/k3d · GitHub

wget https://github.com/k3d-io/k3d/releases/download/v5.4.6/k3d-linux-amd64
chmod +x k3d-linux-amd64
mv ./k3d-linux-amd64 /usr/local/bin/k3d

Menginisiasi cluster

k3d cluster create <cluster-name>

Menghapus cluster

k3d cluster delete <cluster-name>

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *