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

LoadBalancer support #384

Closed
waprin opened this issue Jul 21, 2016 · 16 comments
Closed

LoadBalancer support #384

waprin opened this issue Jul 21, 2016 · 16 comments

Comments

@waprin
Copy link
Contributor

waprin commented Jul 21, 2016

Trying to understand where this is on the roadmap. I understand it's currently not supported but is there opposition to adding it?

Currently a lot of Kubernetes examples uses LoadBalancer. Sure, easy to replace with NodePort, but it would be ideal if we could run those with no modifications on minikube.

Since LoadBalancer is already "cloud dependent", Minikube could likewise just make its own decision, which could be something simple (nginx, mapping to nodeport somehow, etc). Of course it will evolve over time, add Ingress support etc but this is the one feature that would enable a lot of the getting started examples to work:

Getting started examples that use LoadBalancer and not much else:

https://github.com/kubernetes/kubernetes/blob/master/examples/guestbook/frontend-service.yaml

https://github.com/GoogleCloudPlatform/getting-started-python/blob/master/optional-container-engine/bookshelf-service.yaml

http://www.thagomizer.com/blog/2015/07/01/kubernetes-and-deploying-to-google-container-engine.html

@jimmidyson
Copy link
Member

LoadBalancer services run fine on minikube, just with no real external load balancer created. LoadBalancer services get a node port assigned too so you can access services via minikube service <name> to open browser or add --url flag to output service URL to terminal.

Would that cover what you need or is there something more that you'd like to see?

@waprin
Copy link
Contributor Author

waprin commented Jul 21, 2016

Ah I didn't know about that feature, cool thanks.

@wclr
Copy link

wclr commented Dec 22, 2016

Why not support that minikube could give some address form internal pool that could be accessible from dev machine?

Just to avoid port mapping, and this could make access to services much easier.

@bryanerayner
Copy link

Could the getting started examples be updated to include @jimmidyson 's comment? It would be tremendously helpful if this information were easier to find.

@r2d4
Copy link
Contributor

r2d4 commented Jan 24, 2017

@bryanerayner PRs are always welcome

@tony-kerz
Copy link

i'm running something like:

apiVersion: v1
kind: Service
metadata:
  name: my-ftp
spec:
  ports:
  - port: 22
  selector:
    app: my-ftp
  type: LoadBalancer

but minikube seems to be having an issue exposing the service:

⋊> kubectl get svc my-ftp                                                      
NAME      CLUSTER-IP   EXTERNAL-IP   PORT(S)        AGE
my-ftp   10.0.0.47    <pending>     22:31253/TCP   5m

i can access the service via the internal port 31253, but not the exposed 22...?
is this just the expected behavior with LoadBalancer...?

i'm running mk v0.18.0/osx/virtualbox

@gkubisa
Copy link

gkubisa commented Oct 27, 2017

@tony-kerz , it looks like the expected behavior to me... Your pods are available on port 22 inside the cluster and are exposed to the host by the load balancer on a random port (31253 in your example). #38 aims to improve this behavior.

b-yng added a commit to b-yng/website that referenced this issue Jan 12, 2018
The `Create an External Load Balancer` readme has a `Finding your IP address` section which describes steps that do not work when running the service in Minikube. @jimmidyson describes how to find your ip address while running in Minikube here: kubernetes/minikube#384 (comment). This change adds this helpful bit to the docs.
@dlorenc
Copy link
Contributor

dlorenc commented Feb 15, 2018

FYI, I finally have a doc on implementing this here: #2413

k8s-ci-robot pushed a commit to kubernetes/website that referenced this issue Feb 19, 2018
* Update Create an External Load Balancer Doc

The `Create an External Load Balancer` readme has a `Finding your IP address` section which describes steps that do not work when running the service in Minikube. @jimmidyson describes how to find your ip address while running in Minikube here: kubernetes/minikube#384 (comment). This change adds this helpful bit to the docs.

* Update create-external-load-balancer.md

* Update create-external-load-balancer.md

Add note callout formatting
bsalamat pushed a commit to bsalamat/kubernetes.github.io that referenced this issue Feb 23, 2018
* Update Create an External Load Balancer Doc

The `Create an External Load Balancer` readme has a `Finding your IP address` section which describes steps that do not work when running the service in Minikube. @jimmidyson describes how to find your ip address while running in Minikube here: kubernetes/minikube#384 (comment). This change adds this helpful bit to the docs.

* Update create-external-load-balancer.md

* Update create-external-load-balancer.md

Add note callout formatting
tehut pushed a commit to tehut/website that referenced this issue Mar 8, 2018
* Update Create an External Load Balancer Doc

The `Create an External Load Balancer` readme has a `Finding your IP address` section which describes steps that do not work when running the service in Minikube. @jimmidyson describes how to find your ip address while running in Minikube here: kubernetes/minikube#384 (comment). This change adds this helpful bit to the docs.

* Update create-external-load-balancer.md

* Update create-external-load-balancer.md

Add note callout formatting
@asfernandes
Copy link

asfernandes commented May 1, 2018

@gkubisa I'm having situation similar to @tony-kerz, the EXTERNAL-IP is always pending and minikube service spring-boot-publisher --url does not work (Waiting, endpoint for service is not ready yet...)

EDIT: I resolved the problem, minikube shows the URL and the address works. However, I'd want the URL to use the port number I defined for the load balancer, not a random port.

google-prow-robot pushed a commit to knative/serving that referenced this issue Jun 27, 2018
The docs for setting up minikube were using the namespaces and
resource names from elafros instead of knative. The naming changed
slightly, e.g. a knative controller is now called `controller`
instead of `knative-serving-controller`, so one of the loops had
to be broken into 2 statements.

Added steps about redeploying pods after setting up GCR
secrets b/c there is a chicken and egg problem where the namespaces
must exist before you can setup the secrets, but the secrets must
exist before the images can be pulled.

The PR that enabled `MutatingAdmissionWebhook` by default
(kubernetes/minikube#2547) was merged, but
the latest minikube (0.28.0) still did not enable this option
by default b/c providing any arugments overrides all of the defaults,
so we must still set it explicitly.

Made it clear in the setting up knative serving docs that the cluster
admin binding is required, not just for istio.

Use a `NodePort` instead of a `LoadBalancer`
(see kubernetes/minikube#384) - another
step along the road to #608.
@steveej
Copy link

steveej commented Jul 30, 2018

@asfernandes

EDIT: I resolved the problem, minikube shows the URL and the address works. However, I'd want the URL to use the port number I defined for the load balancer, not a random port.

Great to hear the pending external IP issue can be resolved! Would you mind to share how you did it?

@sabarnwa
Copy link

@steveej ..

Run the following commands to get the external IP:

  1. kubectl get services --namespace= ( will give three pods, including loadbalancer)
  2. minikube service <service_name_loadbalancer> --namespace=

@bhack
Copy link

bhack commented Oct 1, 2018

A temporary workaround https://github.com/knative/serving/blob/master/docs/creating-a-kubernetes-cluster.md#loadbalancer-support-in-minikube.

Any official solution here?

@Industrial
Copy link

The documentation above is not available.

It's now April 2019 and I am still having this issue of the service being pending. Should I open a new issue?

@expz
Copy link

expz commented May 7, 2019

It is still available at:

https://github.com/knative/serving/blob/b31d96e03bfa1752031d0bc4ae2a3a00744d6cd5/docs/creating-a-kubernetes-cluster.md#loadbalancer-support-in-minikube

The key commands are

sudo ip route add $(cat ~/.minikube/profiles/minikube/config.json | jq -r ".KubernetesConfig.ServiceCIDR") via $(minikube ip)
kubectl run minikube-lb-patch --replicas=1 --image=elsonrodriguez/minikube-lb-patch:0.1 --namespace=kube-system

@bauersystems
Copy link

When creating a LoadBalancer services, why doesn't Minikube just assign a new IP address within the loopback range 127.0.0.0/8?

Minikube is mostly for development, so having a loopback address would be sufficient. I vote for 127.42.0.* to keep it outside the normal range of 127.0.0.* and just to reference The Hitchhikers Guide to the Galaxy.

@patsmitty
Copy link

patsmitty commented May 17, 2020

When using the docker-desktop context provided (k8s v1.16.5 macOS v10.15.4) the EXTERNAL-IP is assigned and I am able to connect from local machine via "http://127.0.0.1:3000":

apiVersion: v1
kind: Service
metadata:
  labels:
    app: mgmt-ui
  name: mgmt-ui
  namespace: default
spec:
  ports:
  - name: 3000-3000
    port: 3000
    protocol: TCP
    targetPort: 3000
  selector:
    app: mgmt-ui
  type: LoadBalancer

That does not work when using a context that I create via minikube start --profile mgmt-cluster. Sadly, I have to either hit it via the minikube IP or minikube tunnel. I will start digging to see what docker-deskop does under the hood. I would prefer to be able to spin up my own clusters and not rely on the docker-desktop one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests