kubectl fails with "Unable to connect to the server: EOF" in docker container on mac but not on linux

Viewed 1094

Since a while back we have been using a docker container to do deployments to a GKE cluster. The container is based on one of googles cloud SDK images. The docker file looks something like:

FROM gcr.io/google.com/cloudsdktool/cloud-sdk:322.0.0-alpine
RUN gcloud components install kubectl
...
# The docker image will also include any manifests etc. that is supposed to be deployed...

This image is then built and launched using docker exec running any number of kubectlt commands against the cluster configured.

The same approach is used in a VS Code development container using the same Google Cloud SDK image as base image.

This has been working quite well and the method has been used as part of a deployment workflow in Jenkins as well as locally on a Mac workstation.

For a couple of weeks now - it does not work locally on the Mac anymore.

So:

  • Building and running the image on a AWS (Ubuntu) instance and deploying to GKE works.
  • Building and running the the image on a Multipass (Ubuntu) instance on the Intel Mac works.
  • Building and running the image on Docker Desktop for Mac (3.3.1) on the same Mac does NOT work. kubectl fails with a Unable to connect to the server: EOF message

(Running kubectl natively on the same Mac works though!)

It seems the underlying curl request sent by kubeclt is denied during the initial SSL handshake but this might not bre related.

Any thoughts?

1 Answers

I was having the exact same issue connecting to GKE clusters from inside a Docker container for several months. After digging into it, all of my curl requests to the GKE cluster endpoints were throwing OpenSSL SSL_connect: SSL_ERROR_SYSCALL, which led me to this issue: https://github.com/docker/for-mac/issues/5524.

Downloading the latest Docker Desktop for Mac update fixed it for me.

Related