Helm chart kubernetes installation: Problem with hostNetwork: true

Hi! I am trying to install home assistant via official helm chart, but when I set hostNetwork: true
and enable ingress all containers are in pending state saying:

Warning  FailedScheduling  <unknown>  default-scheduler  0/1 nodes are available: 1 node(s) didn't have free ports for the requested pod ports

If I set hostNetwork: true, installation is fine and I am able to connect to home-assistant via created ingress resource for the main container. But without host network, home assistant does not see anything in my network (thats logical).

Any ideas how to fix this?

Also, there are no configuration examples for hass-configurator and vscode containers. What should be configured in ingress part for these components?

Hi @arrowcircle, Not sure why you would need to set hostNetwork in this instance. Can you share a sanitized version of your helm values configuration?

For comparison, this is what I use (note the parts about vscode):

image:
  repository: homeassistant/home-assistant
  tag: 0.104.3
persistence:
  enabled: true
  size: 10Gi
  storageClass: "rook-ceph-block"
ingress:
  enabled: true
  annotations:
    kubernetes.io/ingress.class: "nginx"
  hosts: 
  - hass.mydomain.com
  tls:
  - hosts:
    - hass.mydomain.com
probes:
  liveness:
    enabled: false
  readiness:
    enabled: false
podAnnotations:
  backup.velero.io/backup-volumes: config
vscode:
  enabled: true
  password: <HASS API Password>
  extraEnv:
    HASS_SERVER: http://localhost:8123
    HASS_TOKEN: <HASS TOKEN>
  ingress:
    enabled: true
    annotations:
      kubernetes.io/ingress.class: "nginx"
    hosts: 
    - hass-vscode.mydomain.com
    tls:
    - hosts:
      - hass-vscode.mydomain.com
    annotations:
      nginx.ingress.kubernetes.io/auth-url: "https://auth.mydomain.com/oauth2/auth"
      nginx.ingress.kubernetes.io/auth-signin: https://auth.mydomain.com/oauth2/start
resources:
  limits:
    memory: 2500Mi
  requests:
    cpu: 35m
    memory: 2000Mi
monitoring:
  enabled: true
extraEnv:
  CAMERA_AUTH: <CAMERA AUTH TOKEN>

Hi! Thanks for the answer. I need hostNetwork to be able to discover devices in my home network. Problem with port is because I have clickhouse running on 8123 port. I tried to change port to 8124, but it does not help - hass cant start.

# Default values for home-assistant.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

image:
  repository: homeassistant/home-assistant
  tag: 0.104.2
  pullPolicy: IfNotPresent
  pullSecrets: []

# upgrade strategy type (e.g. Recreate or RollingUpdate)
strategyType: Recreate

# Probes configuration
probes:
  liveness:
    enabled: true
    initialDelaySeconds: 60
    failureThreshold: 5
    timeoutSeconds: 10
  readiness:
    enabled: true
    initialDelaySeconds: 60
    failureThreshold: 5
    timeoutSeconds: 10
  startup:
    enabled: false
    failureThreshold: 30
    periodSeconds: 10
service:
  type: ClusterIP
  port: 8123
  annotations: {}
  labels: {}
  clusterIP: ""
  ## List of IP addresses at which the hass-configurator service is available
  ## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips
  ##
  externalIPs: []
  loadBalancerIP: ""
  loadBalancerSourceRanges: []
  # nodePort: 30000

ingress:
  enabled: true
  annotations:
    kubernetes.io/tls-acme: "true"
    cert-manager.io/cluster-issuer: le-prod-ci
  path: /
  hosts:
  - hass.domain
  tls:
  - secretName: home-assistant-tls
    hosts:
    - hass.domain

hostNetwork: false

persistence:
  enabled: true
  ## home-assistant data Persistent Volume Storage Class
  ## If defined, storageClassName: <storageClass>
  ## If set to "-", storageClassName: "", which disables dynamic provisioning
  ## If undefined (the default) or set to null, no storageClassName spec is
  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
  ##   GKE, AWS & OpenStack)
  ##
  # storageClass: "-"
  ##
  ## If you want to reuse an existing claim, you can pass the name of the PVC using
  ## the existingClaim variable
  # existingClaim: your-claim
  ##
  ## If you want to use a volume on the host machine instead of a PVC:
  hostPath: /var/hass
  accessMode: ReadWriteOnce
  size: 5Gi

## Additional hass container environment variable
## For instance to add a http_proxy
##
extraEnv: {}

## Additional hass container environment variable from k8s secrets
## For instance to add a password
## can use `!env_var` in the home assistant configuration to reference these variables
extraEnvSecrets:
  # Example
  # This will set ${MQTT_PASSWORD} to the 'password' key from the 'mqtt' secret
  # MQTT_PASSWORD:
  #   secret: mqtt
  #   key: password

# Enable pod security context (must be `true` if runAsUser or fsGroup are set)
usePodSecurityContext: true
# Set runAsUser to 1000 to let home-assistant run as non-root user 'hass' which exists in 'runningman84/alpine-homeassistant' docker image.
# When setting runAsUser to a different value than 0 also set fsGroup to the same value:
# runAsUser: <defaults to 0>
# fsGroup: <will be omitted in deployment if runAsUser is 0>

git:
  enabled: false

  ## we just use the hass-configurator container image
  ## you can use any image which has git and openssh installed
  ##
  image:
    repository: causticlab/hass-configurator-docker
    tag: 0.3.7-x86_64
    pullPolicy: IfNotPresent

  ## Specify the command that runs in the git-sync container to pull in configuration.
  # command: []

  # repo:
  secret: git-creds
  syncPath: /config
  keyPath: /root/.ssh

zwave:
  enabled: false
  device: ttyACM0

# Mount devices or folders from the host machine. Can be used for USB device mounting.
hostMounts: []
  # Example
  # - name: zha
  #   hostPath: /dev/serial/by-id/usb-Silicon_Labs_HubZ_Smart_Home_Controller_6120245D-if01-port0

configurator:
  enabled: true

  ## hass-configurator container image
  ##
  image:
    repository: causticlab/hass-configurator-docker
    tag: 0.3.7-x86_64
    pullPolicy: IfNotPresent

  ## URL for the home assistant API endpoint
  hassApiUrl: http://home-assistant.hass:8124/api/
  ## home assistant API password
  # hassApiPassword:
  ## path where the home assistant configuration is stored
  basepath: /config
  ## don't allow switching out of the base path
  enforceBasepath: true
  ## username for basic auth for accessing the configurator
  # username:
  ## password (sha256-hash) for basic auth for accessing the configurator
  ## For example "test" would be "{sha256}9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
  # password:

  ## Additional hass-configurator container environment variable
  ## For instance to add a http_proxy
  ##
  extraEnv: {}

  ingress:
    enabled: true
    annotations:
      kubernetes.io/tls-acme: "true"
      cert-manager.io/cluster-issuer: le-prod-ci
    path: /configurator
    hosts:
    - hass.domain
    tls:
    - secretName: home-assistant-tls
      hosts:
      - hass.domain

  service:
    type: ClusterIP
    port: 3218
    annotations: {}
    labels: {}
    clusterIP: ""
    ## List of IP addresses at which the hass-configurator service is available
    ## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips
    ##
    externalIPs: []
    loadBalancerIP: ""
    loadBalancerSourceRanges: []
    # nodePort: 30000

## Add support for Prometheus
# settings has to be enabled in configuration.yaml
# https://www.home-assistant.io/components/prometheus/
monitoring:
  enabled: false
  serviceMonitor:
    # When set true and if Prometheus Operator is installed then use a ServiceMonitor to configure scraping
    enabled: true
    # Set the namespace the ServiceMonitor should be deployed
    # namespace: monitoring
    # Set how frequently Prometheus should scrape
    # interval: 30s
    # Set path to beats-exporter telemtery-path
    # telemetryPath: /metrics
    # Set labels for the ServiceMonitor, use this to define your scrape label for Prometheus Operator
    # labels:

vscode:
  enabled: true

  ## code-server container image
  ##
  image:
    repository: codercom/code-server
    tag: 2.1697-vsc1.39.2
    pullPolicy: IfNotPresent

  ## VSCode password
  # password:

  ## path where the home assistant configuration is stored
  hassConfig: /config

  ## path where the VS Code data should reside
  vscodePath: /config/.vscode

  ## Additional hass-vscode container environment variable
  ## For instance to add a http_proxy
  ##
  extraEnv: {}

  ingress:
    enabled: true
    annotations:
      kubernetes.io/tls-acme: "true"
      cert-manager.io/cluster-issuer: le-prod-ci
    path: /vscode
    hosts:
    - hass.domain
    tls:
    - secretName: home-assistant-tls
      hosts:
      - hass.domain

  service:
    type: ClusterIP
    port: 80
    annotations: {}
    labels: {}
    clusterIP: ""
    ## List of IP addresses at which the hass-vscode service is available
    ## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips
    ##
    externalIPs: []
    loadBalancerIP: ""
    loadBalancerSourceRanges: []
    # nodePort: 30000

resources: {}
  # We usually recommend not to specify default resources and to leave this as a conscious
  # choice for the user. This also increases chances charts run on environments with little
  # resources, such as Minikube. If you do want to specify resources, uncomment the following
  # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
  # limits:
  #  cpu: 100m
  #  memory: 128Mi
  # requests:
  #  cpu: 100m
  #  memory: 128Mi

nodeSelector: {}

tolerations: []

affinity: {}

podAnnotations: {}

# Any extra volumes to define for the pod
extraVolumes: []
  # - name: example-name
  #   hostPath:
  #     path: /path/on/host
  #     type: DirectoryOrCreate

# Any extra volume mounts to define for the containers
extraVolumeMounts: []
#   - name: example-name
#     mountPath: /path/in/container