# Flux

{% hint style="info" %}
This plugin is part of Pro and Enterprise plan only
{% endhint %}

{% hint style="warning" %}
This plugin is only available through self-hosting Galaxy
{% endhint %}

## Overview

Flux is a tool that enables continuous and automated deployment of workloads to Kubernetes. It ensures that the desired state of your Kubernetes cluster as represented in version control is consistently deployed and kept up-to-date.

Integrating your Flux installation with Rely.io enables tracking of mission-critical Flux resources and monitored repositories and applications, as well as the status of deployments when Flux triggers reconciliations.

## Installation Guide

This plugin requires access to the Kubernetes cluster in which Flux is deployed. Because of this, it is only available through our self-hosted Galaxy offering. See [self-hosting-plugins-using-galaxy](https://docs.rely.io/plugins-and-automation/self-hosting-plugins-using-galaxy "mention") on how to get started.

The plugin will discover all Flux resources in your cluster but will only track reconciliations for namespaces configured during installation.

The plugin leverages Flux's [Notification Controller](https://fluxcd.io/flux/components/notification/) to monitor events related to your Flux-tracked Kubernetes resources. This requires the plugin to create [Alerts](https://fluxcd.io/flux/components/notification/alerts/) and [Providers](https://fluxcd.io/flux/components/notification/providers/) in the namespaces you wish to monitor. Make sure the account installing the Helm Chart has the required permissions to do so.

### Setup

To configure the Flux integration within your Rely.io instance, follow these steps:

1. Navigate to the **Plugins** section within the **Portal Builder** section of the side panel.
2. Click "Add Data Source" and select the **Flux** plugin.
3. Take note of your `RELY_API_TOKEN` and `RELY_INTEGRATION_ID`.
4. Install the Helm Chart on your Kubernetes cluster, ensuring the the following:
   * `integration.type` is set to `flux`
   * `integration.executionType` is set to `daemon`
   * `flux.namespaces` is set to the array of namespaces you want to monitor
   * `env.RELY_API_TOKEN` and `env.RELY_INTEGRATION_ID` properly set with the values in the plugin page
5. On successful install, Galaxy will perform the following tasks:

   * Extend your Data Model with Kubernetes Cluster, Kubernetes Namespace, Flux Source, Flux Application and Flux Pipeline blueprints.
   * Pull all available Flux resources in the cluster to backfill your catalog.
   * Monitor Flux reconciliation events in real-time and push information related your workload deployments.

Below is an example command for installing the Helm Chart:

```bash
helm upgrade --install rely-galaxy \
  --set integration.type=flux \
  --set integration.executionType=daemon \
  --set "flux.namespaces={foo,bar}" \
  --set env.RELY_API_TOKEN=rely_api_token \
  --set env.RELY_INTEGRATION_ID=12345678 \
  -n rely-galaxy \
  oci://registry-1.docker.io/devrelyio/galaxy-helm
```

### Additional configuration

By default, standard system Kubernetes namespaces are ignored when collecting Flux resources; this can be changed by setting `env.RELY_INTEGRATION_FLUX_EXCLUDE_SYSTEM_NAMESPACES` to `false`.

In addition to plugin-specific configuration options, you can also configure how often the integration runs by setting `daemonInterval`. See [self-hosting-plugins-using-galaxy](https://docs.rely.io/plugins-and-automation/self-hosting-plugins-using-galaxy "mention") and check out the [Galaxy - OSS repository](https://github.com/Rely-io/galaxy-oss) for all details on how to configure your integration installation.
