我已经在我的k8s集群上安装了6个和6个带有头盔的仪表板。除了admin和viewer acc.之外,我使用了所有默认设置,仪表板使用了自定义用户名/密码。所以我现在运行的是2.15版本。
我的安装步骤
helm repo add apisix https://charts.apiseven.com
helm repo update
# installing apisix/apisix
helm install --set-string admin.credentials.admin="new_api_key"
--set-string admin.credentials.viewer="new_api_key" apisix apisix/apisix --create-namespace --namespace my-apisix
# installing apisix/apisix-dashboard, where values.yaml contains username/password
helm install -f values.yaml apisix-dashboard apisix/apisix-dashboard --create-namespace --namespace my-apisix我无法配置模拟插件,我一直在跟踪文档。在提供的示例中,我无法使用ID 1在路由上调用API,因此我创建了一个自定义路由,然后使用了视图json,在该视图中,我将配置相应地更改为提供的示例。此路由上的所有调用都返回502错误,在日志中我可以看到路由是将流量路由到不存在的服务器。所有这些都让我相信,模拟插件是禁用的。
我的路线的例子:
{
"uri": "/mock-test.html",
"name": "mock-sample-read",
"methods": [
"GET"
],
"plugins": {
"mocking": {
"content_type": "application/json",
"delay": 1,
"disable": false,
"response_schema": {
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"a": {
"type": "integer"
},
"b": {
"type": "integer"
}
},
"required": [
"a",
"b"
],
"type": "object"
},
"response_status": 200,
"with_mock_header": true
}
},
"upstream": {
"nodes": [
{
"host": "127.0.0.1",
"port": 1980,
"weight": 1
}
],
"timeout": {
"connect": 6,
"send": 6,
"read": 6
},
"type": "roundrobin",
"scheme": "https",
"pass_host": "node",
"keepalive_pool": {
"idle_timeout": 60,
"requests": 1000,
"size": 320
}
},
"status": 1
}有人能给我提供一个实际的工作例子或者指出我错过了什么吗?欢迎任何建议。
编辑:
查看apache/ at 6:2.15.0-高寒的日志,它看起来就像禁用了这个模拟插件。从文档的角度来看,模拟插件用于模拟API。执行时,它以指定的格式返回随机模拟数据,并且请求不会转发到上游。更改域和IP地址的错误日志。建议将流量重定向到上游:
10.10.10.24 - - [23/Sep/2022:11:33:16 +0000] my.domain.com "GET /mock-test.html HTTP/1.1" 502 154 0.001 "-" "PostmanRuntime/7.29.2" 127.0.0.1:1980 502 0.001 "http://my.domain.com"全局插件都启用了,我已经使用Keycloak插件进行了测试。
编辑2:这会不会是apisix版本2.15中的一个bug呢?目前github回购上没有悬而未决的问题。
发布于 2022-10-10 09:40:54
是的,mocking插件没有启用。
您也可以直接提交一个PR来修复它。
https://stackoverflow.com/questions/73826922
复制相似问题