2

I have a kubernetes service called staging that selects all app=jupiter pods. It exposes an HTTP service on port 1337. Here's the describe output:

$ kubectl describe service staging
Name:           staging
Namespace:      default
Labels:         run=staging
Selector:       app=jupiter
Type:           NodePort
IP:             10.11.255.80
Port:           <unnamed>   1337/TCP
NodePort:       <unnamed>   30421/TCP
Endpoints:      10.8.0.21:1337
Session Affinity:   None
No events.

But when I run a kubectl rolling-update on the RC, which removes the 1 pod running the application and adds another, and run describe again, I get:

$ kubectl describe service staging
Name:           staging
Namespace:      default
Labels:         run=staging
Selector:       app=jupiter
Type:           NodePort
IP:             10.11.255.80
Port:           <unnamed>   1337/TCP
NodePort:       <unnamed>   30421/TCP
Endpoints:      10.8.0.22:1337
Session Affinity:   None
No events.

Everything is the same, except for the Endpoint IP address. In fact, it goes up by 1 every time I do this. This is the one thing I expected not to change, since services are an abstraction over pods, so they shouldn't change when the pods change.

I know you can hardcode the endpoint address, so this is more of a curiosity.

Also, can anyone tell me what the IP field in the describe output is for?

tmandry
  • 1,295
  • 16
  • 33

1 Answers1

4

IP is the address of your service, which remains constant over time. Endpoints is the collection of backend addresses across which requests to the service address are spread at a given point in time. That collection changes every time the set of pods comprising your service changes, as you've noticed when performing a rolling update on your replication controller (RC).

  • 1
    This makes perfect sense, but I can't seem to access the service via the IP, either at port 1337 or port 80. (Endpoint IP/port works.) Maybe this has to do with it being a NodePort service, but from the documentation it doesn't seem like it would be. – tmandry Sep 16 '15 at 17:39
  • Posted this question here: http://stackoverflow.com/questions/32618437/why-cant-i-access-my-kubernetes-service-via-its-ip – tmandry Sep 16 '15 at 20:51