Kirill
Kirill

Reputation: 8056

External IP assignment with Minihube ingress add-on enabled

For development purposes I try to use Minikube. I want to test how my application will catch an event of exposing a service and assigning an External-IP. When I exposed a service in Google Container Engine quick start tutorial I could see an event of External IP assignment with: kubectl get services --watch

I want to achieve the same with Minikube (if possible).

Here is how I try to set things up locally on my OSX development machine:

minikube start --vm-driver=xhyve
minikube addons enable ingress
kubectl run echoserver --image=gcr.io/google_containers/echoserver:1.4 --port=8080
kubectl expose deployment echoserver --type="LoadBalancer"
kubectl get services --watch

I see the following output:

NAME         TYPE           CLUSTER-IP   EXTERNAL-IP   PORT(S)          AGE
echoserver   LoadBalancer   10.0.0.138   <pending>     8080:31384/TCP   11s
kubernetes   ClusterIP      10.0.0.1     <none>        443/TCP          4m

External-Ip field never gets updated and shows pending phase. Is it possible to achieve external IP assignment with Minikube?

Upvotes: 1

Views: 820

Answers (2)

Kirill
Kirill

Reputation: 8056

If you want to emulate external IP assignment event (like the one you can observe using GKE or AWS), this can be achieved by applying the following patch on your sandbox kubernetes:

kubectl run minikube-lb-patch --replicas=1 --image=elsonrodriguez/minikube-lb-patch:0.1 --namespace=kube-system

https://github.com/elsonrodriguez/minikube-lb-patch#assigning-external-ips

Upvotes: 0

On GKE or AWS installs, the external IP comes from the cloud support that reports back to kube API the address that the created LB was assigned.

To have the same on minikube you'd have to run some kind of an LB controller, ie. haproxy one, but honestly, for minikube it makes little sense, as you have single IP that you know in advance by minikube ip so you can use NodePort with that knowledge. LB solution would require setting some IP rangethat can be mapped to particular nodeports, as this is effectively what LB will do - take traffic from extIP:extPort and proxy it to minikubeIP:NodePort.

Unless your use case prevents you from it, you should consider Ingress as the way of ingesting traffic to your minikube.

Upvotes: 1

Related Questions