Question
I have a Kubernetes cluster running on Google Compute Engine and I would like
to assign static IP addresses to my external services (type: LoadBalancer
).
I am unsure about whether this is possible at the moment or not. I found the
following sources on that topic:
- Kubernetes Service Documentation lets you define an external IP address, but it fails with cannot unmarshal object into Go value of type []v1.LoadBalancerIngress
- The publicIPs field seems to let me specify external IPs, but it doesn't seem to work either
- This Github issue states that what I'm trying to do is not supported yet, but will be in Kubernetes v1.1
- The clusterIP field also lets me specify an IP address, but fails with " provided IP is not in the valid range "
I feel like the usage of static IPs is quite important when setting up web services. Am I missing something here? I'd be very grateful if somebody could enlighten me here!
EDIT: For clarification: I am not using Container Engine, I set up a cluster myself using the official installation instructions for Compute Engine. All IP addresses associated with my k8s services are marked as "ephemeral", which means recreating a kubernetes service may lead to a different external IP address (which is why I need them to be static).
Answer
Kubernetes v1.1 will make a few changes.
First, all load-balancers in GCE will get static IPs. This allows us to simulate "update" operations that GCE does not support.
Second, https://github.com/kubernetes/kubernetes/pull/13005 proposes a new field to explicitly set the IP of a load balancer.
Note though that your "ephemeral" IP is yours as long as your Service exists. This is roughly akin to what AWS does with ELB names (randomly assigned, yours until you release it).
publicIPs (or deprecatedPublicIPs in v1) will be replaced with externalIPs with very similar semantics. These are "unmanaged" IPs - kubernetes will not establish a load-balancer using them, but it will accept traffic for them.
clusterIP is an in-cluster address and generally is not available outside of the cluster or "project" or VPC (in GCE or AWS terms)