Run Hasura GraphQL Engine on Kubernetes

This guide assumes that you already have Postgres running and helps you set up the Hasura GraphQL engine on Kubernetes and connect it to your Postgres database.

Step 1: Get the Kubernetes deployment and service files

The hasura/graphql-engine/install-manifests repo contains all installation manifests required to deploy Hasura anywhere. Get the Kubernetes deployment and service files from there:

$ wget
$ wget

Step 2: Set the Postgres database url

Edit deployment.yaml and set the right database url:

    value: postgres://username:password@hostname:port/dbname

Examples of database-url:

  • postgres://admin:password@localhost:5432/my-db
  • postgres://admin:@localhost:5432/my-db (if there is no password)

Step 3: Create the Kubernetes deployment and service

$ kubectl create -f deployment.yaml
$ kubectl create -f svc.yaml

Step 4: Open the Hasura console

The above creates a LoadBalancer type service with port 80. So you should be able to access the console at the external IP.

For example, using Docker-for-desktop on Mac:

$ kubectl get svc
NAME         TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
hasura       LoadBalancer   localhost     80:30303/TCP   4m
kubernetes   ClusterIP       <none>        443/TCP        8m

Head to: http://localhost and the console should load!

Step 5: Track existing tables and relationships

See Setting up GraphQL schema using an existing database to enable GraphQL over the database.