This guide walks you through setting up Flagger on Alibaba ServiceMesh.
Created an ACK(Alibabacloud Container Service for Kubernetes) cluster instance.
Created an ASM(Alibaba ServiceMesh) instance, and added ACK cluster.
$ACK_CONFIG
: the kubeconfig file path of ACK, which be treated as$HOME/.kube/config
in the rest of guide.
$MESH_CONFIG
: the kubeconfig file path of ASM.
$ISTIO_RELEASE
: see https://github.com/istio/istio/releases​
$FLAGGER_SRC
: see https://github.com/fluxcd/flagger​
Install Prometheus:
kubectl apply -f $ISTIO_RELEASE/samples/addons/prometheus.yaml
it' same with the below cmd:
kubectl --kubeconfig "$ACK_CONFIG" apply -f $ISTIO_RELEASE/samples/addons/prometheus.yaml
Append the below configs to scrape_configs
in prometheus configmap, to support telemetry:
scrape_configs:# Mixer scrapping. Defaults to Prometheus and mixer on same namespace.- job_name: 'istio-mesh'kubernetes_sd_configs:- role: endpointsnamespaces:names:- istio-systemrelabel_configs:- source_labels: [__meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]action: keepregex: istio-telemetry;prometheus# Scrape config for envoy stats- job_name: 'envoy-stats'metrics_path: /stats/prometheuskubernetes_sd_configs:- role: podrelabel_configs:- source_labels: [__meta_kubernetes_pod_container_port_name]action: keepregex: '.*-envoy-prom'- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]action: replaceregex: ([^:]+)(?::\d+)?;(\d+)replacement: $1:15090target_label: __address__- action: labeldropregex: __meta_kubernetes_pod_label_(.+)- source_labels: [__meta_kubernetes_namespace]action: replacetarget_label: namespace- source_labels: [__meta_kubernetes_pod_name]action: replacetarget_label: pod_name- job_name: 'istio-policy'kubernetes_sd_configs:- role: endpointsnamespaces:names:- istio-systemrelabel_configs:- source_labels: [__meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]action: keepregex: istio-policy;http-policy-monitoring- job_name: 'istio-telemetry'kubernetes_sd_configs:- role: endpointsnamespaces:names:- istio-systemrelabel_configs:- source_labels: [__meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]action: keepregex: istio-telemetry;http-monitoring- job_name: 'pilot'kubernetes_sd_configs:- role: endpointsnamespaces:names:- istio-systemrelabel_configs:- source_labels: [__meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]action: keepregex: istiod;http-monitoring- source_labels: [__meta_kubernetes_service_label_app]target_label: app- job_name: 'sidecar-injector'kubernetes_sd_configs:- role: endpointsnamespaces:names:- istio-systemrelabel_configs:- source_labels: [__meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]action: keepregex: istio-sidecar-injector;http-monitoring
Add Flagger Helm repository:
helm repo add flagger https://flagger.apphelm repo update
Install Flagger's Canary CRD:
kubectl apply -f $FLAGGER_SRC/artifacts/flagger/crd.yaml
Deploy Flagger for Alibaba ServiceMesh:
cp $MESH_CONFIG kubeconfigkubectl -n istio-system create secret generic istio-kubeconfig --from-file kubeconfigkubectl -n istio-system label secret istio-kubeconfig istio/multiCluster=truehelm upgrade -i flagger flagger/flagger \--namespace=istio-system \--set crd.create=false \--set meshProvider=istio \--set metricsServer=http://prometheus:9090 \--set istio.kubeconfig.secretName=istio-kubeconfig \--set istio.kubeconfig.key=kubeconfig