日常问题总结

1、调用接口终端拿不到返回码,但是服务端正常运行

报错如下:
python:

requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",

curl

curl: (52) Empty reply from server

问题分析:
服务端正常运行,接口中断;并不是每次都中断拿不到返回码,可能存在接口拿返回码超时问题。
解决办法:
本服务使用uwsgi,修改配置文件uwsgi.ini,增加:

http-connect-timeout = 7200
http-timeout = 7200

其他类似参考:
https://blog.csdn.net/nijiangye/article/details/107494928
https://cloud.tencent.com/developer/ask/sof/1105566
https://www.cnblogs.com/stssts/p/10097500.html

2、docker run 时报错 input device is not a TTY

报错如下:

docker exec -it 24d549092b82ac10bc95fd5eb61193850ce2272bf9a41eaf04cccc7c203cee8b rpm -qa|grep MySQL-python
the input device is not a TTY

修复办法:

  • 使用“-t”选项:当您使用“docker run”命令时,添加“-t”选项可以将终端设为TTY模式,例如:
    docker run -t IMAGE_NAME COMMAND
  • 使用“–tty”选项:与“-t”选项相同,您也可以使用“–tty”选项来将终端设为TTY模式,例如:
    docker run --tty IMAGE_NAME COMMAND
  • 使用“docker exec”命令:如果您已经在Docker容器中,并且需要在容器内执行命令,可以使用“docker exec”命令来执行命令并将终端设为TTY模式,例如:
    docker exec -t CONTAINER_NAME COMMAND
  • 更改Dockerfile:如果您正在构建自己的Docker镜像,并且需要在其中使用TTY模式,请将以下命令添加到您的Dockerfile中:
    RUN sed -i 's/^# (.*force_color_prompt=yes)/

3、no matching manifest for linux/amd64 in the manifest list entries

出现场景,拉取多架构镜像到本地:

docker pull java-union:1.3
1.3: Pulling from java-union
no matching manifest for linux/amd64 in the manifest list entries

问题分析:
报错显示是x86机器,docker pull manifest 不匹配,验证:

uname -p
x86_64

查看镜像manifest信息:

docker manifest inspect java-union:1.3
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
   "manifests": [
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 3064,
         "digest": "sha256:15876e935f7195d859ceef72148a827bc778e5720b1d76c7b5aa213dab668322",
         "platform": {
            "architecture": "sw64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 3487,
         "digest": "sha256:e9fe57fe7498eb746028d805320e3c9222caa613502a3ee049c3b6443c27d95b",
         "platform": {
            "architecture": "arm64",
            "os": "linux"
         }
      }
   ]
}

无x86 子架构镜像,本镜像在本机无法使用

4、Error starting daemon: error while opening volume store metadata database: timeout

问题场景:
重启docker 时,或者执行dockerd 时失败,如下:

dockerd
INFO[2023-04-12T16:22:31.796587262+08:00] parsed scheme: "unix"                         module=grpc
INFO[2023-04-12T16:22:31.796623612+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2023-04-12T16:22:31.796662147+08:00] parsed scheme: "unix"                         module=grpc
INFO[2023-04-12T16:22:31.796669912+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2023-04-12T16:22:31.796769557+08:00] ccResolverWrapper: sending new addresses to cc: [{unix:///run/containerd/containerd.sock 0  <nil>}]  module=grpc
INFO[2023-04-12T16:22:31.796794202+08:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2023-04-12T16:22:31.796780663+08:00] ccResolverWrapper: sending new addresses to cc: [{unix:///run/containerd/containerd.sock 0  <nil>}]  module=grpc
INFO[2023-04-12T16:22:31.796822057+08:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2023-04-12T16:22:31.796865236+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc000751840, CONNECTING  module=grpc
INFO[2023-04-12T16:22:31.796880864+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc0007da860, CONNECTING  module=grpc
INFO[2023-04-12T16:22:31.796898288+08:00] blockingPicker: the picked transport is not ready, loop back to repick  module=grpc
INFO[2023-04-12T16:22:31.797000366+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc0007da860, READY  module=grpc
INFO[2023-04-12T16:22:31.797003031+08:00] pickfirstBalancer: HandleSubConnStateChange: 0xc000751840, READY  module=grpc
INFO[2023-04-12T16:22:31.798566294+08:00] [graphdriver] using prior storage driver: overlay2 
WARN[2023-04-12T16:22:31.825070829+08:00] cmd: [mount -o remount,prjquota /], output: mount: / not mounted or bad option

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
 err: exit status 32 
INFO[2023-04-12T16:22:31.826342117+08:00] cmd: [quotaon -P /]                          
Error starting daemon: error while opening volume store metadata database: timeout

解决办法:

ps axf | grep docker | grep -v grep | awk '{print "kill -9 " $1}' | sudo sh

# 重启docker
systemctl restart docker.service

参考文档:
http://www.voycn.com/article/docker-daemon-failedbingqiezhongqishibai

5、networkPlugin cni failed to set up pod “iperf-test_default” network: loadFlannelSubnetEnv failed: open /run/flannel/subnet.env: no such file or directory

kubenetes 创建pod时,describe 查看报错如下:

#kubectl describe pod iperf-test
...
Events:
  Type     Reason                  Age                     From               Message
  ----     ------                  ----                    ----               -------
  Normal   Scheduled               5m39s                   default-scheduler  Successfully assigned default/iperf-test to docker-ce011166091186.na131
  Warning  FailedCreatePodSandBox  5m30s                   kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "0f7bfa318460a5f0fe688111386f59869004f7c19594462df6a3564fd45dad61" network for pod "iperf-test": networkPlugin cni failed to set up pod "iperf-test_default" network: loadFlannelSubnetEnv failed: open /run/flannel/subnet.env: no such file or directory
  Normal   SandboxChanged          5m27s (x12 over 5m38s)  kubelet            Pod sandbox changed, it will be killed and re-created.
  Warning  FailedCreatePodSandBox  5m26s (x4 over 5m29s)   kubelet            (combined from similar events): Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "6938f72768d7356bde341324846343220d6c8459504950fa7b36c427ee3283d0" network for pod "iperf-test": networkPlugin cni failed to set up pod "iperf-test_default" network: loadFlannelSubnetEnv failed: open /run/flannel/subnet.env: no such file or directory

解决办法:
新建文件:/run/flannel/subnet.env,写入如下内容:

FLANNEL_NETWORK=10.244.0.0/16
FLANNEL_SUBNET=10.244.0.1/24
FLANNEL_MTU=1450
FLANNEL_IPMASQ=true

之后删除报错的pod

kubectl delete pod iperf-test

重新创建,并查看:

kubectl apply -f first_pod.yml 
pod/iperf-test created

kubectl get pod
NAME         READY   STATUS    RESTARTS   AGE
iperf-test   1/1     Running   0          5s

kubectl describe pod iperf-test
...
Events:
  Type    Reason     Age   From               Message
  ----    ------     ----  ----               -------
  Normal  Scheduled  10s   default-scheduler  Successfully assigned default/iperf-test to docker-ce011166091186.na131
  Normal  Pulled     10s   kubelet            Container image "busybox:latest" already present on machine
  Normal  Created    10s   kubelet            Created container iperf
  Normal  Started    10s   kubelet            Started container iperf

参考文档:https://blog.csdn.net/hedao0515/article/details/129045945

你可能感兴趣的:(问题定位,bug,问题定位,问题修复)