Can't make kubernetes example for wordpress & mysql with persistent data work

4/3/2017

I followed this kubernetes example to create a wordpress and mysql with persistent data

I followed everything from the tutorial from creation of the disk to deployment and on the first try deletion as well

1st try

https://s3-ap-southeast-2.amazonaws.com/dorward/2017/04/git-cmd_2017-04-03_08-25-33.png

Problem: persistent volumes does not bind to the persistent volume claim. It remains at pending status both for the creation of the pod and the volume claim. Volume status remains at Released state as well.

Had to delete everything as describe in the example and try again. This time I mounted the created volumes to an instance in the cluster, formatted the disk using ext4 fs then unmounted the disks.

2nd try

https://s3-ap-southeast-2.amazonaws.com/dorward/2017/04/git-cmd_2017-04-03_08-26-21.png

Problem: After formatting the volumes, they are now bound to the claims yay! unfortunately mysql pod doesn't run with status crashLoopback off. Eventually the wordpress pod crashed as well.

https://s3-ap-southeast-2.amazonaws.com/dorward/2017/04/git-cmd_2017-04-03_08-27-22.png

Did anyone else experience this? I'm wondering if I did something wrong or if something has changed from the write up of the exam til now that made the example break. How do I go around fixing it?

Any help is appreciated.

-- Dorward Villaruz
kubernetes
mysql
persistent-volume-claims
persistent-volumes
wordpress

1 Answer

4/3/2017

Get logs for pods:

kubectl logs pod-name

If log indicates the pods are not even starting (crashloopback) investigate the events in k8s:

kubectl get events

The event log indicates the node running out of memory (OOM):

    LASTSEEN   FIRSTSEEN   COUNT     NAME                                              KIND      SUBOBJECT                    TYPE      REASON       SOURCE                                                      MESSAGE
1m         7d          1555      gke-hostgeniuscom-au-default-pool-xxxh   Node                                   Warning   SystemOOM    {kubelet gke-hostgeniuscom-au-default-pool-xxxxxf-qmjh}   System OOM encountered

Trying a larger instance size should solve the issue.

-- Oswin Noetzelmann
Source: StackOverflow