k8s部署oceanbase无法成功挂载pv

【 使用环境 】测试环境
【 使用版本 】
oceanbase/oceanbase-ce 4.1.0.0
【问题描述】清晰明确描述问题
用镜像部署oceanbase,挂载pv不生效,重启容器后数据丢失。
在pv
【复现路径】问题出现前后相关操作
mountPath配置/store 可以正常启动,日志里也能会打印 clog and data use the same disk (/store) 但实际并没有挂载成功,重启容器后数据丢失
image|476x204](upload://4I8Ym8GhHmV5zRMcLkO6M6pUAIN.png)

加上mountPath后报错
image

【附件】
容器启动YAML
oceanbase.sugo.deployment.txt (2.2 KB)

错误日志
CA37D843-C5FB-4671-81DD-699E64F371F7.txt (53.3 KB)

2 个赞

具体描述下问题呢?什么场景,报什么错呢

2 个赞

就是想本地部署基于k8s的OB server, 但每次重启镜像实例数据盘就没了 ,配置了pv重启就报错了 如何解决 是配置不对吗

1 个赞

这个是k8s的配置

kind: Deployment
apiVersion: apps/v1
metadata:
  name: oceanbase
  namespace: sugo
  labels:
    app: oceanbase
  annotations:
    deployment.kubernetes.io/revision: '74'
    kubesphere.io/creator: sugo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: oceanbase
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: oceanbase
      annotations:
        kubesphere.io/creator: sugo
        kubesphere.io/imagepullsecrets: '{}'
        kubesphere.io/restartedAt: '2023-07-14T09:05:12.228Z'
        logging.kubesphere.io/logsidecar-config: '{}'
    spec:
      volumes:
        - name: oceanbase-pv
          persistentVolumeClaim:
            claimName: oceanbase-pv
      containers:
        - name: container-11isi5
          image: oceanbase/oceanbase-ce
          ports:
            - name: tcp-2881
              containerPort: 2881
              protocol: TCP
          env:
            - name: OB_ADMIN_USER
              value: admin
            - name: OB_ADMIN_PASSWORD
              value: sugo123
            - name: OB_ROOT_PASSWORD
              value: sugo123
            - name: OB_LOG_LEVEL
              value: INFO
            - name: MINI_MODE
              value: 'true'
            - name: EXIT_WHILE_ERROR
              value: 'true'
            - name: OB_DATA_DIR
              value: /store
          resources: {}
          volumeMounts:
            - name: oceanbase-pv
              mountPath: /root/ob
              subPath: ob
            - name: oceanbase-pv
              mountPath: /root/.obd
              subPath: obd
            - name: oceanbase-pv
              mountPath: /root/obagent
              subPath: obagent
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: Always
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      serviceAccountName: default
      serviceAccount: default
      securityContext: {}
      schedulerName: default-scheduler
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 25%
      maxSurge: 25%
  revisionHistoryLimit: 10
  progressDeadlineSeconds: 600

主要是想通过以下配置去挂载外部存储,然后启动就报错了

          volumeMounts:
            - name: oceanbase-pv
              mountPath: /root/ob
              subPath: ob
            - name: oceanbase-pv
              mountPath: /root/.obd
              subPath: obd
            - name: oceanbase-pv
              mountPath: /root/obagent
              subPath: obagent

报错日志已经上传在上面了


最新的加了以下配置就是上面那个图的结果,服务不知道是否启动成功,异常日志也不清楚如何查看了

 - name: oceanbase-pv
              mountPath: /root/obagent
              subPath: obagent


和上面发的错误日志文件里一样的错误码

https://www.oceanbase.com/docs/community-observer-cn-10000000000901210
在 K8s 里面的话推荐用 ob-operator 的方式来部署

这个镜像仅限于单机使用,直接 docker run 就行了,没必要把单机的放在 K8s 里去跑