Kubernetes
Hook0 Self-Hosting Guide on Kubernetes
This guide will help you self-host Hook0 on your Kubernetes cluster using the
provided deployments.yaml file. Follow these steps to get your Hook0 instance up and running.
Prerequisites
Before you begin, ensure you have the following prerequisites:
- A Kubernetes cluster up and running.
kubectl
command-line tool configured to interact with your Kubernetes cluster.- Persistent storage available for PostgreSQL and Mailpit.
Deployment Overview
The provided deployments.yaml file sets up the following components:
- API Service: Exposes the Hook0 API.
- Frontend Service: Hosts the Hook0 frontend.
- Mailpit Service: Manages outgoing emails.
- PostgreSQL Service: Database for storing Hook0 data.
- Output Worker: Processes webhook calls for Hook0.
Steps to Deploy
1. Create the Namespace
First, create a dedicated Hook0
namespace for Hook0 to keep everything organized.
kubectl apply -f deployments.yaml -l kind=Namespace
This command applies only the Namespace
section of the deployments.yaml
.
2. Deploy the Services
Next, deploy all the services and deployments defined in the deployments.yaml
.
kubectl apply -f deployments.yaml
This will create all the necessary services, deployments, and persistent volume claims for Hook0.
3. Verify Deployments
After applying the deployments.yaml
, verify that all pods are running:
kubectl get pods -n hook0
All pods should be in the Running
state. If any pods are not running, use the following command to debug:
kubectl describe pod <pod-name> -n hook0
4. Access the Hook0 Services
Frontend
-
Access the frontend service using the following command to get the service details:
kubectl get svc frontend -n hook0
-
Use the external IP or NodePort displayed to access the frontend in your browser.
API
-
Similarly, to access the API service, use:
kubectl get svc api -n hook0
5. Persistent Data Storage
The PostgreSQL and Mailpit services require persistent data storage, which is managed through Persistent Volume Claims (
PVCs). Ensure that your cluster has sufficient storage for these claims. The provided deployments.yaml
requests 100Mi of storage for each service.
6. Customize Your Deployment (Optional)
You may want to adjust the environment variables in the deployments.yaml
for your specific use case. For example, you can update the DATABASE_URL
, APP_URL
, or any other environment variable to fit your infrastructure.
7. Troubleshooting
- Pods not starting: Check if the images are available and correct.
- Persistent Volume issues: Ensure your storage class supports the requested resources.
- Service access issues: Confirm that your Kubernetes network configuration allows external access.
Cleanup
To delete the Hook0 deployment, run:
kubectl delete namespace hook0
This command will remove all resources associated with Hook0 from your cluster.
Conclusion
Following these steps, you should have a fully functional Hook0 instance running on your Kubernetes cluster. For further
customization and scaling, refer to the Kubernetes and Hook0 documentation.
If you encounter any issues or have questions, feel free to reach out to the Hook0 community or check the official
documentation.
Updated 3 months ago