Skip to content

Instantly share code, notes, and snippets.

@turnipsoup
Created March 4, 2021 04:56
Show Gist options
  • Save turnipsoup/247bd3d459c2f535cfe1a8188618f742 to your computer and use it in GitHub Desktop.
Save turnipsoup/247bd3d459c2f535cfe1a8188618f742 to your computer and use it in GitHub Desktop.
For deploying influxdb and grafana together in kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: ifg-deployment
namespace: house-infra
labels:
app: ifg
spec:
replicas: 1
selector:
matchLabels:
app: ifg
template:
metadata:
labels:
name: ifg-pod
namespace: house-infra
app: ifg
spec:
containers:
- name: grafana
image: grafana/grafana
ports:
- containerPort: 3000
volumeMounts:
- mountPath: /var/lib/grafana
name: grafana-volume
- name: influxdb
image: quay.io/influxdb/influxdb:v2.0.3
ports:
- containerPort: 8086
volumeMounts:
- mountPath: /root/.influxdbv2
name: influxdb-volume
volumes:
- name: grafana-volume
hostPath:
path: /opt/grafana/
type: DirectoryOrCreate
- name: influxdb-volume
hostPath:
path: /opt/influxdb/db/influxdbv2
type: DirectoryOrCreate
kind: Service
apiVersion: v1
metadata:
name: ifg-service
namespace: house-infra
spec:
type: NodePort
selector:
app: ifg
ports:
- protocol: TCP
name: grafana-web-interface
port: 3000
nodePort: 40000
- protocol: TCP
name: influxdb-interface
port: 8086
nodePort: 8086
@turnipsoup
Copy link
Author

You will need to exec into your influxdb pod and follow the standard setup instructions for influxdb.

You will also need to configure grafana yourself: https://docs.influxdata.com/influxdb/v2.0/tools/grafana/?t=InfluxQL#configure-your-influxdb-connection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment