赞
踩
在调试mysql-operator和mysql,在部署mysql的过程中,一直出现,mysqld: File ‘/var/lib/mysql-bin.index’ permission deined或者报错Can’t find error-message file ‘/usr/local/mysql/errmsg.sys’
cluster.yaml
apiVersion: mysql.presslabs.org/v1alpha1
kind: MysqlCluster
metadata:
name: my-cluster
spec:
replicas: 2
secretName: my-secret
volumeSpec:
hostPath:
path: /data/mysql
type: DirectoryOrCreate
mysqlConf:
innodb-buffer-pool-size: 1Gi
通过kubectl describe pod podname查看到pod是卡在了mysql-init-log或mysql容器启动过程中。
通过kubectl logs podname -c containername查看到容器的报错都为无法读写容器内/var/lib/mysql目录,而导致容器执行异常退出,而且镜像都在percona镜像。
服务器/data/mysql挂载了容器中的/var/lib/mysql。
apiVersion: v1 kind: Pod metadata: name: mytest spec: containers: - name: percona image: percona volumeMounts: - mountPath: /var/lib/mysql name: mysql imagePullPolicy: IfNotPresent command: - /usr/bin/bash - -c - sleep 200000000 volumes: - name: mysql hostPath: path: /data/mysql
apiVersion: mysql.presslabs.org/v1alpha1 kind: MysqlCluster metadata: name: my-cluster spec: replicas: 2 secretName: my-secret volumeSpec: hostPath: path: /data/mysql type: DirectoryOrCreate mysqlConf: innodb-buffer-pool-size: 1Gi podSpec: initContainers: - name: volume-permissions image: busybox securityContext: runAsUser: 0 command: - sh - -c - chmod 750 /datea/mysqlk; chown 999:999 /data/mysql volumeMounts: - name: data mountPath: /data/mysql
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。