cloudreve网盘迁移K8S

先贴配置文件了

cloudreve.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: cloudreve-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cloudreve
  template:
    metadata:
      labels:
        app: cloudreve
    spec:
      containers:
      - name: cloudreve
        image: cloudreve:latest
        imagePullPolicy: Never
        volumeMounts:
        - name: data
          mountPath: /app/data
        - name: config-volume
          mountPath: /app/conf.ini
          subPath: conf.ini
      volumes:
      - name: config-volume
        configMap:
          name: cloudreve-config
      - name: data
        nfs:
          path: /data
          server: 192.168.57.61
---
apiVersion: v1
kind: Service
metadata:
  name: cloudreve-service
  labels:
    app: cloudreve
spec:
  ports:
  - port: 9000
    name: cloudreve
    protocol: TCP
    targetPort: 5212
    nodePort: 30000
  selector:
    app: cloudreve
  type: NodePort
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: cloudreve-config
data:
  conf.ini: |
     [System]
     Debug = false
     Mode = master
     Listen = :5212
     SessionSecret = NWHeTEjapYr1WTr3utGgy6sZ31EUG10NUtOFZx0ORZDNF8LYaYRRW5wYWNOmenx8
     HashIDSalt = fsoe4LGVhQFscdBp8TmRZRyfaE5EPU33I7Xf3rWQexO6nxw29D8k4Bqac21TfDkg

   mountPath: /app/data 是将NFS挂到 /app/data 作为数据目录来存储网盘的文件

因为要使用configmap挂conf.ini 但是挂载到 /app目录后会将目录内的所有文件覆盖找不到启动文件导致镜像无法启动

所以用了

        - name: config-volume
          mountPath: /app/conf.ini
          subPath: conf.ini

这样就不会覆盖 /app下的文件了

这里使用本地的镜像,先编译 cloudreve:latest镜像

Dockerfile

FROM ubuntu:latest
 
COPY cloudreve /app/cloudreve
COPY conf.ini  /app/conf.ini
RUN chmod +x /app/cloudreve
WORKDIR /app

CMD ["./cloudreve"]
docker build -t cloudreve:latest .

启动容器

[root@master cloudreve]# kubectl apply  -f cloudreve.yaml 
deployment.apps/cloudreve-deployment created
service/cloudreve-service created
configmap/cloudreve-config created

查看cloudreve默认账号密码

[root@master cloudreve]# kubectl get pod 
NAME                                    READY   STATUS    RESTARTS   AGE
cloudreve-deployment-7c7f887cc8-q9g59   1/1     Running   0          10m
[root@master cloudreve]# kubectl logs cloudreve-deployment-7c7f887cc8-q9g59 

   ___ _                 _                    
  / __\ | ___  _   _  __| |_ __ _____   _____ 
 / /  | |/ _ \| | | |/ _  | '__/ _ \ \ / / _ \	
/ /___| | (_) | |_| | (_| | | |  __/\ V /  __/
\____/|_|\___/ \__,_|\__,_|_|  \___| \_/ \___|

   V3.8.3  Commit #88409cc  Pro=false
================================================

[Info]    2023-12-05 12:09:55 Initializing database connection...
[Info]    2023-12-05 12:09:55 Start initializing database schema...
[Info]    2023-12-05 12:09:55 Admin user name: admin@cloudreve.org
[Info]    2023-12-05 12:09:55 Admin password: oizCkg10
[Info]    2023-12-05 12:09:56 Start executing database script "UpgradeTo3.4.0".
[Info]    2023-12-05 12:09:56 Finish initializing database schema.
[Info]    2023-12-05 12:09:56 Initialize task queue with WorkerNum = 10
[Info]    2023-12-05 12:09:56 Initialize crontab jobs...
[Info]    2023-12-05 12:09:56 Current running mode: Master.
[Info]    2023-12-05 12:09:56 Listening to ":5212"
[GIN] 2023/12/05 - 12:09:56 | 200 |     701.824µs |   192.168.57.76 | GET      "/login?redirect=%2Flogin"
[GIN] 2023/12/05 - 12:09:56 | 200 |     350.788µs |   192.168.57.76 | GET      "/static/css/6.57254ef2.chunk.css"
[GIN] 2023/12/05 - 12:09:56 | 200 |   18.047561ms |   192.168.57.76 | GET      "/static/js/main.b93ef58f.chunk.js"
[GIN] 2023/12/05 - 12:09:56 | 200 |     237.995µs |   192.168.57.76 | GET      "/login?redirect=%2Flogin"
[GIN] 2023/12/05 - 12:09:56 | 200 |   34.672902ms |   192.168.57.76 | GET      "/static/js/6.df035d4b.chunk.js"
[GIN] 2023/12/05 - 12:09:56 | 200 |      213.24µs |   192.168.57.76 | GET      "/static/css/6.57254ef2.chunk.css"
[GIN] 2023/12/05 - 12:09:56 | 200 |   12.010573ms |   192.168.57.76 | GET      "/static/js/main.b93ef58f.chunk.js"
[GIN] 2023/12/05 - 12:09:56 | 200 |   44.951791ms |   192.168.57.76 | GET      "/static/js/6.df035d4b.chunk.js"
[GIN] 2023/12/05 - 12:09:57 | 200 |    1.320966ms |   192.168.57.76 | GET      "/api/v3/site/config"
[GIN] 2023/12/05 - 12:09:57 | 200 |    1.030957ms |   192.168.57.76 | GET      "/static/img/favicon.ico"
[Warning] 2023-12-05 12:10:02 更新检查失败, Get "https://api.github.com/repos/cloudreve/cloudreve/releases": tls: failed to verify certificate: x509: certificate signed by unknown authority

相关推荐

  1. cloudreve迁移K8S

    2023-12-06 10:46:04       36 阅读
  2. 阿里云ACK k8s集群迁移

    2023-12-06 10:46:04       16 阅读
  3. k8s学习

    2023-12-06 10:46:04       33 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-06 10:46:04       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-06 10:46:04       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-06 10:46:04       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-06 10:46:04       20 阅读

热门阅读

  1. Redis搭建

    2023-12-06 10:46:04       40 阅读
  2. vue-template-loader 是如何工作的?

    2023-12-06 10:46:04       35 阅读
  3. github ssh 秘钥过期解决记录

    2023-12-06 10:46:04       45 阅读
  4. vue2离线下载

    2023-12-06 10:46:04       35 阅读
  5. Vue和uni-app的区别

    2023-12-06 10:46:04       41 阅读
  6. vue-loader是如何工作的?

    2023-12-06 10:46:04       29 阅读
  7. Spark-03: Spark SQL 基础编程

    2023-12-06 10:46:04       24 阅读
  8. C练习题_12

    2023-12-06 10:46:04       27 阅读
  9. Centos 搭建Git私有服务器

    2023-12-06 10:46:04       39 阅读
  10. MATLAB中dlmwrite函数用法

    2023-12-06 10:46:04       36 阅读
  11. GO学习之 单例模式 sync.Once

    2023-12-06 10:46:04       31 阅读
  12. 通俗理解Jenkins是什么?

    2023-12-06 10:46:04       38 阅读
  13. 【VUE】watch 监听失效

    2023-12-06 10:46:04       38 阅读