Skip to content

Commit 62d78f2

Browse files
committed
Update instructions for Flux v2
Signed-off-by: Stefan Prodan <[email protected]>
1 parent 22a885f commit 62d78f2

File tree

1 file changed

+53
-44
lines changed

1 file changed

+53
-44
lines changed

README.md

Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ Components:
1313
* manages the traffic flows between microservices, enforcing access policies and aggregating telemetry data
1414
* **Prometheus** monitoring system
1515
* time series database that collects and stores the service mesh metrics
16-
* **Flux** GitOps Toolkit
16+
* **Flux v2** continuous delivery
1717
* syncs YAMLs and Helm charts between git and clusters
1818
* scans container registries and deploys new images
19-
* **Flagger** progressive delivery operator
19+
* **Flagger** progressive delivery
2020
* automates the release process using Istio routing for traffic shifting and Prometheus metrics for canary analysis
2121

2222
### Prerequisites
@@ -48,8 +48,7 @@ flux bootstrap git \
4848
--path=clusters/my-cluster
4949
```
5050

51-
At bootstrap, Flux generates an SSH key and logs the public key. The above command will print the public key.
52-
51+
At bootstrap, Flux generates an SSH key and prints the public key.
5352
In order to sync your cluster state with git you need to copy the public key and create a deploy key with write
5453
access on your GitHub repository. On GitHub go to _Settings > Deploy keys_ click on _Add deploy key_,
5554
check _Allow write access_, paste the Flux public key and click _Add key_.
@@ -65,6 +64,38 @@ When Flux has access to your repository it will do the following:
6564
* creates the frontend deployment and canary
6665
* creates the backend deployment and canary
6766

67+
When bootstrapping a cluster with Istio, it is important to define the apply order. For the applications
68+
pods to be injected with Istio sidecar, the Istio control plane must be up and running before the apps.
69+
70+
With Flux v2 you can specify the execution order by defining dependencies between objects.
71+
For example, in [clusters/my-cluster/apps.yaml](https://github.com/stefanprodan/gitops-istio/blob/main/clusters/my-cluster/apps.yaml)
72+
we tell Flux that the `apps` reconciliation depends on the `istio` one:
73+
74+
```yaml
75+
apiVersion: kustomize.toolkit.fluxcd.io/v1beta1
76+
kind: Kustomization
77+
metadata:
78+
name: apps
79+
namespace: flux-system
80+
spec:
81+
interval: 30m0s
82+
dependsOn:
83+
- name: istio-system
84+
sourceRef:
85+
kind: GitRepository
86+
name: flux-system
87+
path: ./apps
88+
prune: true
89+
```
90+
91+
Watch Flux reconciling Istio, then the demo apps:
92+
93+
```bash
94+
watch flux get kustomizations
95+
```
96+
97+
### Istio customization
98+
6899
![Flux Istio Operator](https://raw.githubusercontent.com/fluxcd/helm-operator-get-started/master/diagrams/flux-istio-operator.png)
69100

70101
You can customize the Istio installation with the `IstioOperator` resource located at
@@ -74,8 +105,8 @@ You can customize the Istio installation with the `IstioOperator` resource locat
74105
apiVersion: install.istio.io/v1alpha1
75106
kind: IstioOperator
76107
metadata:
77-
namespace: istio-system
78108
name: istio-default
109+
namespace: istio-system
79110
spec:
80111
profile: demo
81112
components:
@@ -90,7 +121,7 @@ spec:
90121
After modifying the Istio settings, you can push the change to git and Flux will apply it on the cluster.
91122
The Istio operator will reconfigure the Istio control plane according to your changes.
92123
93-
### Workloads bootstrap
124+
### App bootstrap
94125
95126
When Flux syncs the Git repository with your cluster, it creates the frontend/backend deployment, HPA and a canary object.
96127
Flagger uses the canary definition to create a series of objects: Kubernetes deployments,
@@ -171,10 +202,16 @@ git commit -m "backend 5.0.1" && \
171202
git push origin main
172203
```
173204

174-
Tell Flux to pull the changes or wait one minute for Flux to detect the changes:
205+
Tell Flux to pull the changes or wait one minute for Flux to detect the changes on its own:
206+
207+
```bash
208+
flux reconcile source git flux-system
209+
```
210+
211+
Watch Flux reconciling your cluster to the latest commit:
175212

176213
```bash
177-
flux reconcile kustomization flux-system --with-source
214+
watch flux get kustomizations
178215
```
179216

180217
After a couple of seconds, Flagger detects that the deployment revision changed and starts a new rollout:
@@ -277,7 +314,7 @@ prod backend Succeeded 0
277314
### Rollback based on Istio metrics
278315

279316
Flagger makes use of the metrics provided by Istio telemetry to validate the canary workload.
280-
The frontend app [analysis](https://github.com/stefanprodan/gitops-istio/blob/master/prod/frontend/canary.yaml)
317+
The frontend app [analysis](https://github.com/stefanprodan/gitops-istio/blob/main/apps/frontend/canary.yaml)
281318
defines two metric checks:
282319

283320
```yaml
@@ -336,44 +373,16 @@ You can extend the analysis with custom metric checks targeting
336373
[Datadog](https://docs.flagger.app/usage/metrics#datadog) and
337374
[Amazon CloudWatch](https://docs.flagger.app/usage/metrics#amazon-cloudwatch).
338375

339-
### Alerting
340-
341-
Flagger can be configured to send Slack notifications.
342-
You can enable alerting by adding the Slack settings to Flagger's Helm Release:
343-
344-
```yaml
345-
apiVersion: helm.fluxcd.io/v1
346-
kind: HelmRelease
347-
metadata:
348-
name: flagger
349-
namespace: istio-system
350-
spec:
351-
values:
352-
slack:
353-
user: flagger
354-
channel: general
355-
url: https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK
356-
```
357-
358-
Once configured with a Slack incoming **webhook**, Flagger will post messages when a canary deployment
359-
has been initialised, when a new revision has been detected and if the canary analysis failed or succeeded.
360-
361-
![Slack Notifications](https://raw.githubusercontent.com/weaveworks/flagger/master/docs/screens/slack-canary-notifications.png)
362-
363-
A canary deployment will be rolled back if the progress deadline exceeded or if the analysis reached the
364-
maximum number of failed checks:
365-
366-
![Slack Notifications](https://raw.githubusercontent.com/weaveworks/flagger/master/docs/screens/slack-canary-failed.png)
367-
368-
For configuring alerting at canary level for Slack, MS Teams, Discord or Rocket see the [docs](https://docs.flagger.app/usage/alerting#canary-configuration).
376+
For configuring alerting of the canary analysis for Slack, MS Teams, Discord or Rocket see the
377+
[docs](https://docs.flagger.app/usage/alerting#canary-configuration).
369378

370379
### Getting Help
371380

372381
If you have any questions about progressive delivery:
373382

374-
* Invite yourself to the [Weave community slack](https://slack.weave.works/)
375-
and join the [#flux](https://weave-community.slack.com/messages/flux/) and [#flagger](https://weave-community.slack.com/messages/flagger/) channel.
376-
* Join the [Weave User Group](https://www.meetup.com/pro/Weave/) and get invited to online talks,
377-
hands-on training and meetups in your area.
383+
* Invite yourself to the [CNCF community slack](https://slack.cncf.io/)
384+
and join the [#flux](https://cloud-native.slack.com/messages/flux/) and [#flagger](https://cloud-native.slack.com/messages/flagger/) channel.
385+
* Check out the [Flux talks section](https://fluxcd.io/community/#talks) and to see a list of online talks,
386+
hands-on training and meetups.
378387

379-
Your feedback is always welcome!
388+
Your feedback is always welcome!

0 commit comments

Comments
 (0)