Skip to content

Latest commit

 

History

History
147 lines (106 loc) · 5.14 KB

Setup-Clusters.md

File metadata and controls

147 lines (106 loc) · 5.14 KB

logo

💙🤍Setup Clusters🤍💙

📘Table of Contents

  1. 📘Table of Contents
  2. 🖖Introduction
  3. ✨Steps
    1. 👉Step 1: Initialize the Kubernetes cluster on the master node
    2. 👉Step 2: Copy the credentials to the user's home directory
    3. 👉Step 3: Join the master nodes to the cluster
    4. 👉Step 4: Join the worker nodes to the cluster
    5. 👉Step 5: Install helm
    6. 👉Step 6: Install the Cilium CNI plugin
    7. 👉Step 7: Now wait for all the pots to be running
    8. 👉Step 8: Check the status of the nodes
  4. 🔗Links

🖖Introduction

This document provides a step-by-step guide to setting up the Kubernetes clusters in the supercluster. The steps outlined in this document are essential for ensuring the proper functioning of the clusters and the supercluster.

✨Steps

👉Step 1: Initialize the Kubernetes cluster on the master node

# Cluster01
sudo kubeadm init --config https://raw.githubusercontent.com/EliasDH-com/K8s-Infrastructure/refs/heads/main/Supercluster/Cluster01/ClusterConfiguration.yaml --upload-certs --v "5" # For cluster01 on node01, node02, node03

# Cluster02
sudo kubeadm init --config https://raw.githubusercontent.com/EliasDH-com/K8s-Infrastructure/refs/heads/main/Supercluster/Cluster02/ClusterConfiguration.yaml --upload-certs --v "5" # For cluster02 on node11, node12, node13

# Cluster03
sudo kubeadm init --config https://raw.githubusercontent.com/EliasDH-com/K8s-Infrastructure/refs/heads/main/Supercluster/Cluster03/ClusterConfiguration.yaml --upload-certs --v "5" # For cluster03 on node21, node22, node23

Note: Copy the kubeadm join commands for the worker nodes and the master node

👉Step 2: Copy the credentials to the user's home directory

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

Note: This most be done on all the master nodes

👉Step 3: Join the master nodes to the cluster

# Cluster01
sudo kubeadm join 10.1.0.10:6443 --token <token> \
        --discovery-token-ca-cert-hash sha256:<hash> \
        --control-plane --certificate-key <key>

# Cluster02
sudo kubeadm join 10.2.0.10:6443 --token <token> \
        --discovery-token-ca-cert-hash sha256:<hash> \
        --control-plane --certificate-key <key>

# Cluster03
sudo kubeadm join 10.3.0.10:6443 --token <token> \
        --discovery-token-ca-cert-hash sha256:<hash> \
        --control-plane --certificate-key <key>

👉Step 4: Join the worker nodes to the cluster

# Cluster01
sudo kubeadm join 10.1.0.10:6443 --token <token> \
        --discovery-token-ca-cert-hash sha256:<hash>

# Cluster02
sudo kubeadm join 10.2.0.10:6443 --token <token> \
        --discovery-token-ca-cert-hash sha256:<hash>

# Cluster03
sudo kubeadm join 10.3.0.10:6443 --token <token> \
        --discovery-token-ca-cert-hash sha256:<hash>

👉Step 5: Install helm

curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
sudo ./get_helm.sh

👉Step 6: Install the Cilium CNI plugin

# Install the Cilium CLI
helm repo add cilium https://helm.cilium.io/

# Set the Cilium CLI version
CILIUM_CLI_VERSION=$(curl -s https://raw.githubusercontent.com/cilium/cilium-cli/main/stable.txt)

# Set the Cilium CLI architecture
CLI_ARCH=amd64

# Check the architecture
if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi

# Download the Cilium CLI
curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}

# Verify the Cilium CLI
sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum

# Extract the Cilium CLI
sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin

# Remove the Cilium CLI
rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum}

# Install the Cilium Helm chart
helm install cilium cilium/cilium --version 1.16.1 \
  --namespace kube-system \
  --set prometheus.enabled=true \
  --set operator.prometheus.enabled=true

Note: CNI is a plugin that allows Kubernetes to communicate with the network. Cilium is a CNI plugin that provides networking, security, and observability features.

CNI = Container Network Interface

👉Step 7: Now wait for all the pots to be running

watch kubectl get pods -n kube-system # Press Ctrl+C to exit

👉Step 8: Check the status of the nodes

watch kubectl get nodes -o wide # Press Ctrl+C to exit

🔗Links