Scaling properly a stateful app like Wordpress with Kubernetes Engine and Cloud SQL in Google Cloud

Mario on March 10, 2019

There are a lot of examples in the web that show you how you can run Wordpress in Kubernetes. The main issue with this Examples is: Only one Pod ... [Read Full]
markdown guide
 

what is the purpose of mountPath: /exports in nfs server? Similar can we use any directly as you listed mountPath is pods for "/var/www/html/wp-content"?

I tried a different directly called "/home/my-folder" for mounPath in a pod and it failed. Any idea?

 

Hi Mario!

Thanks for your walkthrough,

I am very interested in doing this setup, but I am kind of new to Kubernetes and I find some steps hard to follow

What do I do with

volumeMounts:
- name: my-pvc-nfs
mountPath: "/var/www/html/wp-content"
volumes:
- name: my-pvc-nfs
nfs:
server: 10.3.240.20
path: "/"

I think is missing the header :/

 

Hello!

Thank you for your post!! it kicked me in the right direction for making a similar setup.

I've run in a few challenges:
You are missing the storage class name in the Volume Claim description.
Also, the volume claim got stuck in a weird "pending" loop. I tracked the error was specifying the volume name. (last line on the volume claim)

I did not use the cloudsql proxy since I have my cloud sql instances with private internal IP so wordpress can use the ip directly.

There's one thing I could not fix yet... Wordpress can't write the wp-content mounted folder, I know it must be a permissions problem. The fix could be to extend the default wordpress docker image and run a chown there, but I thought I would ask you, maybe you have a clever idea!!

Thanks again!

code of conduct - report abuse