-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration of trusted_proxies for deployment behind a reverse-proxy #30
Comments
Hi, The second issue is related to the values within trusted_proxies. It should be the IP address of the reverse proxy, but obtaining this value during the Helm chart installation is not feasible. Installing a reverse proxy is beyond the scope of this Helm chart. |
Sorry to bother on this thread, but was wondering what we should do if we're using nginx? Example values:
|
- mountPath: /config |
Could you perhaps make that optional? Then I think I could override the default with my own configmap.Also open to other suggestions!
Update
I tried changing the configmap name to the release name/fullnameoverride but still got the same error. Second attempt:
values.yaml
fullnameOverride: home-assistant
additionalVolumes:
- name: home-assistant
configMap:
name: home-assistant
ingress:
enabled: true
className: "nginx"
annotations:
kubernetes.io/tls-acme: "true"
cert-manager.io/cluster-issuer: letsencrypt-staging
hosts:
- host: home-assistant.beep.boop
paths:
- path: /
pathType: ImplementationSpecific
tls:
- secretName: home-assistant-tls
hosts:
- home-assistant.beep.boop
ConfigMap
- also trying with specific ip in case that affects something
---
apiVersion: v1
kind: ConfigMap
metadata:
name: home-assistant
data:
configuration.yaml: |
http:
use_x_forwarded_for: true
trusted_proxies:
- 10.--.--.--
Hi, I've identified two issues: Firstly, try mounting only one file: additionalVolumeMounts:
- name: home-assistant-config
mountPath: /config/configuration.yaml
subPath: configuration.yaml The existing Secondly, the trusted_proxies value should include the IP addresses of your Nginx controller. In a Kubernetes environment, this can be challenging to determine; however, when using k3s, I typically set the entire pod CIDR range to 10.42.0.0/16 (as per the k3s documentation on networking). For added security, I also implement a network policy, although this is optional. |
Thanks for the helm chart. I ran into this as well. My recommendation is for someone setting up the first time is to make use of port forwarding for the first time setup. If you just need port forwarding on localhost: kubectl -n homeassistant port-forward pod/helm-homeassistant-home-assistant-0 8123 8123 But in most cases, your k3s/k8s cluster is remote, so you need to listen all addresses: kubectl -n homeassistant port-forward pod/helm-homeassistant-home-assistant-0 --address 0.0.0.0 8123 8123 ` |
@pajikos I also run into this. I am not sure if it would be a good idea to manage the |
@pajikos Any updates for solution on this topic? |
Hey guys! I was able to make it work by editing the We can get into the pod with the following commands: kubectl exec -it -n home-assistant pod/home-assistant-0 -- bash
Now let's edit the config file:
Append this config at the end of the file, adapt the IP to your specific config. I'm using K3s with traefik as the reverse proxy:
Restart the statefulset to apply the changes:
Now you should be able to access the app using your ingress. |
@Starkie Yeah, that is of course an option, but the idea of making the chart provide a working configuration I think is the best solution. |
@pajikos IMO the golden solution for this have an init container that updates the config when a certain .Values.X is enabled probably with I have a couple of complicated months ahead, I can't commit to fix this, but I can help review if you jump into it. |
@jlpedrosa ok, I will suggest such a solution, but I think, http.trusted_proxies is required as well and that is the problem, each cluster has its own IP ranges. Are you using http.use_x_forwarded_for only? |
maybe something like this:
as part of the chart This way if you want to use vanilla version you leave out and if you want custom config you can override. happy to do the pr |
Be careful here, mounting the configuration.yaml is not a problem, but then it is not possible to edit this file. It would be necessary to mount this file into an init container and then copy it from there into the target configuration.yaml. I have already implemented a similar pattern on another project, I will try to outline it. |
I've got same issue today and eventually I managed to solve that by changing service type to LoadBalancer:
With this small change I've got no more connection errors to this service and probably no need for config change in files. edit: I created several headers middlewares earlier (in traefik), those work perfectly on GET, but still not for POST request, port forward has no such issue, still several things to modify to get it fully working on external domain via whitelist policy :/ |
Loadbancer may work as long as you don't use an ingress (depends on the loadbalancer), but with in an ingress it will always be L7 Proxy, and it will have the issue. @RLutsch I agree with @pajikos, We need to be very careful so we don't override other settings managed by the user. That is why I was sugesting to do it item by item in yq.
this ensures that only those two keys are modified. cc: @pajikos I was using both, but I was puting one for simplicty |
Yes, I got to the point where most of request were working but still some post and background ajax queries returned error. It was configured with traefik, but still I need to modify several things to make it working as well as on port forwarding (no problem here, but no ssl). |
Hey, maybe this is incredibly dumb so feel free to ignore. But would it not make sense to (if at all possible) add an include in configuration.yaml to some file... and have the helm-chart write said file, either making it just That way there would be a way to configure anything in home assistant by putting the relevant yaml in your own values for the chart... well... almost anything. You would still have problems if you wanted to remove something I guess. I don't know, I just thought it would be "neat" to use an include file. Mostly because you would keep the changes to configuration.yaml as minimal as possible. |
Hi, I have developed a general approach for configuring Home Assistant, including the use of a reverse proxy. See #55 for details. @jlpedrosa or others, it's quite a significant change, so it would be fine to test it before merging. Can you help me with this? I'm particularly concerned about using securityContext at any level. Many thanks. |
I can if you can wait a bit, I am out of town until the weekend.
tis 14 maj 2024 kl. 10:01 skrev Pavel Sklenář ***@***.***>:
… Hi, I have developed a general approach for configuring Home Assistant,
including the use of a reverse proxy. See #55
<#55> for
details. @jlpedrosa <https://github.com/jlpedrosa> or others, it's quite
a significant change, so it would be fine to test it before merging. Can
you help me with this? I'm particularly concerned about using
securityContext at any level. Many thanks.
—
Reply to this email directly, view it on GitHub
<#30 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAASHYRTSUXQNQDOC7RBMQTZCHAHLAVCNFSM6AAAAABDCEZDPCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBZGUZTCOJRG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I was having an issue where my trusted proxies weren't getting added to the configuration.yaml, and then realised that of course it only happens if the value |
Hey team, did not have time to test it, IMO it felt a bit dangerous..... |
Ok, good point, I am thinking about adding configuration property externalIngress = "true|false" to be able to include trusted_proxies in a case of using custom reverse proxy |
Is there a way to pass customize the configuration.yaml that is deployed in the chart to include values for trusted_proxies? This would be very useful for setups that are using a reverse-proxy.
If possible, adding an additional configuration file that is auto filled with appropriate values if a reverse proxy is in use would be an excellent addition. This file could be included from the base configuration.yaml file.
The text was updated successfully, but these errors were encountered: