(deploying-using-kubernetes-operator)= # Beta - Installing Fleio in kubernetes using Fleio operator ```{warning} This is a beta release, and is not intended for production use. ``` ```{contents} :depth: 4 :backlinks: none ``` ## Hardware requirements Since in Kubernetes Fleio starts multiple pods for services, the hardware requirements will be slightly higher than {ref}`docker hardware requirements`. It is also recommended you run Fleio on a multi-node Kubernetes cluster. ## Installing fleio in a ``Microk8s`` cluster ### Preparing the environment ```{note} The following commands work on Ubuntu 24.04, if you plan to use other distribution, you will have to run commands specific to your distribution. ``` Install ``microk8s``, ``helm`` and ``kubectl``: ```shell sudo snap install microk8s --classic sudo snap install helm --classic sudo snap install kubectl --classic ``` Run the following commands to enable some MicroK8s extension needed by Fleio: ```shell microk8s enable dashboard hostpath-storage registry ingress cert-manager microk8s status --wait-ready ``` And then, add the current user to the ``microk8s`` group: ```shell sudo usermod -a -G microk8s $USER ``` Re-login to apply group changes, then configure kubectl to connect to MicroK8s: ```shell mkdir ~/.kube microk8s config > ~/.kube/config chmod 600 ~/.kube/config ``` Test that ``kubectl`` works using the following command: ```shell kubectl get all ``` If everything is OK, you can continue with instructions from [](#deploying-using-fleio-operator). ## Installing Fleio in a generic Kubernetes cluster ### Prerequisites Fleio needs a cluster with the following: - a default storage class that supports automatic provisioning - nginx ingress and a nginx ingress class called ``public`` - cert manager installed (https://cert-manager.io/) ``kubectl`` must be installed and configured to access the cluster. ``helm`` is also needed. Test that ``kubectl`` works using the following command: ```shell kubectl get all ``` If everything is OK, you can continue with instructions from [](#deploying-using-fleio-operator). (deploying-using-fleio-operator)= ## Deploying Fleio in Kubernetes using Fleio operator ### Install Fleio operator Fleio operator can be installed via helm. Add fleio helm repository: ```shell helm repo add fleio "https://fleio.com/helm" helm repo update fleio ``` Install Fleio operator: ```shell helm install fleio-operator fleio/fleio-operator ``` ### Create connections resources Fleio needs a redis server and a mariadb database. Fleio operator adds two custom resource definitions (``fleiodbconnection`` and ``fleioredisconnection``) to configure these. #### Create a **``fleiodbconnection``** and credentials secret Before proceeding you need to install a mariadb server and create a database for Fleio with ``utf8mb4`` character set and ``utf8mb4_unicode_ci`` collation. Create a ``kubenetes.io/basic-auth`` secret with mariadb credentials (replace ```` and ```` with your credentials): ```shell cat < fleio-mariadb-credentials.yaml apiVersion: v1 kind: Secret metadata: name: fleio-mariadb-credentials type: kubernetes.io/basic-auth stringData: username: "" password: "" EOT ``` Create a ``fleiodbconnection`` resource (replace ```` and ```` with your values): ```shell cat < fleio-mariadb-connection.yaml apiVersion: "k8s.fleio.com/v1" kind: FleioDbConnection metadata: name: fleio-db-connection spec: hostname: "" port: 3306 credentialsSecret: fleio-mariadb-credentials databaseName: "" EOT ``` Apply resources using ``kubectl``: ```shell kubectl apply -f fleio-mariadb-credentials.yaml kubectl apply -f fleio-mariadb-connection.yaml ``` #### Create a **``fleioredisconnection``** and credentials secret Before proceeding, you need to install a redis server. Create a ``kubenetes.io/basic-auth`` secret with redis credentials (replace ```` and ```` with your credentials, leave ```` empty if your redis server accepts only password): ```shell cat < fleio-redis-credentials.yaml apiVersion: v1 kind: Secret metadata: name: fleio-redis-credentials type: kubernetes.io/basic-auth stringData: username: "" password: "" EOT ``` Create a ``fleioredisconnection`` resource (replace ```` with your value): ```shell cat < fleio-redis-connection.yaml apiVersion: "k8s.fleio.com/v1" kind: FleioRedisConnection metadata: name: fleio-redis-connection spec: hostname: "" port: 6379 credentialsSecret: fleio-redis-credentials databaseId: "0" EOT ``` Apply resources using ``kubectl``: ```shell kubectl apply -f fleio-redis-credentials.yaml kubectl apply -f fleio-redis-connection.yaml ``` ### Create a **``fleiodeployment``** resource and admin credentials secret: Create a ``kubenetes.io/basic-auth`` secret with Fleio admin credentials (replace ```` and ```` with your credentials): ```shell cat < fleio-admin-credentials.yaml apiVersion: v1 kind: Secret metadata: name: fleio-admin-credentials type: kubernetes.io/basic-auth stringData: username: "" password: "" EOT ``` Create a ``fleiodeployment`` resource (replace ```` and ```` with your Fleio license and ```` with public IP or FQDN of your machine): ```shell cat < fleio-deployment.yaml apiVersion: "k8s.fleio.com/v1" kind: FleioDeployment metadata: name: test spec: license: uuid: "" key: "" databaseConnection: "fleio-mariadb-connection" redisConnection: "fleio-redis-connection" adminCredentialsSecret: "fleio-admin-credentials" domain: "" EOT ``` Apply resources using ``kubectl``: ```shell kubectl apply -f fleio-admin-credentials.yaml kubectl apply -f fleio-deployment.yaml ``` Once a ``fleiodeployment`` resource exists in the cluster the Fleio operator will deploy Fleio in cluster. After deployment finishes, Fleio should be available at the domain or IP you specified over HTTP. (deploying-using-helper-script)= ## Deploying with a helper script ```{warning} This deploy method is not intended for production use, we recomend using this only for testing. ``` This script installs and configures Fleio, mariadb and redis in a Kubernetes cluster. Run the script using the following command: ```shell curl -s -o "deploy-fleio" "https://fleio.com/helm/deploy-fleio" && bash "deploy-fleio" ``` ## Further steps See [Kubernetes documentation](#kubernetes-documentation)