Skip to content

Commit ed0221d

Browse files
authored
docs: added Deployment and migrate via FluxCD (#110)
* docs: add flux deploment * docs: enable FluxCD integration * docs: added migrate FluxCD * docs: technical fixes * docs: content fixed * docs: optimised for OSS and enteprise * docs: added figure and captions * docs: fixes * docs: optimised for gitbook * docs: added enterprise tagging * docs: added rbac * docs: gitbook optimizations * docs: minor fixes docs: minor fixes * docs: minor fixes docs: minor fixes * docs: implemented suggestions * docs: implement suggestions v2 * docs: added images and captions * docs * docs: optimizations for gitbook * docs: update summary.md * docs: fixes * docs: implmented requested changes * docs: minor fixes * docs: minor fixes * docs: fixes links * docs: fix * docs: fix * docs: fix * docs: fix * docs: fix * docs: fix
1 parent 0c56d87 commit ed0221d

File tree

4 files changed

+250
-16
lines changed

4 files changed

+250
-16
lines changed

docs/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@
176176
* [Terraform CLI](user-guide/plugins/terraform-cli.md)
177177
* [Vulnerability Scanning](user-guide/plugins/vulnerability-scanning.md)
178178
* [Using Devtron Intelligence](user-guide/devtron-intelligence.md)
179+
* [Enable GitOps Deployments with FluxCD](user-guide/creating-application/fluxcd.md)
179180

180181
## Resources
181182

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# Enable GitOps Deployments with FluxCD
2+
3+
{% hint style="info" %}
4+
### Prerequisite
5+
6+
Make sure to install:
7+
8+
1. [Build and Deploy (CI/CD) integration](../integrations/build-and-deploy-ci-cd.md)
9+
10+
2. [GitOps (ArgoCD) integration](../integrations/argocd.md)
11+
12+
{% endhint %}
13+
14+
Devtron supports FluxCD to enable GitOps-based deployments. With FluxCD, you can:
15+
16+
* Deploy applications via GitOps (via FluxCD).
17+
18+
* Deploy Helm charts via FluxCD.
19+
20+
* Migrate existing FluxCD applications into Devtron.
21+
22+
Your Git repository becomes the single source of truth for your Kubernetes workloads. Any changes you make in Git are automatically applied to your Kubernetes cluster by FluxCD. Refer to the [FluxCD documentation](https://fluxcd.io/flux/) to learn more.
23+
24+
25+
## Installation
26+
27+
{% hint style="warning" %}
28+
### Who Can Perform This Action?
29+
The user must have permissions to:
30+
* Edit the ConfigMaps of 'default-cluster'
31+
* Restart the pods
32+
{% endhint %}
33+
34+
To enable deployments through GitOps via FluxCD, you need to enable a specific feature flag for the `default_cluster` in Devtron.
35+
36+
|Feature|Flag|Description|
37+
|:---|:---|:---|
38+
|**Deployments via FluxCD**|`FEATURE_FLUX_DEPLOYMENTS_ENABLE: "true"`|This flag will enable deployments through GitOps via FluxCD.<ul><li> After enabling this flag, you also need to install FluxCD controller in order to deploy applications successfully. Refer [Installing FluxCD Controller](#installing-fluxcd-controller-only-for-deployments) to know more.</li></ul>|
39+
|**Migrating existing FluxCD applications**|`FEATURE_LINK_EXTERNAL_FLUX_ENABLE: "true"`|This flag will enable migrations for external FluxCD apps into Devtron.|
40+
41+
{% hint style="warning" %}
42+
### Deployment Strategies for FluxCD Deployments
43+
44+
Application deployments through GitOps (via FluxCD) are supported only when using the `Deployment` or `Rollout` deployment strategies with the latest chart versions. Other deployment strategies are currently not supported.
45+
{% endhint %}
46+
47+
### Enabling Feature Flags
48+
49+
1. Navigate to Devtron's **Resource Browser**.
50+
51+
![Figure 1: Navigating to Resource Browser](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/fluxcd/fluxcd-resource-browser.jpg)
52+
53+
2. Select the `default_cluster` to enable the feature flags.
54+
55+
![Figure 2: Selecting 'default_cluster'](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/fluxcd/fluxcd-select-cluster.jpg)
56+
57+
3. Go to Config & Storage → ConfigMap, and click `dashboard-cm` ConfigMap
58+
59+
![Figure 3: Clicking 'dashboard-cm'](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/fluxcd/fluxcd-select-dashboard-cm.jpg)
60+
61+
4. Edit the `dashboard-cm` ConfigMap by clicking **Edit live manifest**.
62+
63+
![Figure 4: Editing Live Manifest](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/fluxcd/fluxcd-edit-live-manifest.jpg)
64+
1. To enable deployments via FluxCD, check if the below entries are present in the ConfigMap (create one if it doesn't exist) and select **Apply changes**.<br>
65+
66+
```yaml
67+
FEATURE_FLUX_DEPLOYMENTS_ENABLE: "true"
68+
```
69+
70+
2. To enable migration for external FluxCD applications, check if the below entries are present in the ConfigMap (create one if it doesn't exist) and select **Apply changes**.<br>
71+
72+
```yaml
73+
FEATURE_LINK_EXTERNAL_FLUX_ENABLE: "true"
74+
```
75+
76+
<br>
77+
78+
![Figure 5: Adding Feature Flags](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/fluxcd/fluxcd-add-flags.jpg)
79+
80+
5. Restart the deployment:
81+
1. **For OSS Users:**
82+
1. Navigate to Devtron's Resource Browser.
83+
84+
2. Select the cluster for which you have enabled the feature flags.
85+
86+
3. Click the **Terminal** tab.
87+
88+
4. Restart the deployment using the following command:
89+
90+
```yaml
91+
kubectl rollout restart deployment dashboard -n devtroncd
92+
```
93+
94+
![Figure 6: Restarting Deployment](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/fluxcd/fluxcd-restart-deployment.gif)
95+
2. **For Enterprise Users:**
96+
1. Go to **Resource Browser** → (select the cluster in which you have enabled the feature flags) → **Workloads** → **Deployment**
97+
98+
2. Click the checkbox next to the `dashboard` Deployment workloads and restart them using the `⟳` button.
99+
100+
![Figure 7: Restart 'dashboard' deployment workloads](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/kubernetes-resource-browser/devtron-intelligence/restart-deployments.jpg)
101+
102+
6. Perform a hard refresh of the browser to clear the cache:
103+
104+
* **Mac**: Hold down Cmd and Shift and then press R.
105+
106+
* **Windows/Linux**: Hold down Ctrl and then press F5.
107+
108+
### Installing FluxCD Controller (Only for Deployments)
109+
110+
After enabling the feature flag for deployments, the next step is to install FluxCD Controller in every cluster (including the default cluster) in which you want to deploy the FluxCD applications.
111+
112+
You can install FluxCD Controller by any of the following ways:
113+
114+
1. [Install FluxCD controller via Cluster Terminal](#install-fluxcd-controller-via-cluster-terminal) (Recommended)
115+
116+
2. [Install FluxCD controller via Chart Store](#install-fluxcd-controller-via-chart-store)
117+
118+
119+
#### Install FluxCD controller via Cluster Terminal.
120+
121+
1. Navigate to Devtron's Resource Browser.
122+
123+
2. Select the cluster for which you have enabled the feature flags.
124+
125+
3. Click the **Terminal** tab.
126+
127+
4. Run the following command to install the FluxCD Controller:
128+
129+
```yaml
130+
kubectl apply -f https://github.com/fluxcd/flux2/releases/download/v0.35.0/install.yaml
131+
```
132+
133+
![Figure 8: Installing FluxCD Controller](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/fluxcd/fluxcd-install-controller.gif)
134+
135+
5. After the command is executed successfully, you can deploy or migrate your applications in that cluster through GitOps (via FluxCD).
136+
137+
#### Install FluxCD controller via Chart Store.
138+
139+
To install FluxCD controller via Chart Store, follow the below steps.
140+
141+
1. Add FluxCD controller repository, `https://fluxcd-community.github.io/helm-charts` in the chart repositories (if not already added) in Global Configurations. Refer [Chart Repositories](../global-configurations/chart-repo.md#add-chart-repository) to learn more.
142+
143+
![Figure 9: Adding FluxCD Chart Repository](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/fluxcd/fluxcd-add-chart-repo.gif)
144+
145+
2. Add a new environment in the cluster in which you want to deploy the application via FluxCD linked to namespace as `flux-system`. Refer [Clusters and Environments](../global-configurations/cluster-and-environments.md#add-environment-to-a-cluster) to lean more.
146+
147+
![Figure 10: Adding Environment linked to 'flux-system' namespace](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/fluxcd/fluxcd-add-env.gif)
148+
149+
3. Navigate to **Chart Store** and select the `flux2` chart.
150+
151+
![Figure 11: Selecting 'flux2' Chart](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/fluxcd/fluxcd-flux2.jpg)
152+
153+
4. Click **Configure and Deploy**.
154+
155+
![Figure 12: Deploying 'flux2' Chart](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/fluxcd/fluxcd-deploy-chart.jpg)
156+
157+
5. Configure the following configurations:
158+
159+
|Field Name|Description|
160+
|:---|:---|
161+
|**App Name**|Define a name for the chart.|
162+
|**Project**|Select a project from the dropdown|
163+
|**Deploy to Environment**|Select the environment which you have created in your preferred cluster linked to `flux-system` namespace.|
164+
165+
![Figure 13: Configuring 'flux2' Chart](https://devtron-public-asset.s3.us-east-2.amazonaws.com/images/creating-application/fluxcd/fluxcd-chart-config.jpg)
166+
167+
6. Click **Deploy** and the chart will be deployed.
168+
169+
After the chart is successfully deployed, you can deploy applications though GitOps (via FluxCD).

0 commit comments

Comments
 (0)