kubernetes / minikube

Run Kubernetes locally
https://minikube.sigs.k8s.io/
Apache License 2.0
29.28k stars 4.87k forks source link

cannot expose port 80 and 443 #17313

Closed luatnd closed 3 months ago

luatnd commented 1 year ago

What Happened?

My purpose is map port 80 & 443 from k8s inside minikube to my host machine MacOS.

I follow this tutorial: https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/

As I can see minukube container doesn't mount the port 80 & 443:

image

As a result, I cannot reach the port 80 from my host machine:

telnet "$(minikube ip)" 80
Trying 192.168.49.2...
# hang forever

As investigated some closed issues, I tried this with no luck

minikube start   --ports=443 --ports=80
# Or
minikube start --addons=ingress --ports=80:80,443:443 --driver=docker

Tried with docker run:

docker run --hostname=minikube --env=container=docker --env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --volume=/lib/modules:/lib/modules:ro --volume=minikube:/var --network=minikube --privileged --workdir=/ -p 3222:22 -p 32376:2376 -p 32443 -p 5000 -p 8443 -p 443:443 -p 80:80   --restart=no --label='created_by.minikube.sigs.k8s.io=true' --label='mode.minikube.sigs.k8s.io=minikube' --label='name.minikube.sigs.k8s.io=minikube' --label='role.minikube.sigs.k8s.io=' --runtime=runc --memory="4194304000" -t -d gcr.io/k8s-minikube/kicbase:v0.0.40@sha256:8cadf23777709e43eca447c47a45f5a4635615129267ce025193040ec92a1631

So how can I map port 80 & 443 to host without using reverse proxy?

Attach the log file

$ minikube version
minikube version: v1.31.1
commit: fd3f3801765d093a485d255043149f92ec0a695f

Operating System

macOS (Default)

Driver

Docker

luatnd commented 1 year ago

Ah, sorry, I forgot that I can use minikube tunnel to tunnel Ingress to host port 80 & 443. It's ok by using minikube tunnel for now.

friedrich commented 8 months ago

Try recreating the cluster:

minikube delete
minikube start --addons=ingress --ports=80:80,443:443

According to a comment from the PR:

It's important to note that the --ports option only applies when first creating the minikube docker container. If minikube start --ports=... is called when the minikube container already exists, then the option is ignored.

k8s-triage-robot commented 5 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 4 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot commented 3 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-ci-robot commented 3 months ago

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to [this](https://github.com/kubernetes/minikube/issues/17313#issuecomment-2184070752): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues according to the following rules: >- After 90d of inactivity, `lifecycle/stale` is applied >- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied >- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed > >You can: >- Reopen this issue with `/reopen` >- Mark this issue as fresh with `/remove-lifecycle rotten` >- Offer to help out with [Issue Triage][1] > >Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). > >/close not-planned > >[1]: https://www.kubernetes.dev/docs/guide/issue-triage/ Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.