abhilashthale.tech
  • Home
  • BlogCategories
    • coding
    • other
    • n
  • Images to Pdf
  • My Files
  • Shares Average
  • About Me
  • Server Stats
  • Day
  • Night
  • Birds
  • Waves
  • Net
  • Dots
  • Halo
  • Rings
  • Fog
  • Clouds

    Kubernetes Offline Install

    by abhilashthale - March 15, 2026

    ==================== OFFLINE KUBERNETES INSTALL (RHEL 8.10) ====================

    CLUSTER DETAILS
    ---------------
    MASTER  : 192.168.241.160
    WORKERS : 192.168.241.161 , 192.168.241.162
    K8S     : v1.30.14
    RUNTIME : containerd
    CNI     : flannel
    ARTIFACTS PATH : /data
    packages in /data: conntrack-tools-1.4.4-11.el8.x86_64, containerd.io-1.6.32-3.1.el8.x86_64, cri-tools-1.30.1-150500.1.1.x86_64, ethtool-5.13-2.el8.x86_64, iproute-6.2.0-6.el8_10.x86_64, iproute-tc-6.2.0-6.el8_10.x86_64, iptables-1.8.5-11.el8_9.x86_64, iptables-ebtables-1.8.5-11.el8_9.x86_64, kubeadm-1.30.14-150500.1.1.x86_64, kubectl-1.30.14-150500.1.1.x86_64, kubelet-1.30.14-150500.1.1.x86_64, kubernetes-cni-1.4.0-150500.1.1.x86_64, socat-1.7.4.1-2.el8_10.x86_64, createrepo, bash-auoconnect

    ================================================================================
    STEP 0 : COMMON SETUP (RUN ON ALL NODES)
    ================================================================================

    swapoff -a
    sed -i '/swap/d' /etc/fstab

    cat <<EOF >/etc/modules-load.d/k8s.conf
    overlay
    br_netfilter
    EOF

    modprobe overlay
    modprobe br_netfilter

    cat <<EOF >/etc/sysctl.d/k8s.conf
    net.bridge.bridge-nf-call-iptables=1
    net.bridge.bridge-nf-call-ip6tables=1
    net.ipv4.ip_forward=1
    EOF

    sysctl --system

    ================================================================================
    STEP 1 : CONFIGURE OFFLINE REPO (RUN ON ALL NODES)
    ================================================================================

    cat <<EOF >/etc/yum.repos.d/k8s-offline.repo
    [k8s-offline]
    name=Kubernetes Offline Repo
    baseurl=file:///data/k8s-rpms
    enabled=1
    gpgcheck=0
    EOF

    dnf clean all

    ================================================================================
    STEP 2 : INSTALL PACKAGES (RUN ON ALL NODES)
    ================================================================================

    dnf install -y \
    containerd.io \
    kubeadm kubelet kubectl cri-tools kubernetes-cni \
    conntrack-tools iproute iproute-tc iptables iptables-ebtables ethtool socat

    systemctl enable --now containerd
    systemctl enable kubelet

    ================================================================================
    STEP 3 : CONFIGURE CONTAINERD (RUN ON ALL NODES)
    ================================================================================

    containerd config default > /etc/containerd/config.toml

    sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' \
    /etc/containerd/config.toml

    systemctl restart containerd
    systemctl status containerd

    ================================================================================
    STEP 4 : IMPORT IMAGES (OFFLINE)
    ================================================================================

    # MASTER ONLY
    ctr -n k8s.io images import /data/offline/k8s-images.tar
    ctr -n k8s.io images import /data/offline/flannel.tar

    # WORKERS ONLY
    ctr -n k8s.io images import /data/offline/k8s-images.tar

    ================================================================================
    STEP 5 : INITIALIZE CLUSTER (MASTER ONLY)
    ================================================================================

    kubeadm init \
    --apiserver-advertise-address=192.168.241.160 \
    --pod-network-cidr=10.244.0.0/16

    ================================================================================
    STEP 6 : CONFIGURE kubectl (MASTER ONLY)
    ================================================================================

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

    ================================================================================
    STEP 7 : INSTALL FLANNEL (MASTER ONLY, OFFLINE)
    ================================================================================

    export KUBECONFIG=/etc/kubernetes/admin.conf
    kubectl apply -f /data/offline/kube-flannel.yml

    kubectl get pods -n kube-system

    ================================================================================
    STEP 8 : JOIN WORKER NODES
    ================================================================================

    # ON MASTER
    kubeadm token create --print-join-command


    # RUN OUTPUT COMMAND ON EACH WORKER
    kubeadm reset -f

    rm -rf /etc/cni/net.d
    rm -rf /var/lib/cni
    rm -rf /var/lib/kubelet/*

    systemctl restart containerd
    systemctl restart kubelet

    kubeadm join 192.168.241.160:6443 \
    --token <TOKEN> \
    --discovery-token-ca-cert-hash sha256:<HASH>

    ================================================================================
    STEP 9 : VERIFY CLUSTER (MASTER ONLY)
    ================================================================================

    kubectl get nodes -o wide

    EXPECTED OUTPUT
    ---------------
    control   Ready   control-plane
    node1     Ready
    node2     Ready

    ==================== OFFLINE KUBERNETES INSTALL COMPLETE =======================
     

abhilashthale.tech