You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

OKE环境下API服务无法正常连接内部ClusterIP类型RASA服务

问题分析与解决方案

问题现象

在OKE集群中,API-server(ally-backend)调用RASA的ClusterIP服务时生成了错误的请求URL:http://rasa:tcp://10.96.112.209:5005/model/parse,但在API-server的Pod内通过curl rasa:5005/model/parse能正常获取200响应,说明服务本身正常,问题出在API-server的请求地址构建逻辑上。

相关环境信息

Deployment状态

NAME           READY   UP-TO-DATE   AVAILABLE   AGE
ally-backend   2/2     2            2           27h
pgvector       2/2     2            2           26h
rasa           1/1     1            1           46h

RASA Service详情

[opc@bastiao-oke ~]$ k describe svc rasa
Name:              rasa
Namespace:         hml
Labels:            app=rasa
Annotations:       <none>
Selector:          app=rasa
Type:              ClusterIP
IP Family Policy:  SingleStack
IP Families:       IPv4
IP:                10.96.197.243
IPs:               10.96.197.243
Port:              <unset>  5005/TCP
TargetPort:        5005/TCP
Endpoints:         10.244.0.176:5005
Session Affinity:  None
Events:            <none>

API-server错误日志

INFO:root:Verificando 'Intents' no RASA-NLU
INFO:root:Identificado algum problema no acesso ao servidor  RASA  - Failed to parse: 
http://rasa:tcp://10.96.112.209:5005/model/parse
INFO:openai:message='OpenAI API response' 
path=https://api.openai.com/v1/chat/completions 
processing_ms=549 request_id=4216ee870acf941306cbfb78874f4803 
response_code=200
Error submitting packet: [Errno 111] Connection refused, 
dropping the packet and closing the socket, 3 additional 
messages skipped
WARNING:ddtrace.vendor.dogstatsd:Error submitting packet: 
[Errno 111] Connection refused, dropping the packet and closing 
the socket, 3 additional messages skipped
INFO:root:Sentimento identificado na query: 'Neutro ou 
Positivo'
INFO:root:Verificando 'Intents' no RASA-NLU
INFO:root:Identificado algum problema no acesso ao servidor  
RASA  - Failed to parse: 
http://rasa:tcp://10.96.112.209:5005/model/parse

Pod内curl测试结果

root@ally-backend-65bf557648-tqmw2:/core# curl --request POST rasa:5005/model/parse -H 'Content-Type: application/json' -d '{"text": "Boa noite"}' -v
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 10.96.197.243:5005...
* Connected to rasa (10.96.197.243) port 5005 (#0)
> POST /model/parse HTTP/1.1
> Host: rasa:5005
> User-Agent: curl/7.88.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 21
> 
< HTTP/1.1 200 OK
< Access-Control-Expose-Headers: filename
< Access-Control-Allow-Credentials: true
< content-length: 544
< connection: keep-alive
< content-type: application/json
< 
* Connection #0 to host rasa left intact
{"text":"Boa noite","intent":{"name":"saudacao","confidence":0.9999688863754272},"entities":[],"text_tokens":[[0,3],[4,9]],"intent_ranking":[{"name":"saudacao","confidence":0.9999688863754272},{"name":"finalizar","confidence":2.5454630304011516e-5},{"name":"agradecimento","confidence":2.8781237233488355e-6},{"name":"out_of_scope","confidence":2.794123474814114e-6}],"response_selector":{"all_retrieval_intents":[],"default":{"response":{"responses":null,"confidence":0.0,"intent_response_key":null,"utter_action":...}}}

解决方案

  1. 修正API-server的地址配置

    • 检查代码中构建RASA请求URL的逻辑,确保直接使用http://rasa:5005/model/parse,或者拆分为主机名和端口分别配置后拼接,避免将带协议的地址错误作为端口部分。
    • 例如,若使用环境变量,应定义RASA_HOST=rasa和RASA_PORT=5005,代码中拼接为f"http://{RASA_HOST}:{RASA_PORT}/model/parse"。
  2. 排查环境变量注入问题

    • 进入API-server的Pod,执行printenv | grep RASA查看相关环境变量,确认是否存在格式异常的变量(如包含tcp://前缀的端口变量),若有则修正代码中的变量引用。
  3. 检查HTTP客户端配置

    • 确认API-server使用的HTTP客户端没有自动添加协议前缀到端口部分的逻辑,确保客户端仅使用主机名和端口构建请求URL。

内容的提问来源于stack exchange,提问作者Josemar Tadeu Migowski

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 01:52:05