flannel-io / flannel

flannel is a network fabric for containers, designed for Kubernetes
Apache License 2.0
8.81k stars 2.87k forks source link

exec: "cp": executable file not found in $PATH: unknown #1761

Closed bobo708 closed 1 year ago

bobo708 commented 1 year ago

k8s:1.27.1 dpcker:23.0.3

Name: kube-flannel-ds-tlsm4 Namespace: kube-flannel Priority: 2000001000 Priority Class Name: system-node-critical Service Account: flannel Node: vm1/10.0.2.15 Start Time: Wed, 19 Apr 2023 00:32:17 +0000 Labels: app=flannel controller-revision-hash=9cbc79f48 k8s-app=flannel pod-template-generation=1 tier=node Annotations: Status: Pending IP: 10.0.2.15 IPs: IP: 10.0.2.15 Controlled By: DaemonSet/kube-flannel-ds Init Containers: install-cni-plugin: Container ID: docker://3c971207530e775c58814cc0abce5537efaa3de37bba3d14f622e7df50672813 Image: docker.io/flannel/flannel-cni-plugin:v1.1.2 Image ID: docker://sha256:261867462f672014d32aa77b0a49c7458fb48739416cdad01101f40f2c204752 Port: Host Port: Command: cp Args: -f /flannel /opt/cni/bin/flannel State: Waiting Reason: CrashLoopBackOff Last State: Terminated Reason: ContainerCannotRun Message: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "cp": executable file not found in $PATH: unknown Exit Code: 127 Started: Wed, 19 Apr 2023 00:58:43 +0000 Finished: Wed, 19 Apr 2023 00:58:43 +0000 Ready: False Restart Count: 10 Environment: Mounts: /opt/cni/bin from cni-plugin (rw) /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-4x6bg (ro) install-cni: Container ID: Image: docker.io/flannel/flannel:v0.21.4 Image ID: Port: Host Port: Command: cp Args: -f /etc/kube-flannel/cni-conf.json /etc/cni/net.d/10-flannel.conflist State: Waiting Reason: PodInitializing Ready: False Restart Count: 0 Environment: Mounts: /etc/cni/net.d from cni (rw) /etc/kube-flannel/ from flannel-cfg (rw) /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-4x6bg (ro) Containers: kube-flannel: Container ID: Image: docker.io/flannel/flannel:v0.21.4 Image ID: Port: Host Port: Command: /opt/bin/flanneld Args: --ip-masq --kube-subnet-mgr State: Waiting Reason: PodInitializing Ready: False Restart Count: 0 Requests: cpu: 100m memory: 50Mi Environment: POD_NAME: kube-flannel-ds-tlsm4 (v1:metadata.name) POD_NAMESPACE: kube-flannel (v1:metadata.namespace) EVENT_QUEUE_DEPTH: 5000 Mounts: /etc/kube-flannel/ from flannel-cfg (rw) /run/flannel from run (rw) /run/xtables.lock from xtables-lock (rw) /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-4x6bg (ro) Conditions: Type Status Initialized False Ready False ContainersReady False PodScheduled True Volumes: run: Type: HostPath (bare host directory volume) Path: /run/flannel HostPathType: cni-plugin: Type: HostPath (bare host directory volume) Path: /opt/cni/bin HostPathType: cni: Type: HostPath (bare host directory volume) Path: /etc/cni/net.d HostPathType: flannel-cfg: Type: ConfigMap (a volume populated by a ConfigMap) Name: kube-flannel-cfg Optional: false xtables-lock: Type: HostPath (bare host directory volume) Path: /run/xtables.lock HostPathType: FileOrCreate kube-api-access-4x6bg: Type: Projected (a volume that contains injected data from multiple sources) TokenExpirationSeconds: 3607 ConfigMapName: kube-root-ca.crt ConfigMapOptional: DownwardAPI: true QoS Class: Burstable Node-Selectors: Tolerations: :NoSchedule op=Exists node.kubernetes.io/disk-pressure:NoSchedule op=Exists node.kubernetes.io/memory-pressure:NoSchedule op=Exists node.kubernetes.io/network-unavailable:NoSchedule op=Exists node.kubernetes.io/not-ready:NoExecute op=Exists node.kubernetes.io/pid-pressure:NoSchedule op=Exists node.kubernetes.io/unreachable:NoExecute op=Exists node.kubernetes.io/unschedulable:NoSchedule op=Exists Events: Type Reason Age From Message


Normal Scheduled 27m default-scheduler Successfully assigned kube-flannel/kube-flannel-ds-tlsm4 to vm1 Normal Pulled 27m (x4 over 27m) kubelet Container image "docker.io/flannel/flannel-cni-plugin:v1.1.2" already present on machine Normal Created 27m (x4 over 27m) kubelet Created container install-cni-plugin Warning Failed 26m (x4 over 27m) kubelet Error: failed to start container "install-cni-plugin": Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "cp": executable file not found in $PATH: unknown Warning BackOff 26m (x4 over 27m) kubelet Back-off restarting failed container install-cni-plugin in pod kube-flannel-ds-tlsm4_kube-flannel(9edb87a8-0f2e-4025-862c-df011c2d1132) Warning DNSConfigForming 2m45s (x126 over 27m) kubelet Nameserver limits were exceeded, some nameservers have been omitted, the applied nameserver line is: 8.8.8.8 8.8.4.4 192.168.56.1

rbrtbnfgl commented 1 year ago

How do you run flannel? Which OS are you using? Could you quote the logs on a block to make your issue more readable?

bobo708 commented 1 year ago

I user kubeadmin to install k8s clusters on Ubuntu:22.04 operatesystem. I run the command "sudo kubectl apply -f kube-flannel.yaml",but flannel pod not runing.

How do you run flannel? Which OS are you using? Could you quote the logs on a block to make your issue more readable?

rbrtbnfgl commented 1 year ago

you don't need to run kubectl as root is enough to configure the right kubeconfig path for the user. where do you get kube-flannel.yaml?

bobo708 commented 1 year ago

I download from "https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml"

rbrtbnfgl commented 1 year ago

And I think your machine has cp bin. Only flannel has the issue or other pods have similar issues?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Y-puyu commented 3 months ago

I have also encountered this issue, and I have resolved it. Env:

In my case: I want the image to be pulled directly from the local source.

I met your problem, exactly the same. I also saw this issue, but found that there was no solution, so I researched it myself

last: In my wmware, i input docker run -itd flannel/flannel-cni-plugin:v1.5.1-flannel1 sh, the same error occurred. But in my previous position, it was working normally again.

So, it's a problem with my vmware image.

docker import is the key. If docker loaddocker tag is used, there will be no problem.

I spent a day on this and hope it can help you...