3👍
✅
Turns out, it’s the IP of the load balancer. In the settings.py file I changed the allowed hosts to
ALLOWED_HOSTS = [os.environ.get('LOAD_BALANCER_IP', '127.0.0.1')]
and in my deployment yaml I added the load balancer IP as an evironment variable to my container:
spec:
containers:
- env:
- name: LOAD_BALANCER_IP
value: xx.xx.xx.xx
This way I can have the app work automatically both on deploy to the kubernetes cluster and on localhost for development.
Source:stackexchange.com