I am working on a Kubernetes-based solution to host dozens of PHP websites (with future compatibility for Python/Node) using PostgreSQL as the database. The goal is to provide an environment similar to traditional hosting solutions like Plesk or Webmin but leveraging Kubernetes for scalability.
Challenges:
- Isolated file access: Each user must manage their own application, meaning every site needs separate file storage (FTP, S3 like solution or equivalent) and a dedicated PostgreSQL database.
- Database access: Users should be able to access their databases via a GUI (e.g., phpPgAdmin).
- Cost optimization: The infrastructure should share resources where possible, since billing is based on resource quotas (e.g., avoiding unnecessary pods per site).
- Scalability: Should be ready to host websites that will have low traffic, but some may experience high demand, requiring an efficient auto-scaling strategy.
- Minimal admin workload: The system should allow for self-administration (uploading files and managing their own DB) by users with minimal intervention from the cluster admin.
Proposed Approaches:
- A single namespace with Deployments for each service: An Apache/Nginx server, PHP-FPM, PostgreSQL, FTP server, and DB GUI, shared between different websites hosted. How to ensure isolated file access per user?
- A shared PostgreSQL cluster with multiple databases: Each site would have its own database within the same PostgreSQL instance.
- Persistent Volumes for shared storage: Storage shared across the web server and FTP instances. What’s the best way to manage user-specific file access in Kubernetes (FTP, SFTP, or alternatives)?
- Scaling strategies for uneven traffic distribution: Some sites will be low-traffic, while others will require more resources.
Has anyone implemented a similar multi-tenant setup in Kubernetes? What are the best practices for managing file access and scaling in this scenario?
I appreciate any insights from those who have tackled similar challenges in production environments.