我正在尝试按以下方式配置HTTP活动性探针:
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
此处,URL路径包含查询参数以及身份验证标头(用户名:密码的base64编码)
但是,出现以下错误:
ERROR in app: Exception on /rest/sends/get [GET] (http 500)
我登录到Pod后检查它是否确实与状态代码200兼容
curl http://username:password@localhost:4000/rest/sends/get?source=mwTESt2VP3Q9M99GNWYvvaLQ1owrGTTjTb
这个问题可能类似于这个Kubernetes liveness probes with query string parameters
但是,据此应该已经解决。我正在主节点和其他节点上的Google cloud version: 1.10.7-gke.2
上使用Kubernetes。
我想念什么吗?
在服务器访问日志中,出现以下错误
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'
服务器实际上是交易对手服务器https://github.com/CounterpartyXCP/counterparty-lib
我不确定是什么问题。
答案 0 :(得分:0)
我将此标头添加到了请求中
public object this[int index] { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
public bool IsReadOnly => throw new NotImplementedException();
public bool IsFixedSize => throw new NotImplementedException();
public int Count => throw new NotImplementedException();
public object SyncRoot => throw new NotImplementedException();
public bool IsSynchronized => throw new NotImplementedException();
public int Add(object value)
{
throw new NotImplementedException();
}
public void Clear()
{
throw new NotImplementedException();
}
public bool Contains(object value)
{
throw new NotImplementedException();
}
public void CopyTo(Array array, int index)
{
throw new NotImplementedException();
}
public IEnumerator GetEnumerator()
{
throw new NotImplementedException();
}
public int IndexOf(object value)
{
throw new NotImplementedException();
}
public void Insert(int index, object value)
{
throw new NotImplementedException();
}
public void Remove(object value)
{
throw new NotImplementedException();
}
public void RemoveAt(int index)
{
throw new NotImplementedException();
}
现在可以正常工作了。
答案 1 :(得分:0)
如您所见,服务器在返回{unicodify_header_value“类HttpHeaders的函数getitem的最后一行登录。找不到名称“ HTTP_ACCEPT”,这是您的“ < strong> httpHeaders ”配置。 好收获。