scalable LAMP with postrgres, kubernetes with high availablity

Posted September 26, 2020 1.4k views
LAMP StackPostgreSQLDigitalOcean Managed KubernetesDigitalOcean Managed PostgreSQL Database


I am deploying a LAPP (linux, Apache, Postgres & PHP) app on DO and looking for an always available and scalable architecture. Here is my plan

a. set up the webapp in Read only volume
b. set up client files in readwrite folder in volume
c. set up Redis to manage the sessions
d. set up a kubernetes to manage pods for scaling up / higher availability (on the understanding that it will spin-off pods on need and destroy when it fails, automatically. Please correct)
e.set up managed postgres for storing data (should i store the persistent data on volume).

Obviously i am confused with tons of materials but none matching my requirement end to end. either i have singe droplet with all the stack and DB in one VM or kubernetes videos without the web / db set up.

would be glad if you guide me to the right article / videos or correct my understanding above is wrong.

Best regards

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there @rkrk,

Indeed the requirements that you have are quite specific but what I could suggest is following the steps here on how to deploy a PHP application on Kubernetes:

It does not include the Database and the Redis part, but what you could do is just pass the details to your PHP pods via your Deployment file like this:

. . . 
    - name: DATABASE_HOST
      value: "your_database_hostname"
    - name: DATABASE_PASS
      value: "your_database_password"
. . . 

Also for security reasons you could store your database details in Kubernetes secret and pass the secret as an env variable.

That way your application will be deployed on the Kubernetes cluster, and your application will connect to the Managed Database clusters.

Hope that this helps!

by Amitabh Dhiwal
Kubernetes is an open source container orchestration system. It allows you to create, update, and scale containers without worrying about downtime. In this tutorial, you will deploy a PHP 7 application on a Kubernetes cluster with Nginx and PHP-FPM running in separate containers.