Access SeaweedFS volume server dashboard running in kubernetes cluster

907 Views Asked by At

I have deployed SeaweedFS stack into on-promises k8s cluster. The deployed instances are 1 master server, 1 volume server, 1 filer and S3 API gateway.

I defined k8s Deployment and Service on my own and I was able to make the stack running in the cluster. I am able to upload file using another NestJS backend that utilizes s3 API and filer API. The stack works correctly.

As they are not exposed via Ingress, I did port-forward of master, filer, s3 and volume server as follow for testing purpose.

enter image description here

I am able to access interface of master server via http://localhost:9333/, filer server via http://localhost:8888/ and s3 gateway via http://localhost:8333/. But I am not able to access volume server dashboard via http://localhost:8080/ui/index.html even though it is port-forwarded. I still can get the metrics from volume server via port 9325, but port 8080 does not work.

Deployment and Service definitions for volume server look like this.

apiVersion: apps/v1
kind: Deployment
metadata:
    name: seaweedfs-volume-deployment
spec:
    selector:
        matchLabels:
            app: seaweedfs-volume
    template:
        metadata:
            labels:
                app: seaweedfs-volume
        spec:
            containers:
                - name: seaweedfs-volume
                  image: chrislusf/seaweedfs:3.40
                  args:
                      [
                          'volume',
                          '-port',
                          '8080',
                          '-mserver',
                          'seaweedfs-master-service.namespace.svc.cluster.local:9333',
                          '-metricsPort',
                          '9325',
                          '-dir',
                          '/data',
                          '-max',
                          '14',
                      ]
                  ports:
                      - containerPort: 8080
                      - containerPort: 18080
                      - containerPort: 9325
                  volumeMounts:
                      - mountPath: /data
                        name: seaweedfs-volume-pv
            restartPolicy: Always
            volumes:
                - name: seaweedfs-volume-pv
                  persistentVolumeClaim:
                      claimName: seaweedfs-volume-pvc
---
apiVersion: v1
kind: Service
metadata:
    name: seaweedfs-volume-service
spec:
    selector:
        app: seaweedfs-volume
    ports:
        - name: 'seaweedfs-volume-port'
          port: 8080
          targetPort: 8080
        - name: 'seaweedfs-volume-grpc-port'
          port: 18080
          targetPort: 18080
        - name: 'seaweedfs-volume-metrics-port'
          port: 9325
          targetPort: 9325
  • Output of curl -I "http://localhost:9333/cluster/healthz"
HTTP/1.1 200 OK
Date: Thu, 09 Mar 2023 12:55:23 GMT
  • Output of curl "http://localhost:9333/dir/status?pretty=y"
{
  "Topology": {
    "Max": 14,
    "Free": 0,
    "DataCenters": [
      {
        "Id": "DefaultDataCenter",
        "Racks": [
          {
            "Id": "DefaultRack",
            "DataNodes": [
              {
                "Url": "10.1.64.185:8080",
                "PublicUrl": "10.1.64.185:8080",
                "Volumes": 14,
                "EcShards": 0,
                "Max": 14,
                "VolumeIds": " 1-14"
              }
            ]
          }
        ]
      }
    ],
    "Layouts": [
      {
        "replication": "000",
        "ttl": "",
        "writables": [
          1,
          2,
          3,
          4,
          5,
          6,
          7
        ],
        "collection": "test"
      },
      {
        "replication": "000",
        "ttl": "",
        "writables": [
          8,
          9,
          10,
          11,
          12,
          13,
          14
        ],
        "collection": ""
      }
    ]
  },
  "Version": "30GB 3.40 2885ba0e5"
}%
  • Output of curl "http://localhost:9333/vol/status?pretty=y
{
  "Version": "30GB 3.40 2885ba0e5",
  "Volumes": {
    "DataCenters": {
      "DefaultDataCenter": {
        "DefaultRack": {
          "10.1.64.185:8080": [
            {
              "Id": 5,
              "Size": 8,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "test",
              "Version": 3,
              "FileCount": 0,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366273,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            },
            {
              "Id": 6,
              "Size": 8,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "test",
              "Version": 3,
              "FileCount": 0,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366273,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            },
            {
              "Id": 10,
              "Size": 224,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "",
              "Version": 3,
              "FileCount": 1,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366369,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            },
            {
              "Id": 14,
              "Size": 8,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "",
              "Version": 3,
              "FileCount": 0,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366300,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            },
            {
              "Id": 1,
              "Size": 8,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "test",
              "Version": 3,
              "FileCount": 0,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366273,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            },
            {
              "Id": 3,
              "Size": 119064,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "test",
              "Version": 3,
              "FileCount": 1,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366273,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            },
            {
              "Id": 4,
              "Size": 208,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "test",
              "Version": 3,
              "FileCount": 1,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366273,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            },
            {
              "Id": 8,
              "Size": 8,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "",
              "Version": 3,
              "FileCount": 0,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366300,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            },
            {
              "Id": 11,
              "Size": 8,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "",
              "Version": 3,
              "FileCount": 0,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366300,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            },
            {
              "Id": 2,
              "Size": 8,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "test",
              "Version": 3,
              "FileCount": 0,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366273,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            },
            {
              "Id": 7,
              "Size": 8,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "test",
              "Version": 3,
              "FileCount": 0,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366273,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            },
            {
              "Id": 9,
              "Size": 8,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "",
              "Version": 3,
              "FileCount": 0,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366300,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            },
            {
              "Id": 12,
              "Size": 8,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "",
              "Version": 3,
              "FileCount": 0,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366300,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            },
            {
              "Id": 13,
              "Size": 1056,
              "ReplicaPlacement": {},
              "Ttl": {
                "Count": 0,
                "Unit": 0
              },
              "DiskType": "",
              "Collection": "",
              "Version": 3,
              "FileCount": 1,
              "DeleteCount": 0,
              "DeletedByteCount": 0,
              "ReadOnly": false,
              "CompactRevision": 0,
              "ModifiedAtSecond": 1678366309,
              "RemoteStorageName": "",
              "RemoteStorageKey": ""
            }
          ]
        }
      }
    },
    "Free": 0,
    "Max": 14
  }
}
  • After port-forward on mac, lsof -i :8080 command outputs nothing.

I tried to run the stack with the same configuration in docker-compose as follow, and I was able to access volume server dashboard via http://localhost:8080/ui/index.html.

services:
    seaweedfs_master:
        image: chrislusf/seaweedfs:3.40
        ports:
            - 9333:9333
            - 19333:19333
            - 9324:9324
        command: 'master -ip=master -ip.bind=0.0.0.0 -metricsPort=9324 -volumeSizeLimitMB=200'

    seaweedfs_volume:
        image: chrislusf/seaweedfs:3.40
        ports:
            - 8080:8080
            - 18080:18080
            - 9325:9325
        command: 'volume -mserver="seaweedfs_master:9333" -ip.bind=0.0.0.0 -port=8080  -metricsPort=9325 -dir="/data" -max=14'
        volumes:
            - ./volume:/data
        depends_on:
            - seaweedfs_master

    seaweedfs_filer:
        image: chrislusf/seaweedfs:3.40
        ports:
            - 8888:8888
            - 18888:18888
            - 9326:9326
        command: 'filer -master="seaweedfs_master:9333" -ip.bind=0.0.0.0 -metricsPort=9326'
        environment:
            WEED_POSTGRES2_HOSTNAME: ${SEAWEEDFS_FILER_POSTGRES_HOST}
            WEED_POSTGRES2_DATABASE: ${SEAWEEDFS_FILER_POSTGRES_DB}
            WEED_POSTGRES2_USERNAME: ${SEAWEEDFS_FILER_POSTGRES_USER}
            WEED_POSTGRES2_PASSWORD: ${SEAWEEDFS_FILER_POSTGRES_PASSWORD}
        volumes:
            - ./seaweedfs/filer.toml:/etc/seaweedfs/filer.toml
        depends_on:
            - seaweedfs_master
            - seaweedfs_volume

    seaweedfs_filer_postgres:
        image: postgres:12
        environment:
            POSTGRES_DB: ${SEAWEEDFS_FILER_POSTGRES_DB}
            POSTGRES_USER: ${SEAWEEDFS_FILER_POSTGRES_USER}
            POSTGRES_PASSWORD: ${SEAWEEDFS_FILER_POSTGRES_PASSWORD}
            PGDATA: /var/lib/postgresql/data/pgdata
        volumes:
            - seaweed-filer-postgres-data:/data/postgres
        ports:
            - '55433:5432'

    seaweedfs_s3:
        image: chrislusf/seaweedfs:3.40
        ports:
            - 8333:8333
            - 9327:9327
        command: 's3 -filer="seaweedfs_filer:8888" -ip.bind=0.0.0.0 -metricsPort=9327 -config=/etc/seaweedfs/s3-config.json'
        volumes:
            - ./seaweedfs/s3-config.json:/etc/seaweedfs/s3-config.json
        depends_on:
            - seaweedfs_master
            - seaweedfs_volume
            - seaweedfs_filer

I set different port for volume server than 8080, and exposed it via k8s Service accordingly, but after port-forward, I still cannot access the dashboard.

1

There are 1 best solutions below

0
On

I suspect 8080 was taken already.