Self-hosting DocsGPT on Kubernetes
This guide will walk you through deploying DocsGPT on Kubernetes.
Prerequisites
Ensure you have the following installed before proceeding:
- kubectl (opens in a new tab)
- Access to a Kubernetes cluster
Folder Structure
The k8s
folder contains the necessary deployment and service configuration files:
deployments/
services/
docsgpt-secrets.yaml
Deployment Instructions
-
Clone the Repository
git clone https://github.com/arc53/DocsGPT.git cd docsgpt/k8s
-
Configure Secrets (optional)
Ensure that you have all the necessary secrets in
docsgpt-secrets.yaml
. Update it with your secrets before applying if you want. By default we will use qdrant as a vectorstore and public docsgpt llm as llm for inference. -
Apply Kubernetes Deployments
Deploy your DocsGPT resources using the following commands:
kubectl apply -f deployments/
-
Apply Kubernetes Services
Set up your services using the following commands:
kubectl apply -f services/
-
Apply Secrets
Apply the secret configurations:
kubectl apply -f docsgpt-secrets.yaml
-
Substitute API URL
After deploying the services, you need to update the environment variable
VITE_API_HOST
in your deployment filedeployments/docsgpt-deploy.yaml
with the actual endpoint URL created by yourdocsgpt-api-service
.kubectl get services/docsgpt-api-service -o jsonpath='{.status.loadBalancer.ingress[0].ip}' | xargs -I {} sed -i "s|<your-api-endpoint>|{}|g" deployments/docsgpt-deploy.yaml
-
Rerun Deployment
After making the changes, reapply the deployment configuration to update the environment variables:
kubectl apply -f deployments/
Verifying the Deployment
To verify if everything is set up correctly, you can run the following:
kubectl get pods
kubectl get services
Ensure that the pods are running and the services are available.
Accessing DocsGPT
To access DocsGPT, you need to find the external IP address of the frontend service. You can do this by running:
kubectl get services/docsgpt-frontend-service | awk 'NR>1 {print "http://" $4}'
Troubleshooting
If you encounter any issues, you can check the logs of the pods for more details:
kubectl logs <pod-name>
Replace <pod-name>
with the actual name of your DocsGPT pod.