Quick Start
Deploy your first gNMIc telemetry collector
This guide walks you through deploying a complete telemetry collection setup with gNMIc Operator.
Overview
We’ll create:
- A TargetProfile with connection settings
- A Target pointing to a network device
- A Subscription defining what data to collect
- An Output to send data to Prometheus
- A Pipeline connecting everything together
- A Cluster to run the gNMIc collectors
Step 1: Create a TargetProfile
The TargetProfile defines shared settings for connecting to devices:
apiVersion: operator.gnmic.dev/v1alpha1
kind: TargetProfile
metadata:
name: default-profile
spec:
# Reference to a Secret containing username/password
credentialsRef: device-credentials
# TLS without server certificate verification
tls: {}
# Connection timeout
timeout: 10scat << 'EOF' | kubectl apply -f -
apiVersion: operator.gnmic.dev/v1alpha1
kind: TargetProfile
metadata:
name: default-profile
spec:
# Reference to a Secret containing username/password
credentialsRef: device-credentials
# TLS without server certificate verification
tls: {}
# Connection timeout
timeout: 10s
EOFCreate the credentials secret:
kubectl create secret generic device-credentials \
--from-literal=username=admin \
--from-literal=password=admin
Step 2: Create a Target
Define a network device to collect telemetry from.
Set the name, address and port to match your environment.
apiVersion: operator.gnmic.dev/v1alpha1
kind: Target
metadata:
name: router1
labels:
vendor: vendorA
role: core
spec:
address: 10.0.0.1:57400
profile: default-profilecat << 'EOF' | kubectl apply -f -
apiVersion: operator.gnmic.dev/v1alpha1
kind: Target
metadata:
name: router1
labels:
vendor: vendorA
role: core
spec:
address: 10.0.0.1:57400
profile: default-profile
EOFStep 3: Create a Subscription
Define what telemetry data to collect:
apiVersion: operator.gnmic.dev/v1alpha1
kind: Subscription
metadata:
name: interface-counters
labels:
type: interfaces
spec:
paths:
- /interfaces/interface/state/counters
mode: STREAM/SAMPLE
sampleInterval: 10scat << 'EOF' | kubectl apply -f -
apiVersion: operator.gnmic.dev/v1alpha1
kind: Subscription
metadata:
name: interface-counters
labels:
type: interfaces
spec:
paths:
- /interfaces/interface/state/counters
mode: STREAM/SAMPLE
sampleInterval: 10s
EOFStep 4: Create an Output
Configure where to send the telemetry data:
apiVersion: operator.gnmic.dev/v1alpha1
kind: Output
metadata:
name: prometheus-output
labels:
type: prometheus
spec:
type: prometheus
config:
listen: ":9804"cat << 'EOF' | kubectl apply -f -
apiVersion: operator.gnmic.dev/v1alpha1
kind: Output
metadata:
name: prometheus-output
labels:
type: prometheus
spec:
type: prometheus
config:
listen: ":9804"
EOFStep 5: Create a Pipeline
Connect targets, subscriptions, and outputs:
apiVersion: operator.gnmic.dev/v1alpha1
kind: Pipeline
metadata:
name: core-telemetry
spec:
clusterRef: gnmic-cluster
enabled: true
# Select targets by label
targetSelectors:
- matchLabels:
vendor: vendorA
role: core
# Select subscriptions by label
subscriptionSelectors:
- matchLabels:
type: interfaces
# Select outputs by label
outputs:
outputSelectors:
- matchLabels:
type: prometheuscat << 'EOF' | kubectl apply -f -
apiVersion: operator.gnmic.dev/v1alpha1
kind: Pipeline
metadata:
name: core-telemetry
spec:
clusterRef: gnmic-cluster
enabled: true
# Select targets by label
targetSelectors:
- matchLabels:
vendor: vendorA
role: core
# Select subscriptions by label
subscriptionSelectors:
- matchLabels:
type: interfaces
# Select outputs by label
outputs:
outputSelectors:
- matchLabels:
type: prometheus
EOFStep 6: Create a Cluster
Deploy the gNMIc collectors:
apiVersion: operator.gnmic.dev/v1alpha1
kind: Cluster
metadata:
name: core-cluster
spec:
replicas: 3
image: ghcr.io/openconfig/gnmic:latest
api:
restPort: 7890
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "500m"cat << 'EOF' | kubectl apply -f -
apiVersion: operator.gnmic.dev/v1alpha1
kind: Cluster
metadata:
name: core-cluster
spec:
replicas: 3
image: ghcr.io/openconfig/gnmic:latest
api:
restPort: 7890
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "500m"
EOFVerify the Deployment
Check that the pods are running:
kubectl get pods -l operator.gnmic.dev/cluster-name=core-cluster
NAME READY STATUS RESTARTS AGE
gnmic-core-cluster-0 1/1 Running 0 30s
gnmic-core-cluster-1 1/1 Running 0 28s
gnmic-core-cluster-2 1/1 Running 0 28s
Check the services:
kubectl get svc -l operator.gnmic.dev/cluster-name=core-cluster
NAME TYPE CLUSTER-IP PORT(S)
gnmic-core-cluster ClusterIP None 7890/TCP
gnmic-core-cluster-prom-prometheus-output ClusterIP 10.96.xxx.xxx 9804/TCP
Access Prometheus Metrics
Configure your Prometheus server to scrape the created `gnmic-core-cluster-prom-prometheus-output. Or even better, annotate
Next Steps
- Cluster Configuration - Advanced cluster settings
- Pipeline Configuration - Complex pipeline scenarios
- Scaling - Scale your telemetry collection