I am trying to configure the HTTP liveness probe as follows:
livenessProbe:
httpGet:
path: /rest/sends/get?source=mwTESt2VP3Q9M99GNWYvvaLQ1owrGTTjTb #sends API to test address
port: 4000
httpHeaders:
- name: Authorization
value: Basic cnBjOnUzSGRlM0xvaWI1SGpEcTFTZGVoQktpU1NBbHE=
initialDelaySeconds: 60 #wait this period after staring fist time
periodSeconds: 30 # polling interval
timeoutSeconds: 30 # wish to receive response within this time period
Here, the URL path contains query parameters along with an authentication header (base64 encoding of username:password)
However, I get the following error:
ERROR in app: Exception on /rest/sends/get [GET] (http 500)
I checked that this indeed works with status code 200 after logging into the pod
curl http://username:password@localhost:4000/rest/sends/get?source=mwTESt2VP3Q9M99GNWYvvaLQ1owrGTTjTb
This question is probably similar to this one Kubernetes liveness probes with query string parameters
But, according to it, this should have already been fixed. I am using Kubernetes on Google cloud version: 1.10.7-gke.2
on both master and other nodes.
Am I missing something?
In the server access log, I get the following error
10.0.2.1 - - [10/Oct/2018 03:50:45] "GET /rest/sends/get?source=mwTESt2VP3Q9M99GNWYvvaLQ1owrGTTjTb HTTP/1.1" 500 -
Exception on /rest/sends/get [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1988, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1641, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1544, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 33, in reraise
raise value
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1639, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1625, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.5/dist-packages/flask_httpauth.py", line 88, in decorated
return f(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/counterparty_lib-9.55.4-py3.5.egg/counterpartylib/lib/api.py", line 813, in handle_root
response = handle_rest(rest_path, flask.request)
File "/usr/local/lib/python3.5/dist-packages/counterparty_lib-9.55.4-py3.5.egg/counterpartylib/lib/api.py", line 935, in handle_rest
file_format = flask_request.headers['Accept']
File "/usr/local/lib/python3.5/dist-packages/werkzeug/datastructures.py", line 1354, in __getitem__
return _unicodify_header_value(self.environ['HTTP_' + key])
KeyError: 'HTTP_ACCEPT'
The server is actually a counterparty-server https://github.com/CounterpartyXCP/counterparty-lib
I am not really sure what the problem is.
I added this header to the request
httpHeaders:
- name: Authorization
value: Basic cnBjOnUzSGRlM0xvaWI1SGpEcTFTZGVoQktpU1NBbHE=
- name: Accept
value: application/json
And now it's working alright.
As you can see, the server logs at the end line, in the function getitem that return "unicodify_header_value" the Class HttpHeaders.Names 'HTTP_ACCEPT' wasn't found, this what was missing in your "httpHeaders" config. nice catch.