日志适配
-
docker: 容器日志与日志 label 均从目录
/var/lib/docker/containers/<container-id>/xxx
获取 -
container: 改为日志从
/var/log/containers
获取,日志 label 从 kube-apiserver 获取
前提是部署好 prometheus 和 grafana
kubectl apply -f https://raw.githubusercontent.com/kata-containers/kata-containers/main/docs/how-to/data/kata-monitor-daemonset.yml
spec:
additionalScrapeConfigs:
- job_name: 'kata'
static_configs:
- targets: ['localhost:8090']
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: kata-monitor
namespace: kata-system
spec:
endpoints:
- interval: 15s
path: /metrics
port: metrics
namespaceSelector:
any: true
selector:
matchLabels:
app: kata-monitor
---
apiVersion: v1
kind: Service
metadata:
labels:
app: kata-monitor
name: kata-monitor
namespace: kata-system
spec:
ports:
- name: metrics
port: 8090
protocol: TCP
targetPort: 8090
selector:
app.kubernetes.io/name: kata-monitor
type: ClusterIP
导入 https://raw.githubusercontent.com/kata-containers/kata-containers/main/docs/how-to/data/dashboard.json
dashboard
https://github.com/kata-containers/kata-containers/blob/main/docs/design/kata-2-0-metrics.md