- NFS Server : 192.168.0.99
InfluxDB PV
apiVersion: v1
kind: PersistentVolume
metadata:
name: db-influxdb-pv
labels:
type: nfs
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
nfs:
server: 192.168.0.99
path: /mnt/influxdb
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: db-influxdb-pvc
spec:
storageClassName: ""
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi
selector:
matchExpressions:
- key: type
operator: In
values:
- nfs
Statefulset
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: db-influxdb
name: db-influxdb
spec:
replicas: 1
selector:
matchLabels:
app: db-influxdb
template:
metadata:
labels:
app: db-influxdb
spec:
restartPolicy: Always
containers:
- image: quay.io/influxdb/influxdb:v2.0.3
name: db-influxdb
resources:
limits:
memory: "128Mi"
cpu: 1
ports:
- name: api
containerPort: 9999
- name: gui
containerPort: 8086
volumeMounts:
- mountPath: /root/.influxdbv2
name: var-lib-influxdb
volumes:
- name: var-lib-influxdb
persistentVolumeClaim:
claimName: db-influxdb-pvc
Service
apiVersion: v1
kind: Service
metadata:
labels:
app: influxdb
name: influxdb
spec:
ports:
- port: 8086
protocol: TCP
targetPort: 8086
nodePort: ~~~~
selector:
app: db-influxdb
type: NodePort
Job
초기설정을 위한 job을 실행한다.
apiVersion: batch/v1
kind: Job
metadata:
name: db-influxdb-setup
spec:
template:
spec:
terminationGracePeriodSeconds: 10
restartPolicy: Never
containers:
- name: create-credentials
image: quay.io/influxdb/influxdb:v2.0.3
command:
- influx
args:
- setup
- --host
- http://influxdb.네임스페이스:8086
- --bucket
- 버킷명
- --org
- 회사명
- --password
- 비밀번호
- --username
- 유저명
- --token
- 토큰
- --force