Home assistant (400 Bad Request) Kubernetes + Gateway API

I’m using Kubernetes for my Home Assistant, and it seems to be running smoothly. When I port-forward to port 8080, I can see the frontend. However, when I use a domain, I get a 404 error.

Everything seems to be running smoothly with Kubernetes for Home Assistant. When I port-forward to port 8080, I can access the frontend. However, when I use a domain, I get a “400 bad request” error.

I’m using Argo CD to deploy a Helm chart into my cluster like this. I’ve experimented with different configurations, but haven’t managed to see the welcome screen when using a domain name only.

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: home-assistant
spec:
  project: default
  source:
    chart: home-assistant
    repoURL: http://pajikos.github.io/home-assistant-helm-chart/
    targetRevision: 0.2.*
    helm:
      releaseName: home-assistant
      values: |
        replicaCount: 1

  destination:
    server: "https://kubernetes.default.svc"
    namespace: home-assistant
  syncPolicy:
    syncOptions:
    - CreateNamespace=true
    automated:
      prune: true
      selfHeal: true

Too little information, I’m afraid.
As we don’t know what helm chart you’re using, it would be good to post the “expansion” of it, i.e. a helm template

Probably an ingress issue, though, but we don’t know what is meant by “when I use a domain”, technically.

I use helm chart http://pajikos.github.io/home-assistant-helm-chart/ you can see more about it here home-assistant 0.2.114 · pajikos/helm-hass

domain is mean when i use a ingress domain DNS name its not working, when i just use a port-forwarding port as localhost directly to the pod its works fine.

and yes its for sure something with the ingress part, but what :slight_smile:

At least, post your values file, and what url you’re actually trying to use…

I have no values set, just defualts, and my DNS name are home-assistant.homelab.k8s ← i just change my loacl-host file for now on my machine.

This is what’s generated by a default configuration. It simply has no ingress.

---
# Source: home-assistant/templates/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: home-assistant
  labels:
    helm.sh/chart: home-assistant-0.2.114
    app.kubernetes.io/name: home-assistant
    app.kubernetes.io/instance: home-assistant
    app.kubernetes.io/version: "2025.3.3"
    app.kubernetes.io/managed-by: Helm
---
# Source: home-assistant/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: home-assistant
  labels:
    helm.sh/chart: home-assistant-0.2.114
    app.kubernetes.io/name: home-assistant
    app.kubernetes.io/instance: home-assistant
    app.kubernetes.io/version: "2025.3.3"
    app.kubernetes.io/managed-by: Helm
spec:
  type: ClusterIP
  ports:
    - port: 8080
      targetPort: http
      protocol: TCP
      name: http
  selector:
    app.kubernetes.io/name: home-assistant
    app.kubernetes.io/instance: home-assistant
---
# Source: home-assistant/templates/statefulset.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: home-assistant
  labels:
    helm.sh/chart: home-assistant-0.2.114
    app.kubernetes.io/name: home-assistant
    app.kubernetes.io/instance: home-assistant
    app.kubernetes.io/version: "2025.3.3"
    app.kubernetes.io/managed-by: Helm
spec:
  serviceName: home-assistant
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: home-assistant
      app.kubernetes.io/instance: home-assistant
  template:
    metadata:
      labels:
        app.kubernetes.io/name: home-assistant
        app.kubernetes.io/instance: home-assistant
      annotations:
    spec:
      serviceAccountName: home-assistant
      securityContext:
        {}
      containers:
        - name: home-assistant
          securityContext:
            {}
          image: "ghcr.io/home-assistant/home-assistant:2025.3.3"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 8123
              protocol: TCP
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /
              port: http
              scheme: HTTP
            periodSeconds: 20
            successThreshold: 1
            timeoutSeconds: 2
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /
              port: http
              scheme: HTTP
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 1
          volumeMounts:
          - mountPath: /config
            name: home-assistant
      volumes:
      - name: home-assistant
        emptyDir: {}
---
# Source: home-assistant/templates/tests/test-connection.yaml
apiVersion: v1
kind: Pod
metadata:
  name: "home-assistant-test-connection"
  labels:
    helm.sh/chart: home-assistant-0.2.114
    app.kubernetes.io/name: home-assistant
    app.kubernetes.io/instance: home-assistant
    app.kubernetes.io/version: "2025.3.3"
    app.kubernetes.io/managed-by: Helm
  annotations:
    "helm.sh/hook": test
spec:
  containers:
    - name: wget
      image: busybox
      command: ['wget']
      args: ['home-assistant:8080']
  restartPolicy: Never

But it have a services created if you after this setup use kubectl get svc -n home-assistant its will show you a service, and here is what my challenges are I’m use Gateway API to as ingress to share the same external IP in my cluster.

my Gateway API YAML looks like this

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: home-assistant-homelab-k8s
  namespace: home-assistant
  labels:
    gateway: homelab-gateway

spec:
  parentRefs:
    - name: homelab-gateway
      namespace: infra-system
      sectionName: home-assistant-homelab-k8s-dns-tls
      
  hostnames: 
    - "home-assistant.homelab.k8s"

  rules:
    - matches:
      - path:
          type: PathPrefix
          value: /

      backendRefs:
        - name: home-assistant
          port: 8080

but its return “bad request” when i try it,

I don’t know Gateway API, but according to the doc, it should be the service name, here. When deploying through helm, my service name is <helm release-name>-home-assistant.

What’s the actual output of kubectl get svc -n home-assistant ?

Note that I’m assuming you run everything in the same namespace, here.

i can see i hit the pod, but did not get access, so i’m trying to fixvthe proxie issue right now, :slight_smile:

│ s6-rc: info: service s6rc-oneshot-runner: starting                                                                                                                                                                   │
│ s6-rc: info: service s6rc-oneshot-runner successfully started                                                                                                                                                        ││ s6-rc: info: service fix-attrs: starting                                                                                                                                                                             │
│ s6-rc: info: service fix-attrs successfully started                                                                                                                                                                  │
│ s6-rc: info: service legacy-cont-init: starting                                                                                                                                                                      │
│ s6-rc: info: service legacy-cont-init successfully started                                                                                                                                                           │
│ s6-rc: info: service legacy-services: starting                                                                                                                                                                       │
│ services-up: info: copying legacy longrun home-assistant (no readiness notification)                                                                                                                                 │
│ s6-rc: info: service legacy-services successfully started                                                                                                                                                            │
│ 2025-03-16 16:03:10.071 WARNING (Recorder) [homeassistant.components.recorder.util] The system could not validate that the sqlite3 database at //config/home-assistant_v2.db was shutdown cleanly                    │
│ 2025-03-16 16:03:10.085 WARNING (Recorder) [homeassistant.components.recorder.util] Ended unfinished session (id=1 from 2025-03-16 07:35:51.952302)                                                                  │
│ 2025-03-16 16:03:36.834 ERROR (MainThread) [homeassistant.components.http.forwarded] A request from a reverse proxy was received from 10.0.0.202, but your HTTP integration is not set-up for reverse proxies        │
│ 2025-03-16 16:05:01.868 ERROR (MainThread) [homeassistant.components.http.forwarded] A request from a reverse proxy was received from 10.0.0.202, but your HTTP integration is not set-up for reverse proxies 
1 Like

I have found the fix, its the way the helm chart are build on, and it’s not out of the box support Gateway API, so i shoud create the template config at my self first, when i deploy it, and now its working as i expect, :slight_smile:

Thanks for trying to help me :slight_smile:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: home-assistant
spec:
  project: default
  source:
    chart: home-assistant
    repoURL: http://pajikos.github.io/home-assistant-helm-chart/
    targetRevision: 0.2.*
    helm:
      releaseName: home-assistant
      values: |
        replicaCount: 1
        configuration:
          enabled: true

          templateConfig: |-
            # Loads default set of integrations. Do not remove.
            default_config:

            http:
              use_x_forwarded_for: true
              trusted_proxies:
                - 10.0.0.0/8
                - 172.16.0.0/12
                - 192.168.0.0/16
                - 127.0.0.0/8

            # Load frontend themes from the themes folder
            frontend:
              themes: !include_dir_merge_named themes

            automation: !include automations.yaml
            script: !include scripts.yaml
            scene: !include scenes.yaml

  destination:
    server: "https://kubernetes.default.svc"
    namespace: home-assistant

  syncPolicy:
    syncOptions:
    - CreateNamespace=true
    automated:
      prune: true
      selfHeal: true