netfishers-onl / Netshot

Network Configuration and Compliance Management
http://www.netfishers.onl/netshot
242 stars 57 forks source link

Unable to connect to the Netshot REST server. #219

Closed achastre closed 2 years ago

achastre commented 2 years ago

Hello there, After building the container as explaine here. I ran netshot inside kubernetes cluster and I got this issue on the netshot Web UI.

Netshot
Unable to connect to the Netshot REST server.
Netshot version mismatch (frontend vs backend).

It's also asking for username/password to connect.

Below my configuration file.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: netshot
  labels:
    app: netshot
  namespace: netshot
spec:
  selector:
    matchLabels:
      app: netshot
  template:
    metadata:
      labels:
        app: netshot
    spec:
      imagePullSecrets:
        - name: regcred
      containers:
      - name: netshot
        image: docker-repository.priv.net/netshot:0.18.2
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        env:
          - name: NETSHOT_DB_PASSWORD
            valueFrom:
              secretKeyRef:
                name: postgres-auth
                key: POSTGRES_PASSWORD
          - name: NETSHOT_DB_USERNAME
            valueFrom:
              secretKeyRef:
                name: postgres-auth
                key: POSTGRES_USER
          - name: NETSHOT_DB_URL
            value: 'jdbc:postgresql://postgres/netshot' #this assumes your using postgres
---
apiVersion: v1
kind: Service
metadata:
  name: netshot
  labels:
    app: netshot
  namespace: netshot
spec:
  ports:
  - name: netshot
    port: 80
    targetPort: 8080
  selector:
    app: netshot
  type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    #nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/server-alias: coreps-tools.priv.net
  name: ingress-netshot
  namespace:  netshot
spec:
  tls: []
  ingressClassName: nginx
  rules:
  - host: coreps-tools
    http:
      paths:
      - path: /netshot(/|$)(.*)
        pathType: ImplementationSpecific
        backend:
          service:
            name: netshot
            port: 
              number: 80

Netshot logs :

kubectl -n netshot logs netshot-6f7b475b54-288wn 
Starting Netshot version 0.18.2.
09:51:18.461 [main] INFO onl.netfishers.netshot.Netshot - Starting Netshot
09:51:18.464 [main] WARN onl.netfishers.netshot.Netshot - Unable to read the configuration file netshot.conf.
09:51:18.465 [main] WARN onl.netfishers.netshot.Netshot - Configuration file /etc/netshot.conf successfully read.
09:51:18.495 [main] INFO onl.netfishers.netshot.Netshot - Will go on logging to the console.
2022-06-30 09:51:24,412 ERROR [main] DeviceDriver: Unable to open /usr/local/netshot/drivers to find device drivers.
2022-06-30 09:51:27,405 WARN  [main] Netshot: Netshot is started

Anything i made wrong ? thanks for the future help Arnaud

achastre commented 2 years ago

Issue du to the ingress and the way to call the ui. coreps-tools.priv.net/netshot/ instead of coreps-tools.priv.net/netshot