Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bind mount failed #91

Open
rothgar opened this issue Oct 16, 2024 · 3 comments
Open

Bind mount failed #91

rothgar opened this issue Oct 16, 2024 · 3 comments

Comments

@rothgar
Copy link

rothgar commented Oct 16, 2024

I'm trying to create a pod via kubectl with this spec

apiVersion: v1
kind: Pod
metadata:
  name: nginx-pod
  labels:
    app: nginx
spec:
  containers:
  - name: nginx
    image: nginx:latest
    ports:
    - containerPort: 80
  automountServiceAccountToken: false

but when I apply it the docker container gets created but isn't running. I see this error in the k2d logs

ERROR   controller/controller.go:174    unable to create pod   {"error": "Error response from daemon: Bind mount failed: '/var/lib/k2d/secrets/k2d-k2d-serviceaccount-k2dsec-token' does not exists", "request_id": "5af66fd9-7991-4ee6-92c8-5961713f962b"}

The pod stays in an Unknown state

k get pods
NAME            READY   STATUS    RESTARTS   AGE
nginx           0/1     Unknown   0          3m13s

If I manually create an empty file in that location it continues but errors on k2d-k2d-serviceaccount-k2dsec-ca.crt not existing. I can manually create an empty file for that too but it won't continue past that error.

2024-10-16T17:49:18.840Z        ERROR   controller/controller.go:174    unable to create pod   {"error": "Error response from daemon: Bind mount failed: '/var/lib/k2d/secrets/k2d-k2d-serviceaccount-k2dsec-ca.crt' does not exists", "request_id": "737ca7ef-6aba-45fa-9e81-f9e1fc571960"}
github.com/portainer/k2d/internal/controller.(*OperationController).processOperation
        /root/workspace/k2d/internal/controller/controller.go:174 github.com/portainer/k2d/internal/controller.(*OperationController).processPriorityOper
ations
        /root/workspace/k2d/internal/controller/controller.go:165 github.com/portainer/k2d/internal/controller.(*OperationController).processOperationQueue
@rothgar
Copy link
Author

rothgar commented Oct 16, 2024

Here's my docker info

Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 8
  Running: 7
  Paused: 0
  Stopped: 1
 Images: 77
 Server Version: 20.10.3
 Storage Driver: btrfs
  Build Version: Btrfs v4.0
  Library Version: 101
 Logging Driver: db
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs db fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 3fa00912415f3e9c6f82dd72119179d599efd13b
 runc version: 31cc25f16f5eba4d0f53e35374532873744f4b31
 init version: ed96d00 (expected: de40ad0)
 Security Options:
  apparmor
 Kernel Version: 4.4.180+
 Operating System: Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.619GiB
 Name: d
 ID: LRNO:2ZLN:3LHJ:U3UI:75LT:3LOS:U3H3:Z77V:ZE6W:B3QA:SRJM:BGAP
 Docker Root Dir: /volume1/@docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No kernel memory TCP limit support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
WARNING: No blkio weight support
WARNING: No blkio weight_device support
WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

@deviantony
Copy link
Member

Hey @rothgar, how did you start k2d? Anything in the startup logs of k2d? This should not happen unless you altered the /var/lib/k2d folder or data path after starting k2d.

k2d will take care of provisioning these system resources upon startup so it should not be missing at runtime unless you removed it after deployment.

@rothgar
Copy link
Author

rothgar commented Nov 11, 2024

I'm trying to run this on a synology NAS which has a different storage folder for docker. Here's how I ran it

IP=$(ip -4 addr show scope global \
    | grep inet | awk '{print $2}' \
    | cut -d/ -f1 | head -n 1)

docker run -d \
  --name k2d \
  --network host \
  --restart always \
  --env K2D_ADVERTISE_ADDR=${IP} \
  --env K2D_SECRET=YOUR_SECRET \
  --label resource.k2d.io/namespace-name=k2d \
  --label workload.k2d.io/name=k2d \
  --volume /var/run/docker.sock:/var/run/docker.sock \
  --volume /volume1/@docker:/var/lib/k2d \
  portainer/k2d:1.0.0

There's no errors in container startup. I can try deleting the folder contents and starting it fresh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants