Skip to content

Cannoot access services via NodePort on MacOS with Docker driver #11193

Closed
@marlon-sousa

Description

@marlon-sousa

Hello,

I am facing issues accessing services via node port on Mac OS.

System information:

ProductName:    macOS
ProductVersion: 11.1
BuildVersion:   20C69

Ninikube version:

minikube version: v1.19.0
commit: 15cede53bdc5fe242228853e737333b09d4336b5

kubectl version:

Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.7", GitCommit:"1dd5338295409edcfff11505e7bb246f0d3
25d15", GitTreeState:"clean", BuildDate:"2021-01-13T13:23:52Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.2", GitCommit:"faecb196815e248d3ecfb03c680a4507229c2a56", GitTreeState:"clean", BuildDate:"2021-01-13T13:20:00Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}

docker version:

Client: Docker Engine - Community
 Cloud integration: 1.0.12
 Version:           20.10.5
 API version:       1.41
 Go version:        go1.13.15
 Git commit:        55c4c88
 Built:             Tue Mar  2 20:13:00 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.5
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       363e9a8
  Built:            Tue Mar  2 20:15:47 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Minikube installed with homebrew version:

Homebrew 3.1.3
Homebrew/homebrew-core (git revision 9bc3198bef; last commit 2021-04-25)

minikub init command

minikube start --driver=docker --mount --mount-string $(PWD)/dev/volumes:/volumes

Steps to reproduce the issue:

  1. On Mac OS, start minikube as above.
  2. Make a simple deployment / service using mode port. Below I will post a yaml but this has also veen berified with other services I tried.
apiVersion: v1
kind: PersistentVolume
metadata:
  name: wiremock-pv-volume
  namespace: queen
  labels:
    type: local
    app: wiremock
spec:
  storageClassName: manual
  capacity:
    storage: 100Mi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: "/volumes/wiremock"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: wiremock-pv-claim
  labels:
    app: wiremock
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 100Mi

-------
apiVersion: v1
kind: Service
metadata:
  name: wiremock
  labels:
    app: wiremock
spec:
  type: NodePort
  ports:
    - port: 8080
      nodePort: 30080
  selector:
    app: wiremock

-------
apiVersion: apps/v1
kind: Deployment
metadata:
  name: wiremock
spec:
  replicas: 1
  selector:
    matchLabels:
      app: wiremock
  template:
    metadata:
      labels:
        app: wiremock
    spec:
      containers:
        - name: wiremock
          image: rodolpheche/wiremock
          imagePullPolicy: "IfNotPresent"
          ports:
            - containerPort: 8080
          volumeMounts:
            - mountPath: /home/wiremock
              name: wiremock-vol
      volumes:
        - name: wiremock-vol
          persistentVolumeClaim:
            claimName: wiremock-pv-claim

  1. Up until here we are pretty good. The volume has been created, shared, everything working. kubectl get svc shows the following:
NAME       TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
wiremock   NodePort   10.102.252.201   <none>        8080:30080/TCP   18h

issue

But I cannot access this service using port 30080, and here comes the issue:
If I try

minikube ip

I get 192.168.49.2 as response. This is what happens also on Linux. However, this ip is kind of "useless", in the sense that I can not ping it from terminal nor can I telnet or CURL it at port 30080 (or at any other port I have tried).
This is different from Linux, where I can either ping or telnet / CURL / PSQL / whatever I need at the appropriate ports and services work. on Mac OS, every telnet / CURL / psql I try on this IP hangs indefinitely.

I suppose this has to do somehow with the docker driver, but I couldn't find documentation on that nor could I find anything useful in logs.
Strangely, minikube ssh works flowlessly, as also works minikube service wiremock. More strange is that minikube tunnel also hangs indefinitely.

I cannot use minikube service tunelling for several reazons, and I am thinking what can be done to fix that. NodePort is an important feature of Minikube, so if the docker driver doesn't support that I would like to know.

As I have no errors outputs, I will post no logs here now, but I am whiling to do everything I can to help to track this, so feel free to ask me for extra logs.

Full output of failed command:

There is not failure of output commands, at least that I have seen.

Full output of minikube start command used, if not already included:

* minikube v1.19.0 on Darwin 11.1
* Using the docker driver based on existing profile
* Starting control plane node minikube in cluster minikube
* Updating the running docker "minikube" container ...
* Preparing Kubernetes v1.20.2 on Docker 20.10.5 ...
* Verifying Kubernetes components...
  - Using image kubernetesui/dashboard:v2.1.0
  - Using image kubernetesui/metrics-scraper:v1.0.4
  - Using image gcr.io/k8s-minikube/storage-provisioner:v5
* Enabled addons: default-storageclass, storage-provisioner, dashboard
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
* ```

Metadata

Metadata

Assignees

No one assigned

    Labels

    co/docker-driverIssues related to kubernetes in containerkind/supportCategorizes issue or PR as a support question.os/macos

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions