Issue with `kubectl build` on Amazon EKS: FailedMount for Docker Socket in Pod

Hello Kubernetes community,

I am encountering a problem when using kubectl build along with Tilt on my Amazon EKS cluster. The build process works well in my local environment, but when transitioning to EKS, I’m facing issues with mounting the Docker socket in the pod. The error suggests a “FailedMount” for the Docker socket volume, and I suspect it’s related to the underlying container runtime (containerd on EKS).

Code and Error:

I am using Tilt for local development, and I have installed the Kubernetes CLI and kubectl_build following the Tilt documentation. My Tiltfile configurations are as follows:

# Tiltfile

load('ext://kubectl_build', 'kubectl_build');

allow_k8s_contexts("arn:aws:eks:eu-west-2:473106654049:cluster/trial");

k8s_yaml(["infra/k8s/client-depl.yaml"]);

k8s_resource('client-depl', port_forwards=8000);

kubectl_build("shubhamjr/client", "client", dockerfile = "client/Dockerfile",live_update=[
	sync('./client', '/app')
]);

Any insights, suggestions, or guidance on how to resolve this issue in the context of EKS, especially when using Tilt, would be greatly appreciated.

Thank you!

EKS does not support docker; they use containerd as their runtime. Most clouds dropped direct docker support with Kubernetes 1.24 when dockershim was removed.

Thankyou very much for your response.
So, what is the solution? What should I do?
Should I mount the docker socket file??
Here is my client-yaml.depl file

apiVersion: apps/v1
kind: Deployment
metadata:
  name: client-depl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: client
  template:
    metadata:
      labels:
        app: client
    spec:
      containers:
        - name: client
          image: shubhamjr/client
          # imagePullPolicy: Never
---
apiVersion: v1
kind: Service
metadata:
  name: client-srv
spec:
  type: ClusterIP
  selector:
    app: client
  ports:
    - name: client
      protocol: TCP
      port: 3000
      targetPort: 3000

There is no docker socket to mount, docker isn’t installed on the hosts.

the kubectl build plugin hasn’t been updated in several years and is no longer compatible with current k8s. I don’t know tilt well enough to offer an alternative. =/

1 Like

Hi,
Are you trying to run tilt on a k8s worker node? Why would not you run it locally having docker installed?

1 Like

I have a large microservices application, and I want to set up my development environment. While building images, my system lags. I am looking for two solutions:

  1. Hot Reloading: I am using Tilt for this aspect.
  2. Avoid Building Images on My Local Machine: Initially, I considered using kubernetes_build so that when I change the context from local Docker to AWS EKS, the building happens on EKS, not on my local machine. However, this approach doesn’t seem to be working.

If you have any solutions, please share.