<p>I'm trying to run Hasura locally in K8s. I have go 2 deployment files and 2 svc files respectively.</p>
<pre><code># Hasura Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: hasura
    hasuraService: custom
  name: hasura
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hasura
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: hasura
    spec:
      containers:
      - image: hasura/graphql-engine:v2.8.0
        imagePullPolicy: IfNotPresent
        name: hasura
        env:
        - name: HASURA_GRAPHQL_DATABASE_URL
          value: postgres://postgres:postgres@kubernetes.docker.internal:5432/postgres
        - name: HASURA_GRAPHQL_ADMIN_SECRET
          value: TopSecret
        ## enable the console served by server
        - name: HASURA_GRAPHQL_ENABLE_CONSOLE
          value: &quot;true&quot;
        ## enable debugging mode. It is recommended to disable this in production
        - name: HASURA_GRAPHQL_DEV_MODE
          value: &quot;true&quot;
        ports:
        - containerPort: 8080
          protocol: TCP
        resources: {}

</code></pre>
<pre><code># Hasura Service

apiVersion: v1
kind: Service
metadata:
  labels:
    app: hasura
  name: hasura
  namespace: default
spec:
  ports:
  - protocol: TCP
    port: 80
    targetPort: 8080
  selector:
    app: hasura
  type: LoadBalancer

</code></pre>
<pre><code>#Postgres Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: db
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: db
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        io.kompose.service: db
    spec:
      containers:
        - env:
            - name: POSTGRES_DB
              value: myDB
            - name: POSTGRES_HOST
              value: localhost
            - name: POSTGRES_PASSWORD
              value: somePassword
            - name: POSTGRES_USER
              value: postgres
          image: my_image
          imagePullPolicy: Never
          name: db
          ports:
            - containerPort: 5432
          resources: {}
          volumeMounts:
            - mountPath: /var/lib/postgresql/data/
              name: postgres-pv-storage
      restartPolicy: Always
      volumes:
        - name: postgres-pv-storage
          persistentVolumeClaim:
            claimName: postgres-pv-claim
status: {}
</code></pre>
<pre><code># Postgres Service

apiVersion: v1
kind: Service
metadata:
  labels:
    io.kompose.service: db
  name: db
  namespace: default
spec:
  type: ExternalName
  # https://docs.docker.com/docker-for-mac/networking/#use-cases-and-workarounds
  externalName: kubernetes.docker.internal
  ports:
    - name: &quot;5432&quot;
      port: 5432
      targetPort: 5432
status:
  loadBalancer: {}
</code></pre>
<p>However, Hasura service doensn't seem to start. Log says:</p>
<pre><code>$ kubectl logs hasura-7d5ddd9564-jzcxl
{&quot;internal&quot;:&quot;connection to server at \&quot;kubernetes.docker.internal\&quot; (192.167.62.4), port 5432 failed: Connection refused\n\tIs the server running on that host and accepting TCP/IP connections?\n&quot;,&quot;path&quot;:&quot;$&quot;,&quot;error&quot;:&quot;connection error&quot;,&quot;code&quot;:&quot;postgres-error&quot;}
</code></pre>
<p>Any idea on how to fix it?</p>

HelmBurger
<p>I wasn't able to solve the specific error I was getting but I did successfully manage to use Helm charts to implement Postgres in K8s. This overcame the error I was getting in first place.</p>
<p>This is what I'm using for Postgres: <a href="https://github.com/helm/charts/tree/master/stable/postgresql" rel="nofollow noreferrer">https://github.com/helm/charts/tree/master/stable/postgresql</a></p>
<p>And this is what I'm using for Hasura: <a href="https://hasura.io/docs/latest/graphql/core/deployment/deployment-guides/kubernetes/" rel="nofollow noreferrer">https://hasura.io/docs/latest/graphql/core/deployment/deployment-guides/kubernetes/</a></p>
<p>If you run into <code>EXTERNAL-IP</code> being stuck at <code>pending</code>, remember to run <code>minikube tunnel</code>. This is because <code>loadBalancer</code> used in the Hasura service is for deployments on Cloud, not local.</p>
