问题
I'm trying to migrate a typical single node LAMP stack with prestashop inside to kubernetes on Google Cloud Platform.
So far i've:
- Setted up the database as an independent second generation Cloud SQL.
- Dockerized and uploaded a custom version of Prestashop with Apache and PHP.
- Setted 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 kinda 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. (Wich I read is both slow and in a beta state).
I would like some advice on what to use, preferibly with flexibility of the Storage and the native attachement 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 kinda pointless).
回答1:
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.
回答2:
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"
来源:https://stackoverflow.com/questions/50767186/persistent-volume-atached-to-k8s-pod-group