I’m currently working on deploying InfluxDB in a Kubernetes cluster, and I want to modify the access subpath to the InfluxDB web interface so that it’s available under /influxdb instead of the root /.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: influxdb
namespace: influxdb
spec:
serviceName: influxdb
replicas: 1
selector:
matchLabels:
app: influxdb
template:
metadata:
labels:
app: influxdb
spec:
containers:
- name: influxdb
image: influxdb:2.7
env:
- name: INFLUXDB_HTTP_PREFIX
value: "/influxdb"
- name: BASE_PATH
value: "/influxdb"
- name: API_BASE_PATH
value: "/influxdbapi"
- name: DOCKER_INFLUXDB_INIT_MODE
value: "setup"
- name: DOCKER_INFLUXDB_INIT_USERNAME
valueFrom:
secretKeyRef:
name: influxdb-init-secret
key: DOCKER_INFLUXDB_INIT_USERNAME
- name: DOCKER_INFLUXDB_INIT_PASSWORD
valueFrom:
secretKeyRef:
name: influxdb-init-secret
key: DOCKER_INFLUXDB_INIT_PASSWORD
- name: DOCKER_INFLUXDB_INIT_ORG
value: "myorg"
- name: DOCKER_INFLUXDB_INIT_BUCKET
value: "mydb"
- name: DOCKER_INFLUXDB_INIT_ADMIN_TOKEN
valueFrom:
secretKeyRef:
name: influxdb-init-secret
key: DOCKER_INFLUXDB_INIT_PASSWORD
ports:
- containerPort: 8086
name: http
volumeMounts:
- name: influxdb-storage
mountPath: /var/lib/influxdb
volumes:
- name: influxdb-storage
persistentVolumeClaim:
claimName: influxdb-pvc
apiVersion: v1
kind: Service
metadata:
name: influxdb
namespace: influxdb
spec:
selector:
app: influxdb
ports:
- port: 8086
targetPort: 8086
name: http
clusterIP: None
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: influxdb-ingress
namespace: influxdb
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
tls:
- hosts:
- myhost
secretName: monitoring-tls
rules:
- host: myhost
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: influxdb
port:
number: 8086
