Доступ к информационной панели сервера томов SeaweedFS, работающей в кластере Kubernetes.
Я развернул стек SeaweedFS в кластере k8s на обещаниях. Развернутые экземпляры: 1 главный сервер, 1 сервер томов, 1 фильтр и шлюз S3 API.
Я самостоятельно определил развертывание и обслуживание k8s и смог запустить стек в кластере. Я могу загрузить файл с помощью другого бэкэнда NestJS, который использует API s3 и API-интерфейс Filer. Стек работает корректно.
Поскольку они не доступны через Ingress, в целях тестирования я выполнил переадресацию портов главного сервера, файлового сервера, s3 и сервера томов, как указано ниже.
Я могу получить доступ к интерфейсу главного сервера черезhttp://localhost:9333/
, файловый сервер черезhttp://localhost:8888/
и шлюз s3 черезhttp://localhost:8333/
. Но я не могу получить доступ к панели мониторинга сервера томов черезhttp://localhost:8080/ui/index.html
даже несмотря на то, что он переадресован через порт. Я все еще могу получить метрики с сервера томов через порт 9325, но порт 8080 не работает.
Определения развертывания и службы для сервера томов выглядят следующим образом.
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
- Вывод команды curl -I "http://localhost:9333/cluster/healthz"
HTTP/1.1 200 OK
Date: Thu, 09 Mar 2023 12:55:23 GMT
- Вывод 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"
}%
- Вывод 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
}
}
- После переадресации портов на Mac
lsof -i :8080
команда ничего не выводит.
Я попытался запустить стек с той же конфигурацией в docker-compose, как показано ниже, и мне удалось получить доступ к панели мониторинга сервера томов через 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
Я установил для сервера томов другой порт, чем 8080, и открыл его через службу k8s соответственно, но после переадресации порта я все еще не могу получить доступ к панели управления.