graphql-engine/docs/graphql/manual/deployment/kubernetes/securing-graphql-endpoint.rst
2019-03-06 14:28:04 +05:30

52 lines
1.5 KiB
ReStructuredText

Securing the GraphQL endpoint (Kubernetes)
==========================================
.. contents:: Table of contents
:backlinks: none
:depth: 1
:local:
To make sure that your GraphQL endpoint and the Hasura console are not publicly accessible, you need to
configure an admin secret key.
Add the HASURA_GRAPHQL_ADMIN_SECRET env var
-------------------------------------------
Update the ``deployment.yaml`` to set the ``HASURA_GRAPHQL_ADMIN_SECRET`` environment variable.
.. code-block:: yaml
:emphasize-lines: 10,11
...
spec:
containers:
...
command: ["graphql-engine"]
args: ["serve", "--enable-console"]
env:
- name: HASURA_GRAPHQL_DATABASE_URL
value: postgres://username:password@hostname:port/dbname
- name: HASURA_GRAPHQL_ADMIN_SECRET
value: mysecretkey
ports:
- containerPort: 8080
protocol: TCP
resources: {}
.. note::
The ``HASURA_GRAPHQL_ADMIN_SECRET`` should never be passed from the client to Hasura GraphQL engine as it would
give the client full admin rights to your Hasura instance. See :doc:`../../auth/index` for information on
setting up Authentication.
(optional) Use the admin secret key with the CLI
------------------------------------------------
In case you're using the CLI to open the Hasura console, use the ``admin-secret`` flag when you open the console:
.. code-block:: bash
hasura console --admin-secret=myadminsecretkey