0

I'm trying to migrate a typical single node LAMP stack with prestashop inside to kubernetes on Google Cloud Platform.

So far I've:

  • Set up the database as an independent second generation Cloud SQL.
  • Dockerized and uploaded a custom version of Prestashop with Apache and PHP.
  • Set up the deployment deployment including the SQL proxy, and Ingress to expose the service.

This works, and I would leave it this way if It wouldn't make it so difficult to deploy any changes that have any kind of impact on the disk (uploading product images, installing new modules, etc.).

I want to move the whole html folder to a persistent volume. I've checked two options.

  • Google persistent disk: It's easy to create and to attach to the pods, but it requires me to attach it to an instance in order to edit it. So it's kind of a bummer for CI.
  • Google Cloud Storage (segment) it's easy to edit (even from the browser) but AFAIK it requires to use GCSFuse in order to attach it to the pods. (Which I read is both slow and in a beta state).

I would like some advice on what to use, preferably with flexibility of the Storage and the native attachment of the persistent disk. Regarding the bandwidth, so far there is little to no traffic to the stack, but it would be nice for it to scale in a decent way. (If not, the whole k8s cluster is kind of pointless).

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
EndermanAPM
  • 327
  • 2
  • 22

2 Answers2

0

In my opinion you should go for a persistent disk. And, honestly I have never used a bucket with k8s, but I have seen it being a pain. Besides you will probably do need to use gcsfuse, which is in beta since forever.

suren
  • 7,817
  • 1
  • 30
  • 51
  • Is there any way to attach the persistent disk to my local machine in order to manually edit a file? – EndermanAPM Jun 10 '18 at 14:24
  • you can use a GCE Persistent disk as a volume mount in for your pod (can only be mounted in a single pod as read/write). When you do this, it will act as a normal GCE Persistent disk which means you can mount the disk to any other instance when it is not in use (but not while the pod is running). IE 1- Stop the pod, 2- Attach the GCE PD to another instance 3- Connect to the instance (and possibly mount the disk) 4- Edit. When you are done, detach the disk and redeploy the pod. – Patrick W Jun 22 '18 at 23:34
  • Here's how you can attach a PD to a GCE instance: https://cloud.google.com/compute/docs/disks/add-persistent-disk#create_disk Start at step 2 – Patrick W Jun 22 '18 at 23:34
0

You may take into consideration the use of gitRepo volume for your html folder:

apiVersion: v1
kind: Pod
metadata:
  name: server
spec:
  containers:
  - image: ...
    name: ...
    volumeMounts:
    - mountPath: /mypath
      name: git-volume
  volumes:
  - name: git-volume
    gitRepo:
      repository: "git@somewhere:me/your-git-repository.git"
      revision: "eef1d8406d464b0c0874075521c1f2e96c253775"
Nicola Ben
  • 10,615
  • 8
  • 41
  • 65
  • Using the git repo would be nice but wouln't the content that is editable on the Prestashop Backend (product images, etc) be deleted on each service or repository update? – EndermanAPM Jun 11 '18 at 08:41
  • If you have online changes, then gitRepo doesn't fit well and you should use some persistence storage technology, in my opinion. – Nicola Ben Jun 11 '18 at 08:43
  • Yeah, a persistent storage option is what I'm looking for. But as I stated on my question, the persistent disk only seems to be accessible to google machines and not my local computer (or any other) witch will make my workflow cumbersome. – EndermanAPM Jun 11 '18 at 08:51