# Common Fleio tasks in Kubernetes ```{warning} Fleio in Kubernetes is still in beta, and is not intended for production use. ``` ```{contents} :depth: 4 :backlinks: none ``` (deploying-utils-container)= ## Deploying utils container `utils` container is a container providing various tools to manage a Fleio deployment. It is not mandatory to run this container, so it is not deployed by default. Utils container is currently connected to all backend volumes. To deploy `utils` container, add the following to your Fleio deployment `.yaml` file, in the spec section: ```yaml advanced: deployUtilsContainer: yes ``` and then (re)apply the file or use `kubectl edit fleiodeployment` command to edit an existing deployment. ## Backup By default, backups before upgrade are enabled in Fleio. Fleio also supports scheduled backups, but these are disabled by default: To configure scheduled backups, add the following to your Fleio deployment `.yaml` file, in the spec section: ```yaml enableBackups: no backupSchedule: "2 * * * *" backupRetentionCount: 10 backupRetentionDays: 30 ``` and then (re)apply the file or use `kubectl edit fleiodeployment` command to edit an existing deployment. Backups are saved on the [database backups volume](#database-backups-volume). ### Backup settings details - **enableBackups** - yes/no - will enable or disable backup functionality for a specific Fleio deployment - **backupSchedule** - string - the backup schedule as a cron expression (see https://en.wikipedia.org/wiki/Cron#Cron_expression for details) - **backupRetentionCount** - number - how many previous backups to keep - **backupRetentionDays** - number - how many days to keep previous backups (command-line-interface)= ## Command-line interface To be able to launch a CLI shell, you first need to [deploy utils container](#deploying-utils-container). Once the utils container was deployed you can launch a `root` shell using the following command (replace DeploymentName with your deployment name): ```shell kubectl exec -it deployment.apps/fleio-DeploymentName-utils -- bash ``` To exit the shell use `exit` command. (activate-python-environment)= ## Activate Fleio python environment To activate Fleio python environment, you first need to [launch a CLI shell](#command-line-interface). Once you are in the CLI shell, run the following command to activate Fleio python environment: ```shell source ../env/bin/activate ``` (running-django-commands)= ## Running django commands Fleio backend is developed using the Django web framework (see https://www.djangoproject.com/ for details). Sometimes you will need to run `django` commands to perform changes to a Fleio deployment. To do this, you must first [activate Fleio python environment](#activate-python-environment). Once the environment is active, you can run `django` commands in CLI. E.g., run the following command: ```shell django help ``` to see a list of available commands, or one of the following commands: ```shell django dbshell djanho shell django shell_plus ``` to open database(mariadb) shell, a python shell or an extended python shell. ## Edit backend and frontend configuration Backend and frontend configuration in Kubernetes is stored in config maps (see [config maps](#config-maps)). You can edit these directly using `kubectl edit configmap` command. Fleio operator will watch for changes to these config maps and automatically update Fleio. ## Get fleio deployment information To get information about a Fleio deployment you should run `django fleio_info` command. See [running django command](#running-django-commands) for more details. ## License update License can be updated by editing license details in the fleiodeployment `.yaml` file and then (re)applying the file or by using `kubectl edit fleiodeployment` command. For an existing deployment, Fleio operator will watch for any license changes and apply them automatically. ## Manage period tasks This is currently not supported in Kubernetes. ## Run OpenStack commands To be able to run OpenStack commands, you first need to [launch a CLI shell](#command-line-interface). Once the shell is opened, you can run OpenStack like this: ```shell /scripts/openstack command ``` E.g., if you want to list all servers in the current region, you can run the following command: ```shell /scripts/openstack server list --all-projects ``` Note that the `/scripts/openstack` will use OpenStack settings configured in Fleio to connect to OpenStack. The script will connect to the default region selected in Fleio. ## Restarting Fleio Fleio operator handles restart/recreation of pods as needed. However, if you need to restart a Fleio deployment (recreate all pods), you can use a command like (replace DeploymentName with your deployment name): ```shell kubectl get deployments | grep fleio-DeploymentName | awk '{print $1}' | xargs -l1 kubectl rollout restart deployment ``` ## Stopping and starting Fleio Stopping and starting Fleio is not supported in Kubernetes, however, if you need to stop Fleio, you can scale down to zero all Kubernetes deployments and scale them up again to start them. ## Show a Fleio setting value To get the value of a fleio setting you should run `django show_settings SettingName` command (replace SettingName with the name of the setting you are interested in). See [running django command](#running-django-commands) for more details. ## Sync OpenStack resources To sync OpenStack resources, you first need to [launch a CLI shell](#command-line-interface). Once the shell is opened, you can sync OpenStack resources using the following command: ```shell /var/webapps/fleio/scripts/sync ```