mysql-operator
mysql-operator copied to clipboard
Create a cluster with a persistent volume failed
Is this a BUG REPORT or FEATURE REQUEST?
BUG REPORT
Versions
MySQL Operator Version:8.0.12
Environment:
- Kubernetes version (use
kubectl version):Client Version:v1.13.4,Server Version:v1.13.4 - Cloud provider or hardware configuration:Bare metal ,k8s run in docker container(Deployed via rancher2.0),Single Node Cluster
- OS (e.g. from /etc/os-release):CentOS Linux 7 (Core)
- Kernel (e.g.
uname -a):3.10.0-957.5.1.el7.x86_64 - Others:Docker version 18.06.0-ce,
What happened?
When I refer to the tutorial(https://github.com/oracle/mysql-operator/blob/master/docs/user/clusters.md#clusters) to Create a cluster with a persistent volume,An error has occurred: Error: stat /tmp/data no such file or directory
But,I had create the directory " /tmp/data" on each k8s worker node.
What you expected to happen?
persistent volume can use arbitrary path
How to reproduce it (as minimally and precisely as possible)?
1.Create the MySQL passwordcd
kubectl create secret generic wordpress-mysql-root-password --from-literal=password=password
2.Create the database
kubectl apply -f wordpress-database.yaml
the yaml file
3.get pod info
4.describe pod
5.get pv and pvc
6.ls -ld /tmp/data

Anything else we need to know?
Why is it possible to create success with "/tmp" and nothing else?
@linqingping If I understand correctly this looks like a permissions / Kubernetes cluster configuration issue as the Pod isn't starting. I suggest first trying to manually create a Pod that mounts your PVC and seeing if you run into the same problem.
@prydie Thanks for you help!But create a Pod that mounts my PVC not have this problem! how can I do?
the detail info:

kubectl describe po mysql-7879778879-b64mn
Name: mysql-7879778879-b64mn
Namespace: default
Priority: 0
PriorityClassName:
Normal Scheduled 6m2s default-scheduler Successfully assigned default/mysql-7879778879-b64mn to 192.168.33.11 Normal Pulled 6m1s kubelet, 192.168.33.11 Container image "mysql:5.7" already present on machine Normal Created 6m1s kubelet, 192.168.33.11 Created container Normal Started 6m kubelet, 192.168.33.11 Started container
Interesting. Would you mind trying with a subpath on the VolumeMount to mimic what the operator is doing?
https://github.com/oracle/mysql-operator/blob/c98210b2c7b176befa00aa0751db184088adfc39/pkg/resources/statefulsets/statefulset.go#L61-L65
@prydie thank you!As you said, am I right in doing so?

You have to create the directory on your host first, or use a different hostPath.type.
See https://kubernetes.io/docs/concepts/storage/volumes/#hostpath
I'm personally experimenting with the Operator using hostpath-provisioner for dynamic PV provisioning instead of manual, and it's working great so far!
I got same problem, how to resolve this problem??