1

我通过在 Podman 中播放 kube 文件来运行 mariadb pod。我不想使用固定的hostPath ,而是使用命名卷。但是,这要求已创建命名卷。有没有办法在 pod kube 文件中创建一个名为maria_db的命名卷作为规范的一部分。以下是我正在使用的规范:

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: "2021-02-25T17:08:40Z"
  labels:
    app: some-mariadb
  name: some-mariadb
spec:
  containers:
  - command:
    - mysqld
    env:
    - name: MYSQL_DATABASE
      value: wordpress
    - name: MYSQL_USER
      value: wordpress-user
    - name: MYSQL_ROOT_PASSWORD
      value: redhat
    - name: MYSQL_PASSWORD
      value: redhat
    image: docker.io/library/mariadb:latest
    name: some-mariadb
    ports:
    - containerPort: 3306
      hostPort: 3306
      protocol: TCP
    resources: {}
    securityContext:
      allowPrivilegeEscalation: true
      capabilities: {}
      privileged: false
      readOnlyRootFilesystem: false
      seLinuxOptions: {}
    volumeMounts:
    - mountPath: /var/lib/mysql
      name: maria_db
    workingDir: /
  volumes:
  - hostPath:
      path: maria_db
      type: Directory
    name: maria_db
status: {}
---
metadata:
  creationTimestamp: null
spec: {}
status:
  loadBalancer: {}

这是我得到的错误:

Error: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting "/home/muzammil786/.local/share/containers/storage/volumes/maria_db/_data" to rootfs at "/var/lib/mysql" caused: stat /home/muzammil786/.local/share/containers/storage/volumes/maria_db/_data: no such file or directory: OCI runtime command not found error
4

0 回答 0