kubernetesansiblekubernetes-ingressinfluxdbk3s

Kubernetes Ingress Configuration. Influxdb webinterface only shows white screen


I deployed an k3s ansible managed kubernetes cluster via https://github.com/k3s-io/k3s-ansible. Then I applied influxdb deployment, Service and Ingress (also persistent volume and persistent volume claim) to the cluster. I expect the existing traefik installation to do the rest.

But when I try to access it via the ingress defined adress it just shows a white screen (not even that the site is not avaiable). When I access the service or the pod via port forwarding or nodeport it work as expected.

Deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: influxdb-deployment
  namespace: monitoring
spec:
  replicas: 1
  selector:
    matchLabels:
      app: influxdb
  template:
    metadata:
      labels:
        app: influxdb
    spec:
      containers:
      - name: influxdb
        image: influxdb:latest
        ports:
        - containerPort: 8086
        volumeMounts:
        - name: influxdb-storage
          mountPath: /var/lib/influxdb
        envFrom:
        - secretRef:
            name: influxdb-secrets
      volumes:
      - name: influxdb-storage
        persistentVolumeClaim:
          claimName: influxdb-pvc

Service:

---
apiVersion: v1
kind: Service
metadata:
  name: influxdb-service
  namespace: monitoring
spec:
  selector:
    app: influxdb
  ports:
    - protocol: TCP
      port: 8086
      targetPort: 8086
      nodePort: 30000
  type: LoadBalancer

Ingress:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: tig-ingress
  namespace: monitoring
  annotations:
    traefik.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: traefik
  rules:
  - host: test.example.local
    http:
      paths:
      - path: /influxdb
        pathType: Prefix
        backend:
          service:
            name: influxdb-service
            port:
              number: 8086
      - path: /grafana
        pathType: Prefix
        backend:
          service:
            name: grafana-service
            port:
              number: 3000

I was of course expecting to see the login page of the influxdb as it does when I access it via NodePort or PortForwarding.


Solution

  • The issue was that there was no base url configured. This does not work with Paths in the ingress configuration. As soon as influxdb or grafana are requesting to load further ressources, this request for these ressources (for example further javascript ressources) from client will contain the path / instead of /infludb or /grafana.

    Therefore the request will contain a url that cannot be handeled by the ingress and result in an error.

    Solution: Work without Paths and configure full URLs for both Webinterfaces.