Skip to content

Latest commit

 

History

History
123 lines (80 loc) · 3.48 KB

kubernetes.md

File metadata and controls

123 lines (80 loc) · 3.48 KB

Local Kubernetes Deployment

Requirements

  1. Kubernetes Cluster; if you are already running Shannon in Localnet, you can work with it.
  2. Helm & PostgreSQL; optional if you already have PostgreSQL

Deploy it

NOTE: Before proceeding, ensure that the Kubernetes deployment has access to the Pocketdex image. You can build the image by following the instructions in the main README file.

Then, do one of the following:

  1. Load it into your Kubernetes cluster using kind local docker-images <image:tag>(if you're using it)
  2. Push it to your preferred container registry

1. [Optional] Set Up PostgreSQL

NOTE: Skip this step if you already have a PostgreSQL instance running.

Add the Bitnami Helm repository:

helm repo add bitnami https://charts.bitnami.com/bitnami

Replace all the CHANGEME placeholders in kubernetes/postgresql-values.yaml.

Install PostgreSQL:

helm install postgresql bitnami/postgresql --version 15.5.23 -f kubernetes/postgresql-values.yaml

2. Update Database Secrets

Replace all the CHANGEME placeholders in kubernetes/db-secrets.yaml.

Deploy them using:

kubectl apply -f kubernetes/db-secrets.yaml

3. Configure the Application

Review/Edit and deploy the ConfigMap found in kubernetes/configmap.yaml:

kubectl apply -f kubernetes/configmap.yaml

4. Deploy Indexer and Query Components

Create the indexer deployment and service:

kubectl apply -f kubernetes/indexer-deployment.yaml

Create the query deployment and service:

kubectl apply -f kubernetes/query-deployment.yaml

Explore Locally

To explore the application locally, you can access the query playground using a simple port-forward:

kubectl port-forward svc/pocketdex-query --address 127.0.0.1 3000:3000

Navigate to http://localhost:3000, and you should see the GraphQL Playground.

Expose Publically

If you need to permanently expose this to the world, you will need an Ingress controller. Any Ingress controller should work, but here are a few popular ones:

Once the ingress controller is set up, you can use the example Ingress configuration located at kubernetes/ingress.yaml.

NOTE: This file is just an example. You should review and edit it as needed before deploying it. If you need TLS support, ensure your Ingress Controller is configured to handle it in front of the query service.

kubectl apply -f kubernetes/ingress.yaml

Watch the Logs

To watch the logs for both the Indexer and Query components:

kubectl logs -f -l app=pocketdex

To watch the logs for the Indexer component only:

kubectl logs -f -l app=pocketdex -l component=indexer

To watch the logs for the Query component only:

kubectl logs -f -l app=pocketdex -l component=query