服务容器化踩坑

12 篇文章 4 订阅

upstream connect error or disconnect/reset before headers. reset reason: connection failure
通过istio访问容器内服务:
https://test-practice.xiaohoucode.com/api/practice/platform/project/X1
503
upstream connect error or disconnect/reset before headers. reset reason: connection failure
说明:istio中vs对应的虚拟机服务ok,但是容器服务有问题
k8s中的practice对应svc 集群ip是     172.21.1.251,端口80
容器内curl 172.21.1.251:80的时候,也会有上面的提示:upstream connect error or disconnect/reset
原因与解决:
容器内服务实际使用端口和service的target端口不一致,报上面的错误。修改了k8s中service的targetPort和port之后解决该问题

upstream connect error or disconnect/reset before headers. reset reason: local reset
调用channel服务报错:
https://test.xiaohoucode.com/api/practice/platform/exercise/startCppJudge?exerciseId=017a325984d400163e0b68d600a40001
提示 500 error,估计是网络问题

错误内容:upstream connect error or disconnect/reset before headers. reset reason: local reset
解决:启动错误,设置的rpc服务ip错误,修改后解决该问题
http://172.16.1.155:8085/api/editor/judge/process/17aa8eb17f7036bae8af15030006f001?type=0

项目通过nginx直接访问:
404
原因:
https://test.xiaohoucode.com/api/practice/platform/project/getLabelInfo
没有在nginx中修改如下配置:
proxy_set_header Host $http_host; #这个含义是请求的host的多少,反向代理的时候host就是多少,
但是在test-practice.xiaohoucode.com对应的virtualService对应的host是test-practice.xiaohoucode.com,
所以如果继续使用test.xiaohoucode.com去匹配就会匹配不到对应的virtualService,如:

        location /api/practice/platform/ {
            proxy_read_timeout      3600;
            proxy_connect_timeout   300;
            proxy_http_version 1.1;
            #proxy_set_header Host $http_host;
            proxy_set_header Host "test-practice.xiaohoucode.com";
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto http;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            if ($AB_TEST_STARTED = "11") {
                return 307 https://test-practice.xiaohoucode.com$request_uri;
            }
            #proxy_pass http://10.158.224.130:8083/api/practice/platform/;
            proxy_pass https://test-practice.xiaohoucode.com/api/practice/platform/;
        }


nas读取问题
打到容器中的服务报错:
nas代码读取失败,请稍等再试,或联系相关管理员
解决:在details中添加 云存储声明nas即可,完成


judge报错:
judge容器启动需要特权模式(--privileged)。

否则会出现评测出错:

{
    "stdout": "",
    "stderr": "Q2Fubm90IHJ1biBwcm94eSwgY2xvbmUgZmFpbGVkOiBPcGVyYXRpb24gbm90IHBlcm1pdHRlZAo=",
    "compile_output": null,
    "time": null,
    "memory": null,
    "message": "Cannot run proxy, clone failed: Operation not permitted",
    "status": {
        "id": 13,
        "description": "沙箱内部错误"
    },
    "judgeId": "17aa93e62bb036bae8af1503001bf001",
    "checkPointType": 0,
    "stdinPath": "/nas/test/editor/chkpnt/python/cpp2940233206329852823/02.in",
    "expectedOutputPath": "/nas/test/editor/chkpnt/python/cpp2940233206329852823/02.out",
    "isPreJudge": null,
    "index": 3
}
k8s怎么对容器内项目设置特权模式
          securityContext:
            privileged: true
            procMount: Default


redis白名单导致的连接失败
需要把pod的ip范围添加到redis的白名单

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值