Deploy an app on Google Kubernetes Engine with Persistent Disk to store MYSQL data and code

5/15/2018

I am trying to separate the source code and MYSQL data with the container to deploy the app(on Google Kubernetes Engine).

I search for example of deployment, but all I got is containerized code, not separated code.

Question:

  1. Is keeping separate the source code with the container and both save it in google persistent disk with MYSQL Data a feasible way to deploy an app on GKE?

  2. Is there any feasible way to access google persistent disk? I tried to attach the disk to a GCE instance, it failed because the Pod is using it, I think umount it from Pod is also not a good idea. I also tried to build a FTP server pod and mount the disk ,but also failed because of passive mode fail problem , I guess it's port problem like this #27587387.

(my ftp server yaml file is follow by:https://github.com/aledv/kubernetes-ftp).

3.Is there other better way to do the same like 1?

-- 黃皓哲
ftp
google-cloud-platform
google-kubernetes-engine
kubernetes

1 Answer

5/15/2018

Deploying MySQL to a persistent disk on GKE is exactly the tutorial at https://cloud.google.com/kubernetes-engine/docs/tutorials/persistent-disk is talking about. Please follow that tutorial.

  1. I'm not sure what you mean by "storing code on the disk". You're not supposed to do that. Container images are for snapshotting the application source code.

  2. You can't attach a disk to multiple places at the same time. Also please don't use FTP to transport files into Pods. That doesn't sound like a great practice.

-- AhmetB - Google
Source: StackOverflow