Skip to content

Commit

Permalink
Moving whole snmp config into a PV for k8s example (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
i3149 authored Aug 17, 2022
1 parent 45fc02b commit 5c7b041
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 54 deletions.
79 changes: 31 additions & 48 deletions deployment/kubernetes/ktranslate-nr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ spec:
labels:
app: ktranslate
spec:
initContainers:
- name: ensure-device-file
image: alpine
command: ["touch", "/path/to/your/devices.yaml"]
volumeMounts:
- name: ktranslate-device-list
mountPath: /path/to/your
containers:
- name: ktranslate
image: docker.io/kentik/ktranslate:v2
Expand All @@ -38,7 +31,7 @@ spec:
key: nr_account_id
args:
- --metalisten=0.0.0.0:8083
- --snmp=/etc/ktranslate/snmp-base.yaml
- --snmp=/data/snmp-base.yaml
- --metrics=jchf
- --tee_logs=true
- --snmp_discovery_on_start=true
Expand Down Expand Up @@ -70,18 +63,12 @@ spec:
initialDelaySeconds: 5
periodSeconds: 5
volumeMounts:
- name: ktranslate-config
mountPath: /etc/ktranslate/snmp-base.yaml
subPath: snmp-base.yaml
- name: ktranslate-device-list
mountPath: /path/to/your
- name: ktranslate-config-claim
mountPath: /data
volumes:
- name: ktranslate-config
configMap:
name: ktranslate-config
- name: ktranslate-device-list
emptyDir: {}

- name: ktranslate-config-claim
hostPath:
path: /mnt/data/

---
apiVersion: v1
Expand Down Expand Up @@ -117,36 +104,32 @@ spec:

---
apiVersion: v1
kind: ConfigMap
kind: PersistentVolumeClaim
metadata:
name: ktranslate-config
data:
snmp-base.yaml: |
devices: "@/path/to/your/devices.yaml"
trap:
listen: 0.0.0.0:1620
discovery:
cidrs:
- 10.10.0.0/24
ignore_list: []
debug: false
ports:
- 161
default_communities:
- public
default_v3: null
add_devices: true
add_mibs: true
threads: 4
replace_devices: true
check_all_ips: true
global:
poll_time_sec: 300
mib_profile_dir: /etc/ktranslate/profiles
mibs_enabled:
- IF-MIB
timeout_ms: 3000
retries: 0
name: ktranslate-config-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi

---
apiVersion: v1
kind: PersistentVolume
metadata:
name: ktranslate-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"

---
apiVersion: v1
Expand Down
10 changes: 4 additions & 6 deletions deployment/kubernetes/ktranslate-pv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,10 @@ kind: PersistentVolumeClaim
metadata:
name: ktranslate-discovery-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
storageClassName: "" # Empty string must be explicitly set otherwise default StorageClass will be set
volumeName: ktranslate-pv-volume
metadata:
name: ktranslate-discovery-claim

---
apiVersion: v1
Expand Down

0 comments on commit 5c7b041

Please sign in to comment.