June 29, 2022

Using HarperDB with Kubernetes

Welcome to Community Posts
Click below to read the full article.
Summary of What to Expect
Table of Contents
  1. Install and run HarperDB locally using Docker:
  2. Use the command: docker run -d -e HDB_ADMIN_USERNAME=user -e HDB_ADMIN_PASSWORD=password -p 9925:9925 harperdb/harperdb.
  3. Ensure port 9925 is open to connect to HarperDB Studio.
  4. Create a Kubernetes cluster:
  5. Use a managed Kubernetes service (e.g., Azure AKS).
  6. Create a new resource group and name the cluster.
  7. Connect to the Kubernetes cluster:
  8. Install Azure CLI and kubectl.
  9. Use az aks get-credentials -n harperdb -g harperdb-aks --admin to download credentials.
  10. Create a namespace for the database: kubectl create namespace database.
  11. Prepare the Kubernetes manifests (in manifests.yaml):
  12. Create a deployment for HarperDB with necessary configurations like environment variables, resource limits, ports, and volume mounts.
  13. Define a persistent volume claim (PVC) to request storage for data persistence.
  14. Apply the manifests to the cluster: kubectl apply -f ./manifests.yml.
  15. Verify the deployment and storage:
  16. Check the deployment status: kubectl get deploy harperdb -n database.
  17. Ensure the persistent volume is created in the Azure portal.
  18. Access HarperDB in the Kubernetes cluster:
  19. Forward the local connection to the service using: kubectl port-forward svc/harperdb 9925:9925 -n database.
  20. Access the HarperDB Studio in the browser and create a new instance using the credentials defined in the deployment manifest.
  21. Set up the database:
  22. Create a new database, user, and grant permissions as needed.