Search Results for

    Show / Hide Table of Contents

    Deploy a Kubernetes cluster

    Products: FastReport Corporate Server

    To install and configure the report server, you need to deploy the Kubernetes cloud ecosystem.

    FastReport Corporate Server requires at least three nodes for correct operation: one master node and two worker nodes. The number of nodes can be increased when the load grows. And vice versa, the number of nodes can be decreased when the load drops. Dynamic control of the node quantity is currently not implemented.

    Prepare and install Kubernetes components

    Kubernetes is installed by executing the following bash scripts in sequence. These examples assume the Debian Linux operating system. In case of using another distribution, some steps will be different.

    1. Disable swap partition.
    #
    # Permanently disable swap
    #
    sed -e '/swap/s/^/#/g' -i /etc/fstab
    swapoff -a
    
    1. Load the required kernel modules.
    #
    # Enable kernel modules
    #
    MODULES=/etc/modules-load.d/k8s.conf
    if [ ! -f $MODULES ]; then 
       echo "Create $MODULES"
       cat<<EOF | tee $MODULES
    overlay
    br_netfilter
    EOF
    fi
    
    1. Configure the network properties of the system kernel.
    #
    # Configure kernel
    #
    SYSCTL=/etc/sysctl.d/k8s.conf
    if [ ! -f $SYSCTL ]; then
        echo "Prepare kernel options"
        cat<<EOF | tee $SYSCTL
    net.bridge.bridge-nf-call-iptables  = 1
    net.ipv4.ip_forward                 = 1
    net.bridge.bridge-nf-call-ip6tables = 1
    EOF
    fi
    sysctl --system
    
    1. Install additional software that will be required to install the orchestrator and report server.
    apt-get update
    
    #
    # Install pre-requested packages
    #
    prerequest=( curl sudo gnupg2 apt-transport-https ca-certificates software-properties-common )
    
    for package in "${prerequest[@]}"
    do
        echo -n "Checking $package: "
        dpkg -s $package > /dev/null 2> /dev/null
        if [ $? -ne 0 ]; then
            echo "Installing"
            apt-get install -y $package
        else
            echo "OK"
        fi
    done
    
    1. Install Container Runtime Interface (CRI).

    In the following example, CRI container is used. Different versions of Kubernetes and Linux may require CRI-O to be installed. Kubernetes uses CRI to load and manage containers, and to run processes in those containers.

    ## Add Docker's official GPG key
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key --keyring /etc/apt/trusted.gpg.d/docker.gpg add -
    
    ## Add Docker apt repository.
    add-apt-repository \
        "deb [arch=amd64] https://download.docker.com/linux/debian \
        $(lsb_release -cs) \
        stable"
    
    ## Install containerd
    apt-get update && apt-get install -y containerd.io
    
    # Configure containerd
    if [ ! -d /etc/containerd ]; then
      mkdir -p /etc/containerd
    fi
    
    # Remove default config to avoid errors
    if [ -f /etc/containerd/config.toml ]; then
      rm /etc/containerd/config.toml
    fi
    
    # Restart containerd
    systemctl restart containerd
    
    1. Install Kubernetes components.
    curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
    cat <<EOF | tee /etc/apt/sources.list.d/kubernetes.list
    deb https://apt.kubernetes.io/ kubernetes-xenial main
    EOF
    apt-get update
    apt-get install -y kubelet kubeadm kubectl
    apt-mark hold kubelet kubeadm kubectl
    

    Start Kubernetes

    To start the cluster master node, edit 3 variables responsible for the corresponding paths to the configuration file (it will be created automatically), IP address (it will be accessible externally), and internal subnet mask.

    Then run the cluster initialization command.

    export KUBECONFIG=/etc/kubernetes/admin.conf1
    export MAIN_IF=192.168.1.191 
    export POD_NETWORK=10.244.0.0/16  # If flannel is used, this value cannot be changed!
    
    kubeadm init --pod-network-cidr=$POD_NETWORK --apiserver-advertise-address=$MAIN_IF
    

    The MAIN_IF address is the IP address of the cluster master node. The address can be an actual IP address or 192.168 subnet address.

    If the initialization of the cluster master node is successful, a line will be displayed to initialize the cluster worker nodes. Use the mouse to copy this line and save it to a file. It contains a command to initialize the worker nodes. The command includes a secret key. If this key is exposed to an attacker, they can compromise the cluster.

    Example line:

    kubeadm join 192.168.1.191:6443 --token lw0lgz.d5zy9fb4jikc89yv \
            --discovery-token-ca-cert-hash sha256:ba83ed75e9fd5f4300070000000000000039e1d05c7915a54435faaa7fe62b77
    

    To add a node to the cluster, follow the steps described in the previous section (except for installing the helm chart), copy this command line to each node, and run it as administrator (root). This will add a new node to the cluster.

    Configure kubectl.

    mkdir ~/.kube
    rm ~/.kube/config
    cp /etc/kubernetes/admin.conf ~/.kube
    

    Now you need to install the flannel service.x

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

    If the installation is successful, the output of the kubectl get pods --all-namespaces should look approximately like this:

    NAMESPACE     NAME                                    READY   STATUS    RESTARTS   AGE
    kube-system   coredns-78fcd69978-brp76                1/1     Running   0          5m13s
    kube-system   coredns-78fcd69978-shdv5                1/1     Running   0          5m13s
    kube-system   etcd-debian-10-1                        1/1     Running   0          5m27s
    kube-system   kube-apiserver-debian-10-1              1/1     Running   0          5m22s
    kube-system   kube-controller-manager-debian-10-1     1/1     Running   0          5m31s
    kube-system   kube-flannel-ds-7nn2c                   1/1     Running   0          28s
    kube-system   kube-flannel-ds-9phgs                   1/1     Running   0          28s
    kube-system   kube-flannel-ds-ddcw6                   1/1     Running   0          28s
    kube-system   kube-proxy-74pll                        1/1     Running   0          3m36s
    kube-system   kube-proxy-82nld                        1/1     Running   0          3m15s
    kube-system   kube-proxy-njxwv                        1/1     Running   0          5m14s
    kube-system   kube-scheduler-debian-10-1              1/1     Running   0          5m32s
    

    If all the installation steps were done correctly, the state from the example above will be reached within a minute. The cluster needs time to start and configure the coredns after the flannel is installed.

    Back to top 2026.1.1 © 1998-2025 Copyright Fast Reports Inc.