# Provisioner installation with FluxCD

{% hint style="warning" %}
Ensure the cluster meets the [prerequisites](https://docs.perfectscale.io/2.0-self-hosted-or-perfectscale-documentation/getting-started/cluster-prerequisites) before installing the provisioner with FluxCD.
{% endhint %}

## Provisioner installation with FluxCD

### Step 1: Get installation files

To install the Provisioner, you'll need the **provisioner binary**, **helmfile.yaml**, **config.yaml**, and **tenant\_id**. To obtain these files, please contact us at [sales@perfectscale.io](https://maito:sales@perfectscale.io).

{% hint style="info" %}
Make sure to save both the **provisioner binary,** **helmfile.yaml**, and **config.yaml** in the same directory on your system.
{% endhint %}

### Step 2: Create a dedicated namespace

Create a namespace for the on-premises installation:

```yaml
kubectl create ns <namespace_name> # replace "namespace_name" with your namespace name
```

### Step 3: Configure installation parameters

Create a *config.yaml* file in the same directory as your Binary installation file and Helmfile

<pre class="language-yaml"><code class="lang-yaml">access_key: 
secret_key: 
suffix_url: "DNS name"
tenant_id: "vendor_tenant_id" # provided by PerfectScale
namespace: &#x3C;namespace_name>
kube_context: &#x3C;k8s_cluster_context>
kube_config: &#x3C;path_to_kubeconfig_file>
<strong>helmfile: "helmfile.yaml" # provided by PerfectScale
</strong></code></pre>

### Step 4: Generate and apply the secrets

To generate the secrets, run the following command.&#x20;

```
./provisioner generate-secrets > secrets.yaml
```

{% hint style="warning" %}
For security reasons, PerfectScale does not store your secret key. We recommend you save the secrets to avoid losing them.
{% endhint %}

Apply the generated secrets in the target namespace.

```
kubectl apply -f secrets.yaml -n <namespace_name>
```

### Step 5: Generate and apply the Flux configuration file

To generate the Flux configuration file, run the following command.&#x20;

```
./provisioner generate-flux > flux.yaml
```

Once saved, apply this file and check the Pod’s status in your target namespace.

```
kubectl apply -f flux.yaml
```

### Step 6: Accessing PerfectScale WebApp UI

In order to access PerfectScale WebApp, you need to get the WebApp URL. Run the following command to retrieve the WebApp URL and get the credentials:

```yaml
./provisioner get-login
```

You now possess all the necessary data to access your PerfectScale account, including the ingress URL, username, password, etc.

## Verifying installation

1. Check the flux-system namespace and the logs of the following pods:
   * helm-controller
   * source-controller
2. Check the helm release with the following command:

```
kubectl get helmrelease -n <namespace_name>
```

{% hint style="info" %}
All the Helm releases should be in the `Ready` state.
{% endhint %}

3. Check the events of the PerfectScale pods from the target namespace. For example:

```
kubectl describe pod psc-tenant-manager -n <namespace_name>
```

If something doesn't work as expected, or you have any questions, reach out to support at <support@perfectscale.io>.
