I was testing my Django app on minikube
and because of the probes, it was failing with the following error:
Invalid HTTP_HOST header: '10.244.0.8:8080'. You may need to add '10.244.0.8' to ALLOWED_HOSTS.
Bad Request: /
I added the httpHeaders
in my probes and it worked after that.
Before:
livenessProbe:
httpGet:
path: / # Replace with an endpoint that returns a 200 status code if the app is healthy
port: 8080
initialDelaySeconds: 10 # Delay before the first probe is executed
periodSeconds: 10 # How often to perform the probe
readinessProbe:
httpGet:
path: / # Replace with an endpoint that indicates readiness
port: 8080
initialDelaySeconds: 5 # Delay before the first probe is executed
periodSeconds: 5 # How often to perform the probe
After:
livenessProbe:
httpGet:
path: / # Replace with an endpoint that returns a 200 status code if the app is healthy
port: 8080
httpHeaders:
- name: Host
value: localhost
initialDelaySeconds: 10 # Delay before the first probe is executed
periodSeconds: 10 # How often to perform the probe
readinessProbe:
httpGet:
path: / # Replace with an endpoint that indicates readiness
port: 8080
httpHeaders:
- name: Host
value: localhost
initialDelaySeconds: 5 # Delay before the first probe is executed
periodSeconds: 5 # How often to perform the probe