
说明在k8s环境部署alist。alist的配置文件在容器启动时必须是可读写状态。v1.yaml标准部署。支持数据持久化。v2.yaml改造部署基于v1支持自定义配置文件。容器镜像https://github.com/AlistGo/alist/pkgs/container/alist准备文件v1.yamlapiVersion: v1 kind: PersistentVolumeClaim metadata: name: alist-pvc labels: app: alist spec: accessModes: - ReadWriteOnce resources: requests: storage: 5Gi --- apiVersion: apps/v1 kind: Deployment metadata: name: alist-deployment labels: app: alist spec: replicas:1selector: matchLabels: app: alist template: metadata: labels: app: alist spec: containers: - name: alist-container image: ghcr.io/alistgo/alist:v3.60.0 imagePullPolicy: IfNotPresent ports: - name: http containerPort:5244protocol: TCP env: - name: PUID value:0- name: PGID value:0- name: UMASK value:022volumeMounts: - name: alist-data mountPath: /opt/alist/data resources: requests: cpu: 100m memory: 128Mi limits: cpu:1memory: 1Gi volumes: - name: alist-data persistentVolumeClaim: claimName: alist-pvc --- apiVersion: v1 kind: Service metadata: name: alist-clusterip-service labels: app: alist spec: type: ClusterIP selector: app: alist ports: - name: http protocol: TCP port:5244targetPort:5244--- apiVersion: v1 kind: Service metadata: name: alist-nodeport-service labels: app: alist spec: type: NodePort selector: app: alist ports: - name: http protocol: TCP port:5244targetPort:5244v2.yamlapiVersion: v1 kind: ConfigMap metadata: name: alist-config labels: app: alist data: config.json:|{force:false,site_url:,cdn:,jwt_secret:YRaOORpTQDoWMQn5,token_expires_in:48,database:{type:sqlite3,host:,port:0,user:,password:,name:,db_file:data/data.db,table_prefix:x_,ssl_mode:,dsn:},meilisearch:{host:http://localhost:7700,api_key:,index_prefix:},scheme:{address:0.0.0.0,http_port:5244,https_port:-1,force_https:false,cert_file:,key_file:,unix_file:,unix_file_perm:,enable_h2c:false},temp_dir:data/temp,bleve_dir:data/bleve,dist_dir:,log:{enable:true,name:data/log/log.log,max_size:50,max_backups:30,max_age:28,compress:false},delayed_start:0,max_connections:0,max_concurrency:64,tls_insecure_skip_verify:false,tasks:{download:{workers:5,max_retry:1,task_persistant:false},transfer:{workers:5,max_retry:2,task_persistant:false},upload:{workers:5,max_retry:0,task_persistant:false},copy:{workers:5,max_retry:2,task_persistant:false},decompress:{workers:5,max_retry:2,task_persistant:false},decompress_upload:{workers:5,max_retry:2,task_persistant:false},s3_transition:{workers:5,max_retry:2,task_persistant:false},allow_retry_canceled:false},cors:{allow_origins:[*],allow_methods:[*],allow_headers:[*]},s3:{enable:false,port:5246,ssl:false},ftp:{enable:false,listen::5221,find_pasv_port_attempts:50,active_transfer_port_non_20:false,idle_timeout:900,connection_timeout:30,disable_active_mode:false,default_transfer_binary:false,enable_active_conn_ip_check:true,enable_pasv_conn_ip_check:true},sftp:{enable:false,listen::5222},mcp:{enable:false,port:5248},last_launched_version:v3.62.0}--- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: alist-pvc labels: app: alist spec: accessModes: - ReadWriteOnce resources: requests: storage: 5Gi --- apiVersion: apps/v1 kind: Deployment metadata: name: alist-deployment labels: app: alist spec: replicas:1selector: matchLabels: app: alist template: metadata: labels: app: alist spec: initContainers: - name: init-config image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/busybox:1.38.0 command:[sh,-c,if [ ! -f /data/config.json ]; then cp /config-src/config.json /data/config.json; echo config.json copied; else echo config.json already exists, skipping; fi]volumeMounts: - name: alist-config mountPath: /config-src - name: alist-data mountPath: /data containers: - name: alist-container image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/alistgo/alist:v3.62.0 imagePullPolicy: IfNotPresent ports: - name: http containerPort:5244protocol: TCP env: - name: PUID value:0- name: PGID value:0- name: UMASK value:022volumeMounts: - name: alist-data mountPath: /opt/alist/data resources: requests: cpu: 100m memory: 128Mi limits: cpu:1memory: 1Gi volumes: - name: alist-config configMap: name: alist-config - name: alist-data persistentVolumeClaim: claimName: alist-pvc --- apiVersion: v1 kind: Service metadata: name: alist-clusterip-service labels: app: alist spec: type: ClusterIP selector: app: alist ports: - name: http protocol: TCP port:5244targetPort:5244--- apiVersion: v1 kind: Service metadata: name: alist-nodeport-service labels: app: alist spec: type: NodePort selector: app: alist ports: - name: http protocol: TCP port:5244targetPort:5244部署全新环境可以快速部署kubectl create namespace alist kubectl apply-falist.yaml-nalist查询确认部署状态确认5244映射的物理机端口rootmaster1:/opt/alist# kubectl get all -n alistNAME READY STATUS RESTARTS AGE pod/alist-deployment-5cc86f99d7-q6fhh1/1 Running018s NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)AGE service/alist-clusterip-service ClusterIP10.233.33.194none5244/TCP 18s service/alist-nodeport-service NodePort10.233.29.30none5244:30601/TCP 18s NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/alist-deployment1/11118s NAME DESIRED CURRENT READY AGE replicaset.apps/alist-deployment-5cc86f99d711118s查询admin账户的密码rootmaster1:/opt/alist# kubectl logs -n alist pod/alist-deployment-5cc86f99d7-q6fhhDefaulted containeralist-containerout of: alist-container, init-config(init)INFO[2026-07-20 02:55:45]reading config file: data/config.json INFO[2026-07-20 02:55:45]load config fromenvwith prefix: INFO[2026-07-20 02:55:45]init logrus... INFO[2026-07-20 02:55:45]Successfully created the admin user and the initial password is: wwHzb7XR WARN[2026-07-20 02:55:45]init tool qBittorrent failed: Posthttp://localhost:8080/api/v2/auth/login:dial tcp[::1]:8080: connect: connection refused INFO[2026-07-20 02:55:45]init tool Thunder success: ok WARN[2026-07-20 02:55:45]init tool Transmission failed: failed get transmission version: cant get session values: session-get rpc method failed: failed to execute HTTP request: Posthttp://localhost:9091/transmission/rpc:dial tcp[::1]:9091: connect: connection refused INFO[2026-07-20 02:55:45]init tool115Cloud success: ok WARN[2026-07-20 02:55:45]init tool aria2 failed: failed get aria2 version: Posthttp://localhost:6800/jsonrpc:dial tcp[::1]:6800: connect: connection refused INFO[2026-07-20 02:55:45]init tool GuangYaPan success: ok INFO[2026-07-20 02:55:45]init tool SimpleHttp success: ok INFO[2026-07-20 02:55:45]init tool PikPak success: ok INFO[2026-07-20 02:55:45]start HTTP server 0.0.0.0:5244访问前文所示浏览器访问master node1的IP:30601。账户admin密码wwHzb7XR首次访问需在管理功能里配置对接存储。自定义配置需自定义配置时可使用v2.yaml参考以下说明config.json参考https://alistgo.com/config/configuration.htmlapiVersion: v1 kind: ConfigMap metadata: name: alist-config labels: app: alist data:# 可自定义alist的配置文件config.json:|{force:false,# 可指定URL的后缀内容site_url:,cdn:,jwt_secret:YRaOORpTQDoWMQn5,token_expires_in:48,database:{type:sqlite3,host:,port:0,user:,password:,name:,db_file:data/data.db,table_prefix:x_,ssl_mode:,dsn:},meilisearch:{host:http://localhost:7700,api_key:,index_prefix:},scheme:{address:0.0.0.0,http_port:5244,https_port:-1,force_https:false,cert_file:,key_file:,unix_file:,unix_file_perm:,enable_h2c:false},temp_dir:data/temp,bleve_dir:data/bleve,dist_dir:,log:{enable:true,name:data/log/log.log,max_size:50,max_backups:30,max_age:28,compress:false},delayed_start:0,max_connections:0,max_concurrency:64,tls_insecure_skip_verify:false,tasks:{download:{workers:5,max_retry:1,task_persistant:false},transfer:{workers:5,max_retry:2,task_persistant:false},upload:{workers:5,max_retry:0,task_persistant:false},copy:{workers:5,max_retry:2,task_persistant:false},decompress:{workers:5,max_retry:2,task_persistant:false},decompress_upload:{workers:5,max_retry:2,task_persistant:false},s3_transition:{workers:5,max_retry:2,task_persistant:false},allow_retry_canceled:false},cors:{allow_origins:[*],allow_methods:[*],allow_headers:[*]},s3:{enable:false,port:5246,ssl:false},ftp:{enable:false,listen::5221,find_pasv_port_attempts:50,active_transfer_port_non_20:false,idle_timeout:900,connection_timeout:30,disable_active_mode:false,default_transfer_binary:false,enable_active_conn_ip_check:true,enable_pasv_conn_ip_check:true},sftp:{enable:false,listen::5222},mcp:{enable:false,port:5248},last_launched_version:v3.62.0}--- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: alist-pvc labels: app: alist spec: accessModes: - ReadWriteOnce resources: requests: storage: 5Gi --- apiVersion: apps/v1 kind: Deployment metadata: name: alist-deployment labels: app: alist spec: replicas:1selector: matchLabels: app: alist template: metadata: labels: app: alist spec:# 用于初始化配置文件使配置文件在初次启动时可读写。initContainers: - name: init-config image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/busybox:1.38.0 command:[sh,-c,if [ ! -f /data/config.json ]; then cp /config-src/config.json /data/config.json; echo config.json copied; else echo config.json already exists, skipping; fi]volumeMounts: - name: alist-config mountPath: /config-src - name: alist-data mountPath: /data containers: - name: alist-container image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/alistgo/alist:v3.62.0 imagePullPolicy: IfNotPresent ports: - name: http containerPort:5244protocol: TCP env: - name: PUID value:0- name: PGID value:0- name: UMASK value:022# 数据持久化volumeMounts: - name: alist-data mountPath: /opt/alist/data resources: requests: cpu: 100m memory: 128Mi limits: cpu:1memory: 1Gi volumes: - name: alist-config configMap: name: alist-config - name: alist-data persistentVolumeClaim: claimName: alist-pvc --- apiVersion: v1 kind: Service metadata: name: alist-clusterip-service labels: app: alist spec: type: ClusterIP selector: app: alist ports: - name: http protocol: TCP port:5244targetPort:5244--- apiVersion: v1 kind: Service metadata: name: alist-nodeport-service labels: app: alist spec: type: NodePort selector: app: alist ports: - name: http protocol: TCP port:5244targetPort:5244