@@ -13,10 +13,10 @@ Components:
13
13
* manages the traffic flows between microservices, enforcing access policies and aggregating telemetry data
14
14
* ** Prometheus** monitoring system
15
15
* time series database that collects and stores the service mesh metrics
16
- * ** Flux** GitOps Toolkit
16
+ * ** Flux v2 ** continuous delivery
17
17
* syncs YAMLs and Helm charts between git and clusters
18
18
* scans container registries and deploys new images
19
- * ** Flagger** progressive delivery operator
19
+ * ** Flagger** progressive delivery
20
20
* automates the release process using Istio routing for traffic shifting and Prometheus metrics for canary analysis
21
21
22
22
### Prerequisites
@@ -48,8 +48,7 @@ flux bootstrap git \
48
48
--path=clusters/my-cluster
49
49
```
50
50
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.
53
52
In order to sync your cluster state with git you need to copy the public key and create a deploy key with write
54
53
access on your GitHub repository. On GitHub go to _ Settings > Deploy keys_ click on _ Add deploy key_ ,
55
54
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:
65
64
* creates the frontend deployment and canary
66
65
* creates the backend deployment and canary
67
66
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
+
68
99
![ Flux Istio Operator] ( https://raw.githubusercontent.com/fluxcd/helm-operator-get-started/master/diagrams/flux-istio-operator.png )
69
100
70
101
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
74
105
apiVersion : install.istio.io/v1alpha1
75
106
kind : IstioOperator
76
107
metadata :
77
- namespace : istio-system
78
108
name : istio-default
109
+ namespace : istio-system
79
110
spec :
80
111
profile : demo
81
112
components :
90
121
After modifying the Istio settings, you can push the change to git and Flux will apply it on the cluster.
91
122
The Istio operator will reconfigure the Istio control plane according to your changes.
92
123
93
- ### Workloads bootstrap
124
+ ### App bootstrap
94
125
95
126
When Flux syncs the Git repository with your cluster, it creates the frontend/backend deployment, HPA and a canary object.
96
127
Flagger uses the canary definition to create a series of objects: Kubernetes deployments,
@@ -171,10 +202,16 @@ git commit -m "backend 5.0.1" && \
171
202
git push origin main
172
203
```
173
204
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:
175
212
176
213
``` bash
177
- flux reconcile kustomization flux-system --with-source
214
+ watch flux get kustomizations
178
215
```
179
216
180
217
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
277
314
# ## Rollback based on Istio metrics
278
315
279
316
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)
281
318
defines two metric checks :
282
319
283
320
` ` ` yaml
@@ -336,44 +373,16 @@ You can extend the analysis with custom metric checks targeting
336
373
[Datadog](https://docs.flagger.app/usage/metrics#datadog) and
337
374
[Amazon CloudWatch](https://docs.flagger.app/usage/metrics#amazon-cloudwatch).
338
375
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
- 
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
- 
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).
369
378
370
379
# ## Getting Help
371
380
372
381
If you have any questions about progressive delivery :
373
382
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.
378
387
379
- Your feedback is always welcome!
388
+ Your feedback is always welcome!
0 commit comments