Skip to content

Instantly share code, notes, and snippets.

@raif-ahmed
Created June 26, 2023 20:18
Show Gist options
  • Save raif-ahmed/d7d4a65c375e677f85bb2923ba8529d1 to your computer and use it in GitHub Desktop.
Save raif-ahmed/d7d4a65c375e677f85bb2923ba8529d1 to your computer and use it in GitHub Desktop.
# NV Exporter Conf File - Using Secrets/ConfigMap
# Use config map for not-secret configuration data
apiVersion: v1
kind: ConfigMap
metadata:
name: nv-exporter-cm
namespace: neuvector
data:
CTRL_API_SERVICE: neuvector-svc-controller.neuvector:10443
EXPORTER_PORT: '8068'
---
# Use secrets for things which are actually secret like API keys, credentials, etc
# echo -n 'admin' | base64
apiVersion: v1
kind: Secret
metadata:
name: nv-exporter-secret
namespace: neuvector
type: Opaque
data:
CTRL_USERNAME: YWRtaW4=
CTRL_PASSWORD: cGFzc3cwcmQ=
---
apiVersion: v1
kind: Service
metadata:
name: neuvector-svc-prometheus-exporter
namespace: neuvector
labels:
app: neuvector-prometheus-exporter-pod
spec:
ports:
- port: 8068
name: prometheus-exporter
protocol: TCP
selector:
app: neuvector-prometheus-exporter-pod
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: neuvector-prometheus-exporter-pod
namespace: neuvector
spec:
selector:
matchLabels:
app: neuvector-prometheus-exporter-pod
replicas: 1
template:
metadata:
labels:
app: neuvector-prometheus-exporter-pod
spec:
containers:
- name: neuvector-prometheus-exporter-pod
image: neuvector/prometheus-exporter
imagePullPolicy: Always
envFrom:
- configMapRef:
name: nv-exporter-cm
- secretRef:
name: nv-exporter-secret
# env vars - only for test cases
# env:
# - name: CTRL_API_SERVICE
# value: neuvector-svc-controller.neuvector:10443
# - name: CTRL_USERNAME
# value: admin
# - name: CTRL_PASSWORD
# value: admin
# - name: EXPORTER_PORT
# value: "8068"
restartPolicy: Always
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment