Azure / acs-engine

WE HAVE MOVED: Please join us at Azure/aks-engine!
https://github.com/Azure/aks-engine
MIT License
1.03k stars 561 forks source link

Static IP on Kubernetes Loadblanacer #1140

Closed Anmorata closed 5 years ago

Anmorata commented 7 years ago

What happened: created kubernetes service with field loadBalancerIP and pointed the ip address :

spec:
  clusterIP: 10.0.123.203
  loadBalancerIP: 52.166.122.228

the svc goes on error saying:

Error creating load balancer (will retry): Failed to create load balancer for service proxy/jobs-proxy2: user supplied IP Address 52.166.122.228 was not found

when this ip address in fronted ip configuration of loadbalance and its not taken

the replace command works fine and the external ip address isn't changed. is there a way to bind IP address in azure to kubernetes service statically so it never changes?

PravinMagdum commented 7 years ago

i am also getting same error .. Any one can comment on this please @Anmorata - are you able to resolve this ? any thing missing in setting up service ?

Anmorata commented 7 years ago

I wasn't able to resolve this issue, but using kubectl apply doesn't change the ip address on loadbalancer and this I started using it :) but service must be created with kubectl apply at first

PravinMagdum commented 7 years ago

ohh.thanks for prompt reply .. I am trying to deploy Micorservices with kubernetes and want to stick to static IP. ( as all services are communicating over REST API on different ports so want to expose all to outside cluster) I tried with apply in morning and confirm that is alternative.. but was really hoping i can set my own static ip

wslaghekke commented 7 years ago

I have a load-balancer in production on which the IP is set, did you create the static-ip in the azure portal before creating the loadBalancer-service? And if so, what resource-group did you put it into? it may need to be in the same resource-group as the rest of the cluster resources.

marceldempers commented 7 years ago

I just tested this. Tried with IP outside resource group as the cluster and saw this in the K8 controller manager logs:

Retrying in 5m0s: Failed to create load balancer for service default/my-test: user supplied IP Address XX.XX.XX.XX was not found

Then tried with the IP address in the same resource group as the cluster service and it worked. K8 assigned the IP to the LB front end pool, created rules and probes and my K8 service got its external IP as required.

Would be great to see the restriction lifted so we can create these IP's in other resource groups. My version of K8 is 1.7.1 deployed using ACS-Engine on Azure.

Hope this helps you

mvaldesdeleon commented 6 years ago

Heads up: AKS creates a new Resource Group for each Cluster, regardless of you specifying a Resource Group for the Cluster itself.

The Public IP needs to be created in this automatically generated Resource Group, not on the one you picked on az aks create.

marcel-dempers commented 6 years ago

Yeah with AKS it may become a problem where you can't bring your own IP. It be great to be able to maintain a pool of fixed IPs outside of K8 / resource group and its very important for services that rely on being whitelisted by 3rd parties.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. Note that acs-engine is deprecated--see https://github.com/Azure/aks-engine instead.