Monitoring a Single K8s Cluster

This document was translated by GPT-4

# 1. Introduction

If you have deployed applications in a K8s cluster, this section introduces how to monitor them with DeepFlow. DeepFlow can non-intrusively collect all Pods' observational signals (AutoMetrics, AutoTracing, AutoProfiling), and it automatically injects 'K8s resource' and 'K8s custom Label' tags (AutoTagging) into all observational data based on the information calls to the apiserver.

# 2. Preliminaries

# 2.1 Deployment Topology

# 2.2 Storage Class

We recommend using Persistent Volumes to store MySQL and ClickHouse data to avoid unnecessary maintenance cost. You can provide the default Storage Class or add --set global.storageClass=<your storageClass> parameter to choose the Storage Class to create PVC.

OpenEBS (opens new window) can be chosen for the creation of PVC:

kubectl apply -f https://openebs.github.io/charts/openebs-operator.yaml
## config default storage class
kubectl patch storageclass openebs-hostpath  -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
1
2
3

# 3. Deployment of DeepFlow

Deploy DeepFlow with Helm:

helm repo add deepflow https://deepflowio.github.io/deepflow
helm repo update deepflow # use `helm repo update` when helm < 3.7.0
helm install deepflow -n deepflow deepflow/deepflow --create-namespace
1
2
3
helm repo add deepflow https://deepflow-ce.oss-cn-beijing.aliyuncs.com/chart/stable
helm repo update deepflow # use `helm repo update` when helm < 3.7.0
cat << EOF > values-custom.yaml
global:
  image:
      repository: registry.cn-beijing.aliyuncs.com/deepflow-ce
grafana:
  image:
    repository: registry.cn-beijing.aliyuncs.com/deepflow-ce/grafana
EOF
helm install deepflow -n deepflow deepflow/deepflow --create-namespace \
  -f values-custom.yaml
1
2
3
4
5
6
7
8
9
10
11
12

Note:

  • Use helm --set global.storageClass to specify storageClass
  • Use helm --set global.replicas to specify the number of replicas for deepflow-server and clickhouse
  • We recommend saving the contents of helm's --set parameter in a separate yaml file. Refer to the chapter Advanced Config.

# 4. Download deepflow-ctl

Deepflow-ctl is a command-line tool for managing DeepFlow. It's recommended to download it to the K8s Node where deepflow-server is located for future use.

curl -o /usr/bin/deepflow-ctl https://deepflow-ce.oss-cn-beijing.aliyuncs.com/bin/ctl/stable/linux/$(arch | sed 's|x86_64|amd64|' | sed 's|aarch64|arm64|')/deepflow-ctl
chmod a+x /usr/bin/deepflow-ctl
1
2

# 5. Access the Grafana Page

The content output when executing helm deployment of DeepFlow prompts the command to get the URL and password to access Grafana. The output example:

NODE_PORT=$(kubectl get --namespace deepflow -o jsonpath="{.spec.ports[0].nodePort}" services deepflow-grafana)
NODE_IP=$(kubectl get nodes -o jsonpath="{.items[0].status.addresses[0].address}")
echo -e "Grafana URL: http://$NODE_IP:$NODE_PORT  \nGrafana auth: admin:deepflow"
1
2
3

Sample output after executing the above command:

Grafana URL: http://10.1.2.3:31999
Grafana auth: admin:deepflow
1
2

# 6. Next Steps