This directory contains the Kubernetes manifests to deploy the Apigee Drupal Kickstart application. It is structured to use Kustomize for managing different configuration variants.
base/: Contains the common Kubernetes manifests shared across all deployment variations.overlays/: Contains Kustomize overlays for different deployment targets.single-replica-pvc/: A single-replica deployment using standardReadWriteOncePersistentVolumeClaims. Suitable for development and testing.gcp-filestore/: A scalable, multi-replica deployment using Google Cloud Filestore for sharedReadWriteManystorage. Recommended for production on GCP.
This deployment will create a new Kubernetes namespace called apigee-devportal.
First, choose a deployment overlay based on your needs. Follow the specific instructions in the overlay's README to deploy the application.
After you have successfully deployed the application using one of the guides above, use the following instructions to verify, interact with, and manage your deployment.
-
Check the pods:
kubectl get pods -w -n apigee-devportal
Wait for all pods (
apigee-kickstart-*andapigee-kickstart-database-*) to be in theRunningstate. -
Check the services:
kubectl get services -n apigee-devportal
Look for the
apigee-kickstartservice. It will have anEXTERNAL-IPassigned once your cloud provider has provisioned the load balancer.NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE apigee-kickstart LoadBalancer 10.96.1.234 35.222.111.222 80:31234/TCP 5m apigee-kickstart-database ClusterIP 10.96.2.111 <none> 3306/TCP 5m -
Access the Application: Once the
EXTERNAL-IPis available, you can access the Drupal portal by navigating tohttp://<EXTERNAL-IP>in your web browser.Troubleshooting Note: If you encounter an error after the initial browser-based installation, try navigating to
http://<EXTERNAL-IP>/update.phpor runningdrush cr(see "Interacting with the Application" below) to clear caches.
To run drush commands or access the container's shell for debugging, you can connect to a running apigee-kickstart pod:
-
Get the name of a running
apigee-kickstartpod:POD_NAME=$(kubectl get pod -l app=apigee-kickstart -n apigee-devportal -o jsonpath='{.items[0].metadata.name}') echo $POD_NAME
-
Execute a
drushcommand (example: check status):kubectl exec -it $POD_NAME -n apigee-devportal -c apigee-kickstart -- drush status
-
Clear Drupal caches:
kubectl exec -it $POD_NAME -n apigee-devportal -c apigee-kickstart -- drush cr
-
Run database updates:
kubectl exec -it $POD_NAME -n apigee-devportal -c apigee-kickstart -- drush updb -y
-
Get a shell into the container:
kubectl exec -it $POD_NAME -n apigee-devportal -c apigee-kickstart -- /bin/sh
All sensitive configuration is managed in the database.env and application.env files located in the base/ directory.
To change a configuration value:
- Update the desired value in the appropriate
.envfile in thebase/directory. - Re-apply your chosen overlay. Kustomize will automatically update the Secrets with the new values.
# From within the overlay directory you used (e.g., overlays/single-replica-pvc) kubectl apply -k .
- Perform a rolling restart of the application pods to ensure they pick up the new secret values:
kubectl rollout restart deployment/apigee-kickstart -n apigee-devportal
The default configuration deploys an in-cluster MariaDB database, which is convenient for development and testing. For a production environment, it is highly recommended to use a managed, external database service like Google Cloud SQL for MySQL for better reliability, automated backups, and maintenance.
To use a managed database:
-
Provision your managed database instance (e.g., a Cloud SQL for MySQL instance). Ensure it is accessible from your GKE cluster's VPC network.
-
Update the secret files in the
base/directory with your managed database's connection details:- In
database.env, updateMYSQL_USERandMYSQL_PASSWORD(and others if needed). - In
application.env, updateDRUPAL_DATABASE_USER,DRUPAL_DATABASE_PASSWORD, and most importantly,DRUPAL_DATABASE_HOSTto point to your managed database's IP address or service endpoint.
- In
-
Disable the in-cluster database deployment. In
base/kustomization.yaml, comment out the resources related to the MariaDB deployment:# base/kustomization.yaml resources: - namespace.yml # - apigee-kickstart-database-deployment.yml # - apigee-kickstart-database-pvc.yml # - apigee-kickstart-database-service.yml - apigee-kickstart-service.yml - apigee-kickstart-deployment.yml
-
Deploy the application by running
kubectl apply -k .from your chosen overlay directory. The application will now connect to your external, managed database.
For a scalable, multi-replica production setup, you need a storage solution that supports ReadWriteMany access mode, allowing multiple application pods to read and write to the same file system simultaneously.
The overlays/gcp-filestore directory provides a production-ready example for this requirement, using Google Cloud Filestore as a managed NFS provider. This is the recommended approach for any multi-replica deployment on GCP.
To remove all Kubernetes resources created by your deployment:
-
Delete all resources from the overlay you deployed:
# From within the overlay directory you used (e.g., overlays/single-replica-pvc) kubectl delete -k .
-
Delete the namespace:
kubectl delete namespace apigee-devportal
(Note: If you deployed the GCP Filestore overlay, remember to follow the additional cleanup steps in its README to delete the Filestore instance.)