ArgoCD Metrics Collection with Kubernetes KIND Cluster
Table of Contents generated with DocToc
Argo CD Metrics Collection with Kubernetes KIND Cluster
This is a tutorial for how to collect Argo CD metrics with Kubernetes KIND Cluster. The demo is trying to use argocd
UI.
For UI, the tutorial is using NodePort
with Kubernetes KIND Cluster to enable end user can login to the Argo CD UI.
Create a KIND Cluster
First we need create a Cluster config for KIND with extraPortMappings
, this can enable NodePort
for this KIND cluster for future access of Argo CD UI.
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
extraPortMappings:
- containerPort: 31923
hostPort: 8080
- containerPort: 31925
hostPort: 8082
Save above file as cluster.yaml
and run the following command to deploy the KIND cluster:
kind create cluster --config cluster.yaml --name argocd
The output of the above command can be as follows:
root@gyliu-dev21:~/kind# kind create cluster --config cluster.yaml --name argocd
Creating cluster "argocd" ...
โ Ensuring node image (kindest/node:v1.21.1) ๐ผ
โ Preparing nodes ๐ฆ
โ Writing configuration ๐
โ Starting control-plane ๐น๏ธ
โ Installing CNI ๐
โ Installing StorageClass ๐พ
Set kubectl context to "kind-argocd"
You can now use your cluster with:
kubectl cluster-info --context kind-argocd
Thanks for using kind! ๐
After the kind create
finished, check all nodes are ready:
kubectl get nodes
The output of the above command can be as follows:
root@gyliu-dev21:~/kind# kubectl get nodes
NAME STATUS ROLES AGE VERSION
argocd-control-plane Ready control-plane,master 4m28s v1.21.1
Install Argo CD
Checkout Argo CD quickstart to get more detail, here we will show some key steps to help you go through the tutorial here.
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Enable NodePort for Argo CD server
In the tutorial, NodePort
was enabled in the KIND Cluster, so here we will use NodePort
to access the Argo CD server.
root@gyliu-dev21:~# kubectl get svc -n argocd
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
argocd-dex-server ClusterIP 10.96.19.236 <none> 5556/TCP,5557/TCP,5558/TCP 2m53s
argocd-metrics ClusterIP 10.96.199.1 <none> 8082/TCP 2m53s
argocd-redis ClusterIP 10.96.211.183 <none> 6379/TCP 2m53s
argocd-repo-server ClusterIP 10.96.146.212 <none> 8081/TCP,8084/TCP 2m53s
argocd-server ClusterIP 10.96.163.35 <none> 80/TCP,443/TCP 2m53s
argocd-server-metrics ClusterIP 10.96.16.62 <none> 8083/TCP 2m53s
Here we need to update the service argocd-server
and enable it to use NodePort
via following CLI:
kubectl edit svc -n argocd argocd-server
After update, you can see the argocd-server
PORT(S)
is as follows:
root@gyliu-dev21:~# kubectl get svc -n argocd argocd-server
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
argocd-server NodePort 10.96.163.35 <none> 80:31328/TCP,443:31923/TCP 7m16s
NOTE: Make sure 443
map to 31923
as we configured in cluster.yaml
, so that you can access the Argo CD UI via https://<Host IP Where your KIND Cluster is running>:8080
.
In the tutorial, the host IP is 9.30.45.46
, so we are using https://9.30.45.46:8080/
to access the argocd UI.
You can navigate to your Argo CD UI now!
The initial password for the admin
account is auto-generated and stored as clear text in the field password
in a secret named argocd-initial-admin-secret
in your Argo CD installation namespace. You can simply retrieve this password using kubectl:
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d && echo
Input username admin
and password, you will be able to login to Argo CD UI.
Enable NodePort for Argo CD Metrics
kubectl edit svc -n argocd argocd-metrics
root@gyliu-d51:~/argo# kc get svc -n argocd argocd-metrics
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
argocd-metrics NodePort 10.96.84.131 <none> 8082:31925/TCP 134m
NOTE: Make sure 8082
map to 31925
as we configured in cluster.yaml
, so that you can access the Argo CD Metrics Service via https://<Host IP Where your KIND Cluster is running>:8082/metrics
.
# HELP argocd_redis_request_duration Redis requests duration.
# TYPE argocd_redis_request_duration histogram
argocd_redis_request_duration_bucket{hostname="argocd-application-controller-0",initiator="argocd-application-controller",le="0.01"} 14
argocd_redis_request_duration_bucket{hostname="argocd-application-controller-0",initiator="argocd-application-controller",le="0.05"} 14
argocd_redis_request_duration_bucket{hostname="argocd-application-controller-0",initiator="argocd-application-controller",le="0.1"} 15
argocd_redis_request_duration_bucket{hostname="argocd-application-controller-0",initiator="argocd-application-controller",le="0.25"} 15
argocd_redis_request_duration_bucket{hostname="argocd-application-controller-0",initiator="argocd-application-controller",le="0.5"} 15
argocd_redis_request_duration_bucket{hostname="argocd-application-controller-0",initiator="argocd-application-controller",le="1"} 15
argocd_redis_request_duration_bucket{hostname="argocd-application-controller-0",initiator="argocd-application-controller",le="+Inf"} 15
argocd_redis_request_duration_sum{hostname="argocd-application-controller-0",initiator="argocd-application-controller"} 0.079432091
argocd_redis_request_duration_count{hostname="argocd-application-controller-0",initiator="argocd-application-controller"} 15
# HELP argocd_redis_request_total Number of redis requests executed during application reconciliation.
# TYPE argocd_redis_request_total counter
argocd_redis_request_total{failed="false",hostname="argocd-application-controller-0",initiator="argocd-application-controller"} 14
argocd_redis_request_total{failed="true",hostname="argocd-application-controller-0",initiator="argocd-application-controller"} 1
# HELP certwatcher_read_certificate_errors_total Total number of certificate read errors
# TYPE certwatcher_read_certificate_errors_total counter
certwatcher_read_certificate_errors_total 0
# HELP certwatcher_read_certificate_total Total number of certificate reads
# TYPE certwatcher_read_certificate_total counter
certwatcher_read_certificate_total 0
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0.000115063
go_gc_duration_seconds{quantile="0.25"} 0.000197908
go_gc_duration_seconds{quantile="0.5"} 0.000223097
go_gc_duration_seconds{quantile="0.75"} 0.000228051
go_gc_duration_seconds{quantile="1"} 0.001155672
go_gc_duration_seconds_sum 0.001919791
go_gc_duration_seconds_count 5
# HELP go_goroutines Number of goroutines that currently exist.
Deploy a Sample App
Refer to Create An Application From A Git Repository to deploy your sample GitOps Apps, you will see more metrics from Argo CD Metrics service.