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

Add support for minikube+containerd #5143

Closed
ErmakovDmitriy opened this issue Dec 12, 2020 · 5 comments
Closed

Add support for minikube+containerd #5143

ErmakovDmitriy opened this issue Dec 12, 2020 · 5 comments
Assignees
Labels
area/build kind/bug Something isn't working platform/minikube priority/p2 May take a couple of releases
Milestone

Comments

@ErmakovDmitriy
Copy link
Contributor

I tried to build my project using minikube, skaffold and kaniko.
Kaniko is used because I tried to use minikube with containerd (not Docker). The main reason is that the Kubernetes team has plans to deprecate Dockershim.

Expected behavior

Correct build and dev deploy.

Actual behavior

Error:

Listing files to watch...
 - skaffold-example
watching files for artifact "skaffold-example": listing files: parsing ONBUILD instructions: retrieving image "golang:1.12.9-alpine3.10": getting docker client: getting minikube env: running [/usr/local/bin/minikube docker-env --shell none -p minikube]
 - stdout: "\n\n"
 - stderr: "X Exiting due to MK_USAGE: The docker-env command is only compatible with the \"docker\" runtime, but this cluster was configured to use the \"containerd\" runtime.\n"
 - cause: exit status 14

Information

I thought that there is some error in my skaffold.yaml so I tried to build examples/kaniko. The same error.

  • Skaffold version: v1.17.2
  • Operating system: minikube on KVM2, minikube version: v1.15.1, commit: 23f40a012abb52eff365ff99a709501a61ac5876.
  • Contents of skaffold.yaml:
apiVersion: skaffold/v2beta10
kind: Config
build:
  artifacts:
    - image: skaffold-example
      kaniko:
        cache: {}
  cluster:
    pullSecretName: e2esecret-with-path
    pullSecretPath:     kaniko-secret.json
    namespace: default
deploy:
  kubectl:
    manifests:
      - k8s-*

Steps to reproduce the behavior

  1. clone https://github.com/GoogleContainerTools/skaffold
  2. cd examples/kaniko
  3. skaffold dev
  4. Get the error

I personally think that Minikube detect at: skaffold/cluster/minikube.go in method newAPIClient call to cluster.GetClient().IsMinikube(kubeContext) returns true because the Kubernetes context name is "minikube" (I checked in debugger).

// newAPIClient guesses the docker client to use based on current Kubernetes context.
func newAPIClient(kubeContext string, minikubeProfile string) ([]string, client.CommonAPIClient, error) {
	if minikubeProfile != "" { // skip validation if explicitly specifying minikubeProfile.
		return newMinikubeAPIClient(minikubeProfile)
	}
	if cluster.GetClient().IsMinikube(kubeContext) {
		return newMinikubeAPIClient(kubeContext)
	}
	return newEnvAPIClient()
}

and in newMinikubeAPIClient there is a call env, err := getMinikubeDockerEnv(minikubeProfile).
In getMinikubeDockerEnv we have:

cmd, err := cluster.GetClient().MinikubeExec("docker-env", "--shell", "none", "-p", minikubeProfile)

which in case of minikube with containerd returns error:

$ minikube docker-env

❌  Exiting due to MK_USAGE: The docker-env command is only compatible with the "docker" runtime, but this cluster was configured to use the "containerd" runtime.

@tstromberg
Copy link
Contributor

tstromberg commented Dec 14, 2020

FWIW, this should be a relatively high priority, as minikube is expected to switch the default runtime in Q1.

For non-Docker runtimes, I recommend using the minikube cache add command, at least until a faster mechanism can be designed & supported.

@tejal29
Copy link
Member

tejal29 commented Dec 14, 2020

@ErmakovDmitriy We don't support running minikube with containerd yet. However, that said, there is a skaffold bug here. For kaniko builder, skaffold should not shell minikube docker-env command.

@tejal29 tejal29 added priority/p2 May take a couple of releases kind/bug Something isn't working labels Dec 14, 2020
@tstromberg tstromberg added priority/p1 High impact feature/bug. and removed priority/p2 May take a couple of releases labels Feb 25, 2021
@tstromberg tstromberg changed the title Build fail: minikube containerd - docker-env error Add support for minikube+containerd Feb 25, 2021
@tstromberg
Copy link
Contributor

It's worth noting that since this issue was originally opened, minikube added a minikube image load command that may be more efficient than the older cache implementation: https://minikube.sigs.k8s.io/docs/commands/image/

@briandealwis briandealwis self-assigned this Mar 17, 2021
@briandealwis briandealwis added this to the v1.22.0 milestone Mar 22, 2021
@gsquared94 gsquared94 added priority/p2 May take a couple of releases and removed priority/p1 High impact feature/bug. labels Apr 13, 2021
@sammym1982
Copy link

We are hit by this issue when we tried moving our dev tooling to target containerd with minikube. AKS now defaults to containerd runtime post 1.19 k8s version and we want to align our tooling to target same.

I see multiple issues around same. Is fair to say that #5739 will resolve this issue and correct to track.

@tstromberg

@nkubala
Copy link
Contributor

nkubala commented May 11, 2021

@sammym1982 yes #5739 will address this issue, and is currently on the team's radar. since that issue has become active, I'll go ahead and close this one as the dupe and we can track over there.

@nkubala nkubala closed this as completed May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build kind/bug Something isn't working platform/minikube priority/p2 May take a couple of releases
Projects
None yet
Development

No branches or pull requests

7 participants