Kubernetes
Periodically query the K8s API-server (the same endpoint kubectl uses) to collect cluster-wide state: Node count, per-Node health, per-Pod status, etc.
Prerequisites
- Deploy SmartGate inside the target cluster.
- ONE platform can reach the cluster network.
Getting Started
SmartGate follows the Prometheus-Operator CRD pattern.
Declare what you want to scrape with two custom resources:
| CRD | Purpose |
|---|---|
| PodMonitor | Scrape individual Pods (by label) |
| ServiceMonitor | Scrape Services (by label) |
Minimal required manifests:
# PodMonitor
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
namespace: bonree-agent # fixed namespace
name: pod-monitor-{NAME_RANDOM_SUFFIX_NO} # choose unique name
spec:
namespaceSelector:
matchNames:
# limit namespaces (omit = all)
- defaultNamespace
selector:
matchLabels:
# target Pod labels
foo01: bar01
foo02: bar02
podMetricsEndpoints:
- scheme: https # http or https
port: metrics
path: /metrics
tlsConfig:
insecureSkipVerify: true
relabelings: []
# ServiceMonitor
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
namespace: bonree-agent # fixed namespace
name: service-monitor-{NAME_RANDOM_SUFFIX_NO} # choose unique name
spec:
namespaceSelector:
matchNames:
# limit namespaces (omit = all)
- defaultNamespace
selector:
matchLabels:
# target Pod labels
foo01: bar01
foo02: bar02
endpoints:
- scheme: https # http or https
path: /metrics
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
tlsConfig:
insecureSkipVerify: true
relabelings: []
- Apply the manifests; SmartGate watches the CRDs and starts scraping automatically.
Configure Data Stream
- ONE provides out-of-the-box streams for:
- API Server
- Kube Contiller Manager
- Kube Scheduler
- CoreDNS
- ETCD
- Kubelet
- Nginx Ingress Controller
- Kube State Metrics
- You can also build custom streams for any additional scenario.
Verification
- Review registered Metrics under Insight → Data Model → Metrics.
- Explore live data under Insight → Data Explorer.