3

我正在尝试使用OpenFaas 项目和在 2 Raspberry Pi 3B+ 上运行的 kubernetes 集群部署一个功能。不幸的是,应该处理该函数的 pod 将ImageInspectError声明...我尝试直接使用 Docker 运行该函数,该函数包含在 Docker 映像中,并且一切正常。

我在 OpenFaas github 上打开了一个issue,维护者告诉我直接向 Kubernetes 社区询问一些线索。

我的第一个问题是: ImageInspectError 是什么意思,它来自哪里?

这是我拥有的所有信息:

预期行为

Pod 应该运行。

当前行为

NAMESPACE     NAME                                 READY     STATUS              RESTARTS   AGE
kube-system   etcd-masternode                      1/1       Running             1          1d
kube-system   kube-apiserver-masternode            1/1       Running             1          1d
kube-system   kube-controller-manager-masternode   1/1       Running             1          1d
kube-system   kube-dns-7f9b64f644-x42sr            3/3       Running             3          1d
kube-system   kube-proxy-wrp6f                     1/1       Running             1          1d
kube-system   kube-proxy-x6pvq                     1/1       Running             1          1d
kube-system   kube-scheduler-masternode            1/1       Running             1          1d
kube-system   weave-net-4995q                      2/2       Running             3          1d
kube-system   weave-net-5g7pd                      2/2       Running             3          1d
openfaas-fn   figlet-7f556fcd87-wrtf4              1/1       Running             0          4h
openfaas-fn   testfaceraspi-7f6fcb5897-rs4cq       0/1       ImageInspectError   0          2h
openfaas      alertmanager-66b98dd4d4-kcsq4        1/1       Running             1          1d
openfaas      faas-netesd-5b5d6d5648-mqftl         1/1       Running             1          1d
openfaas      gateway-846f8b5686-724q8             1/1       Running             2          1d
openfaas      nats-86955fb749-7vsbm                1/1       Running             1          1d
openfaas      prometheus-6ffc57bb8f-fpk6r          1/1       Running             1          1d
openfaas      queue-worker-567bcf4d47-ngsgv        1/1       Running             2          1d

testfaceraspi不运行。

来自 pod 的日志:

$ kubectl logs testfaceraspi-7f6fcb5897-rs4cq -n openfaas-fn
Error from server (BadRequest): container "testfaceraspi" in pod "testfaceraspi-7f6fcb5897-rs4cq" is waiting to start: ImageInspectError

豆荚描述:

$ kubectl describe pod -n openfaas-fn  testfaceraspi-7f6fcb5897-rs4cq 
Name:           testfaceraspi-7f6fcb5897-rs4cq
Namespace:      openfaas-fn
Node:           workernode/10.192.79.198
Start Time:     Thu, 12 Jul 2018 11:39:05 +0200
Labels:         faas_function=testfaceraspi
                pod-template-hash=3929761453
Annotations:    prometheus.io.scrape=false
Status:         Pending
IP:             10.40.0.16
Controlled By:  ReplicaSet/testfaceraspi-7f6fcb5897
Containers:
  testfaceraspi:
    Container ID:   
    Image:          gallouche/testfaceraspi
    Image ID:       
    Port:           8080/TCP
    Host Port:      0/TCP
    State:          Waiting
      Reason:       ImageInspectError
    Ready:          False
    Restart Count:  0
    Liveness:       exec [cat /tmp/.lock] delay=3s timeout=1s period=10s #success=1 #failure=3
    Readiness:      exec [cat /tmp/.lock] delay=3s timeout=1s period=10s #success=1 #failure=3
    Environment:
      fprocess:  python3 index.py
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-5qhnn (ro)
Conditions:
  Type           Status
  Initialized    True 
  Ready          False 
  PodScheduled   True 
Volumes:
  default-token-5qhnn:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-5qhnn
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason            Age                 From                 Message
  ----     ------            ----                ----                 -------
  Warning  DNSConfigForming  2m (x1019 over 3h)  kubelet, workernode  Search Line limits were exceeded, some search paths have been omitted, the applied search line is: openfaas-fn.svc.cluster.local svc.cluster.local cluster.local heig-vd.ch einet.ad.eivd.ch web.ad.eivd.ch

和事件日志:

$ kubectl get events --sort-by=.metadata.creationTimestamp -n openfaas-fn
LAST SEEN   FIRST SEEN   COUNT     NAME                                              KIND         SUBOBJECT                        TYPE      REASON                  SOURCE                  MESSAGE
14m         1h           347       testfaceraspi-7f6fcb5897-rs4cq.1540db41e89d4c52   Pod                                           Warning   DNSConfigForming        kubelet, workernode     Search Line limits were exceeded, some search paths have been omitted, the applied search line is: openfaas-fn.svc.cluster.local svc.cluster.local cluster.local heig-vd.ch einet.ad.eivd.ch web.ad.eivd.ch
4m          1h           75        figlet-7f556fcd87-wrtf4.1540db421002b49e          Pod                                           Warning   DNSConfigForming        kubelet, workernode     Search Line limits were exceeded, some search paths have been omitted, the applied search line is: openfaas-fn.svc.cluster.local svc.cluster.local cluster.local heig-vd.ch einet.ad.eivd.ch web.ad.eivd.ch
10m         10m          1         testfaceraspi-7f6fcb5897-d6z78.1540df9ed8b91865   Pod                                           Normal    Scheduled               default-scheduler       Successfully assigned testfaceraspi-7f6fcb5897-d6z78 to workernode
10m         10m          1         testfaceraspi-7f6fcb5897.1540df9ed6eee11f         ReplicaSet                                    Normal    SuccessfulCreate        replicaset-controller   Created pod: testfaceraspi-7f6fcb5897-d6z78
10m         10m          1         testfaceraspi-7f6fcb5897-d6z78.1540df9eef3ef504   Pod                                           Normal    SuccessfulMountVolume   kubelet, workernode     MountVolume.SetUp succeeded for volume "default-token-5qhnn" 
4m          10m          27        testfaceraspi-7f6fcb5897-d6z78.1540df9eef5445c0   Pod                                           Warning   DNSConfigForming        kubelet, workernode     Search Line limits were exceeded, some search paths have been omitted, the applied search line is: openfaas-fn.svc.cluster.local svc.cluster.local cluster.local heig-vd.ch einet.ad.eivd.ch web.ad.eivd.ch
8m          9m           8         testfaceraspi-7f6fcb5897-d6z78.1540df9f670d0dad   Pod          spec.containers{testfaceraspi}   Warning   InspectFailed           kubelet, workernode     Failed to inspect image "gallouche/testfaceraspi": rpc error: code = Unknown desc = Error response from daemon: readlink /var/lib/docker/overlay2/l: invalid argument
9m          9m           7         testfaceraspi-7f6fcb5897-d6z78.1540df9f670fcf3e   Pod          spec.containers{testfaceraspi}   Warning   Failed                  kubelet, workernode     Error: ImageInspectError

重现步骤(针对错误)

  1. 在 2 节点 k8s 集群上部署 OpenFaas
  2. 创建函数faas new testfaceraspi --lang python3-armhf
  3. 在 中添加以下代码handler.py

    import json
    def handle(req):
        jsonl = json.loads(req)
    
        return ("Found " + str(jsonl["nbFaces"]) + " faces in OpenFaas Function on raspi !")
    
  4. 更改.yml 提供商中的网关和图像:名称:faas 网关:http: //127.0.0.1 :31112

    functions:
      testfaceraspi:
        lang: python3-armhf
        handler: ./testfaceraspi
        image: gallouche/testfaceraspi
    
  5. faas build -f testfacepi.yml

  6. 登录 DockerHubdocker login
  7. faas push -f testfacepi.yml
  8. faas deploy -f testfacepi.yml

你的环境

  • FaaS-CLI 版本(来自:的完整输出faas-cli version):

    Commit: 3995a8197f1df1ecdf524844477cffa04e4690ea
    Version: 0.6.11
    
  • Docker 版本(来自:的完整输出docker version):

    Client:
     Version:       18.04.0-ce
     API version:   1.37
     Go version:    go1.9.4
     Git commit:    3d479c0
     Built: Tue Apr 10 18:25:24 2018
     OS/Arch:       linux/arm
     Experimental:  false
     Orchestrator:  swarm
    
     Server:
     Engine:
      Version:      18.04.0-ce
      API version:  1.37 (minimum version 1.12)
      Go version:   go1.9.4
      Git commit:   3d479c0
      Built:        Tue Apr 10 18:21:25 2018
      OS/Arch:      linux/arm
      Experimental: false
    
  • 操作系统和版本(例如 Linux、Windows、MacOS):

    Distributor ID: Raspbian
    Description:    Raspbian GNU/Linux 9.4 (stretch)
    Release:        9.4
    Codename:       stretch
    

提前感谢,如果您需要更多信息,请告诉我。

加卢什

4

1 回答 1

1

我看到这个错误是因为 Kubernetes 不支持 docker 版本。从 Kubernetes 版本 1.11 开始,支持的版本为 1.11.2 到 1.13.1 和 17.03.x。

我无法使用 OpenFaaS 测试解决方案。

于 2018-07-13T13:00:02.557 回答