Drupal with Kubernetes

As Drupal becoming the foundation of a more complicated system, scalability becomes an issue. Moving to the cloud and the containerized solution is an efficient way to solve the problem. But Drupal is not easy to scale with tools like Kubernetes. The challenges for drupal to use Kubernetes are:
1) Drupal writes to a configuration file "settings.php" when installing initially.
2) All containers need to have a synchronized database, which is not easy to scale.
3) Each container instance has a files folder that requires to synchronize across the containers.

Solve that three-issue; then, we can put drupal instance into containers and enjoy the full benefit of the containerized solution.

First of all, when we build the Docker container instance, we can preset the configuration file and give the database login credential in the settings.php file or with a system variable. So, it bypasses the database setting form when performing the installation.

Second, use a third party database instead of a local database. We can let all container point to the database services like RDS or Aurora in AWS, Cloud SQL in Google Cloud. By doing that, we solve the problem of database scalability.

Last, the files folder is something lacking an existing solution. We can disable the aggregating function, but there is still a need to upload images or generated some other files. The old NFS way has its limitations and not an ideal solution. But using third-party file storage like AWS s3 bucket seems promising as the files folder.

With that three-issue addressed, we can try to make drupal installable inside a Kubernetes cluster.

Tag: