Skip to content

Kubernetes + RAGFlow Deployment Guide

Abstract: This guide provides a "Golden Path" for building a Kubernetes (v1.30) cluster from scratch on an Ubuntu 22.04 VM (8C/50G) and deploying the RAGFlow intelligent retrieval system. It includes optimizations for Chinese mirrors, kernel parameters, and storage persistence.

Phase 1: Kubernetes Initialization

1. System Config

User: root or sudo

  1. Install Base Tools:

    bash
    apt update && apt install -y apt-transport-https ca-certificates curl gnupg lsb-release vim
  2. Disable Swap (Mandatory for K8s):

    bash
    swapoff -a
    sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
  3. Kernel Parameters:

    bash
    cat <<EOF | tee /etc/sysctl.d/k8s.conf
    net.bridge.bridge-nf-call-ip6tables = 1
    net.bridge.bridge-nf-call-iptables = 1
    net.ipv4.ip_forward                 = 1
    EOF
    sysctl --system
    modprobe br_netfilter

2. Install Containerd

  1. Add Docker Repo:

    bash
    curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
  2. Install Package:

    bash
    apt update && apt install -y containerd.io
  3. Apply Golden Config:

    bash
    mkdir -p /etc/containerd
    containerd config default > /etc/containerd/config.toml
    
    # Enable SystemdCgroup & Set Mirrors
    sed -i 's/SystemdCgroup = false/SystemdCgroup = true/g' /etc/containerd/config.toml
    sed -i 's|sandbox_image = "registry.k8s.io/pause:3.8"|sandbox_image = "registry.aliyuncs.com/google_containers/pause:3.9"|g' /etc/containerd/config.toml
    
    systemctl restart containerd

3. Install Kubernetes Components

  1. Add K8s Repo (v1.30):

    bash
    curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
    echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.30/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list
  2. Install & Hold Versions:

    bash
    apt update && apt install -y kubelet kubeadm kubectl
    apt-mark hold kubelet kubeadm kubectl

4. Initialize Cluster

  1. Create Config: (Replace controlPlaneEndpoint with your VM IP)

    yaml
    cat <<EOF > kubeadm-config.yaml
    apiVersion: kubeadm.k8s.io/v1beta3
    kind: ClusterConfiguration
    kubernetesVersion: "v1.30.0"
    imageRepository: "registry.aliyuncs.com/google_containers"
    controlPlaneEndpoint: "192.168.161.158:6443"
    networking:
      podSubnet: "10.244.0.0/16"
    ---
    apiVersion: kubelet.config.k8s.io/v1beta1
    kind: KubeletConfiguration
    cgroupDriver: systemd
    EOF
  2. Run Init:

    bash
    kubeadm init --config kubeadm-config.yaml
  3. Setup Kubectl:

    bash
    mkdir -p $HOME/.kube
    cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
    chown $(id -u):$(id -g) $HOME/.kube/config
  4. Install Network (Flannel):

    bash
    kubectl apply -f https://raw.githubusercontent.com/flannel-io/flannel/master/Documentation/kube-flannel.yml
    kubectl taint nodes --all node-role.kubernetes.io/control-plane-

Phase 2: RAGFlow Deployment

1. Pre-pull Images

bash
crictl pull elasticsearch:8.11.1
crictl pull infiniflow/ragflow:v0.20.5-slim
crictl pull minio/minio:latest
crictl pull mysql:8.0
crictl pull redis:7

2. Prepare Storage

bash
mkdir -p /mnt/ragflow-data/{mysql,minio,es}
chmod -R 777 /mnt/ragflow-data

3. Deploy

Apply the YAML (Ensure you have the full manifest):

bash
kubectl apply -f ragflow-all-in-one.yaml

4. Verification

Wait for Pods:

bash
kubectl get pods -n ragflow -w

Access: http://<VM_IP>:30001

AI-HPC Organization