Flagger
Search…
Flagger Install on Kubernetes
This guide walks you through setting up Flagger on a Kubernetes cluster with Helm v3 or Kustomize.

Prerequisites

Flagger requires a Kubernetes cluster v1.16 or newer.

Install Flagger with Helm

Add Flagger Helm repository:
1
helm repo add flagger https://flagger.app
Copied!
Install Flagger's Canary CRD:
1
kubectl apply -f https://raw.githubusercontent.com/fluxcd/flagger/main/artifacts/flagger/crd.yaml
Copied!
Deploy Flagger for Istio:
1
helm upgrade -i flagger flagger/flagger \
2
--namespace=istio-system \
3
--set crd.create=false \
4
--set meshProvider=istio \
5
--set metricsServer=http://prometheus:9090
Copied!
Note that Flagger depends on Istio telemetry and Prometheus, if you're installing Istio with istioctl then you should be using the default profile.
For Istio multi-cluster shared control plane you can install Flagger on each remote cluster and set the Istio control plane host cluster kubeconfig:
1
helm upgrade -i flagger flagger/flagger \
2
--namespace=istio-system \
3
--set crd.create=false \
4
--set meshProvider=istio \
5
--set metricsServer=http://istio-cluster-prometheus:9090 \
6
--set istio.kubeconfig.secretName=istio-kubeconfig \
7
--set istio.kubeconfig.key=kubeconfig
Copied!
Note that the Istio kubeconfig must be stored in a Kubernetes secret with a data key named kubeconfig. For more details on how to configure Istio multi-cluster credentials read the Istio docs.
Deploy Flagger for Linkerd:
1
helm upgrade -i flagger flagger/flagger \
2
--namespace=linkerd \
3
--set crd.create=false \
4
--set meshProvider=linkerd \
5
--set metricsServer=http://linkerd-prometheus:9090
Copied!
Deploy Flagger for App Mesh:
1
helm upgrade -i flagger flagger/flagger \
2
--namespace=appmesh-system \
3
--set crd.create=false \
4
--set meshProvider=appmesh \
5
--set metricsServer=http://appmesh-prometheus:9090
Copied!
Deploy Flagger for Open Service Mesh (OSM) (requires OSM to have been installed with Prometheus):
1
$ helm upgrade -i flagger flagger/flagger \
2
--namespace=osm-system \
3
--set crd.create=false \
4
--set meshProvider=osm \
5
--set metricsServer=http://osm-prometheus.osm-system.svc:7070
Copied!
You can install Flagger in any namespace as long as it can talk to the Prometheus service on port 9090.
For ingress controllers, the install instructions are:
You can use the helm template command and apply the generated yaml with kubectl:
1
# generate
2
helm fetch --untar --untardir . flagger/flagger &&
3
helm template flagger ./flagger \
4
--namespace=istio-system \
5
--set metricsServer=http://prometheus.istio-system:9090 \
6
> flagger.yaml
7
8
# apply
9
kubectl apply -f flagger.yaml
Copied!
To uninstall the Flagger release with Helm run:
1
helm delete flagger
Copied!
The command removes all the Kubernetes components associated with the chart and deletes the release.
Note that on uninstall the Canary CRD will not be removed. Deleting the CRD will make Kubernetes remove all the objects owned by Flagger like Istio virtual services, Kubernetes deployments and ClusterIP services.
If you want to remove all the objects created by Flagger you have delete the Canary CRD with kubectl:
1
kubectl delete crd canaries.flagger.app
Copied!

Install Grafana with Helm

Flagger comes with a Grafana dashboard made for monitoring the canary analysis.
Deploy Grafana in the istio-system namespace:
1
helm upgrade -i flagger-grafana flagger/grafana \
2
--namespace=istio-system \
3
--set url=http://prometheus.istio-system:9090 \
4
--set user=admin \
5
--set password=change-me
Copied!
Or use helm template command and apply the generated yaml with kubectl:
1
# generate
2
helm fetch --untar --untardir . flagger/grafana &&
3
helm template flagger-grafana ./grafana \
4
--namespace=istio-system \
5
> flagger-grafana.yaml
6
7
# apply
8
kubectl apply -f flagger-grafana.yaml
Copied!
You can access Grafana using port forwarding:
1
kubectl -n istio-system port-forward svc/flagger-grafana 3000:80
Copied!

Install Flagger with Kustomize

As an alternative to Helm, Flagger can be installed with Kustomize 3.5.0 or newer.
Service mesh specific installers
Install Flagger for Istio:
1
kustomize build https://github.com/fluxcd/flagger/kustomize/istio?ref=main | kubectl apply -f -
Copied!
Install Flagger for AWS App Mesh:
1
kustomize build https://github.com/fluxcd/flagger/kustomize/appmesh?ref=main | kubectl apply -f -
Copied!
This deploys Flagger and sets the metrics server URL to App Mesh's Prometheus instance.
Install Flagger for Linkerd:
1
kustomize build https://github.com/fluxcd/flagger/kustomize/linkerd?ref=main | kubectl apply -f -
Copied!
This deploys Flagger in the linkerd namespace and sets the metrics server URL to Linkerd's Prometheus instance.
Install Flagger for Open Service Mesh:
1
kustomize build https://github.com/fluxcd/flagger/kustomize/osm?ref=main | kubectl apply -f -
Copied!
This deploys Flagger in the osm-system namespace and sets the metrics server URL to OSM's Prometheus instance.
If you want to install a specific Flagger release, add the version number to the URL:
1
kustomize build https://github.com/fluxcd/flagger/kustomize/linkerd?ref=v1.0.0 | kubectl apply -f -
Copied!
Generic installer
Install Flagger and Prometheus for Contour, Gloo, NGINX, Skipper, or Traefik ingress:
1
kustomize build https://github.com/fluxcd/flagger/kustomize/kubernetes?ref=main | kubectl apply -f -
Copied!
This deploys Flagger and Prometheus in the flagger-system namespace, sets the metrics server URL to http://flagger-prometheus.flagger-system:9090 and the mesh provider to kubernetes.
The Prometheus instance has a two hours data retention and is configured to scrape all pods in your cluster that have the prometheus.io/scrape: "true" annotation.
To target a different provider you can specify it in the canary custom resource:
1
apiVersion: flagger.app/v1beta1
2
kind: Canary
3
metadata:
4
name: app
5
namespace: test
6
spec:
7
# can be: kubernetes, istio, linkerd, appmesh, nginx, skipper, gloo, traefik, osm
8
# use the kubernetes provider for Blue/Green style deployments
9
provider: nginx
Copied!
Customized installer
Create a kustomization file using Flagger as base and patch the container args:
1
cat > kustomization.yaml <<EOF
2
namespace: istio-system
3
bases:
4
- https://github.com/fluxcd/flagger/kustomize/kubernetes?ref=main
5
patches:
6
- target:
7
kind: Deployment
8
name: flagger
9
patch: |-
10
apiVersion: apps/v1
11
kind: Deployment
12
metadata:
13
name: flagger
14
spec:
15
template:
16
spec:
17
containers:
18
- name: flagger
19
args:
20
- -mesh-provider=istio
21
- -metrics-server=http://prometheus.istio-system:9090
22
- -include-label-prefix=app.kubernetes.io
23
EOF
Copied!
Last modified 3mo ago