>source

kubernetes configmap 및 PV , PVC를 사용하여 mysql 구성을 전달하려고 하는데 오류가 발생합니다.

chown: /var/lib/mysql/..data: Read-only file system
chown: /var/lib/mysql/crud.sql: Read-only file system
chown: /var/lib/mysql/..2021_12_29_12_32_17.053559530: Read-only file system
chown: /var/lib/mysql/..2021_12_29_12_32_17.053559530: Read-only file system
chown: /var/lib/mysql/: Read-only file system
chown: /var/lib/mysql/: Read-only file system

내가 아니라면초기화 컨테이너메신저를 사용하여 오류가 발생합니다.

2021-12-29 12:49:05+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
chown: changing ownership of '/var/lib/mysql/': Read-only file system
chown: changing ownership of '/var/lib/mysql/..data': Read-only file system
chown: changing ownership of '/var/lib/mysql/crud.sql': Read-only file system
chown: changing ownership of '/var/lib/mysql/..2021_12_29_12_43_00.339135384': Read-only file system
chown: changing ownership of '/var/lib/mysql/..2021_12_29_12_43_00.339135384/crud.sql': Read-only file system

배포.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Values.deployment.mysql.name }}
  namespace: {{ .Values.namespace }}
spec:
  selector:
    matchLabels:
      app: {{ .Values.deployment.mysql.name }}
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: {{ .Values.deployment.mysql.name }}
    spec:
      # initContainers:
      # -name: chmod-er
      #   image: busybox:latest
      #   command:
      #   -/bin/chown
      #   --R
      #   -"999:999"
      #   -/var/lib/mysql
      #   volumeMounts:
      #   -name: cm2
      #     mountPath: /var/lib/mysql
      containers:
      -image: {{ .Values.deployment.mysql.image }}
        name: {{ .Values.deployment.mysql.name }}
        securityContext:
          runAsUser: 0
        env:
         -name: MYSQL_ROOT_PASSWORD
           valueFrom:
             secretKeyRef:
              name: mysql-secret
              key: mysql-root-password
        ports:
        -containerPort: {{ .Values.deployment.mysql.port }}
          name: {{ .Values.deployment.mysql.name }}
        volumeMounts:
        -name: cm2
          mountPath: /var/lib/mysql/
          readOnly: false
      volumes:
      -name: mysqlvolume
        persistentVolumeClaim:
          claimName: mysqlvolume
          readOnly: false
      -name: cm2
        configMap:
          name: cm2

보다시피 내가 시도한초기화 컨테이너그러나 sill은 같은 오류가 발생했습니다.

pv.yaml

apiVersion: v1
kind: PersistentVolume
metadata:
  name: mysqlvolume
spec:
  accessModes:
    -ReadWriteOnce
  capacity:
    storage: 1Gi
  hostPath:
    path: C:\Users\ib151w\.minikube\volume

pvc.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysqlvolume
  namespace: {{ .Values.namespace }}
  namespace: app
spec:
  storageClassName: standard
  accessModes:
    -ReadWriteOnce
  resources:
    requests:
      storage: 50Mi

configmap.yaml

apiVersion: v1
data:
  crud.sql: |-
    /*!40101 SET NAMES utf8 */;
    /*!40014 SET FOREIGN_KEY_CHECKS=0 */;
    /*!40101 SET SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
    /*!40111 SET SQL_NOTES=0 */;
    CREATE DATABASE /*!32312 IF NOT EXISTS*/crud /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
    USE crud;
    DROP TABLE IF EXISTS books;
    CREATE TABLE `books` (
      `id` int NOT NULL AUTO_INCREMENT,
      `first_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
      `last_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
      `email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
      `phone` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
      `department` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
      `manager` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
      `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
kind: ConfigMap
metadata:
  creationTimestamp: "2021-12-29T10:24:41Z"
  name: cm2
  namespace: app
  resourceVersion: "6526"
  uid: 31ab7ef8-94a4-41d3-af19-ddfceb04e124

나는 mysql 포드가 내가 원하는 데이터베이스와 함께 시작될 때 포드에 이 구성을 전달하려고 합니다.

  • 이전 C에서 이전에 실행된 프로세스의 PID를 읽는 방법은 무엇입니까?
  • 다음 동일한 테이블을 두 번 조인하는 필터링 솔루션에 대한 피드백