Kubernetes - what does <unset> mean in port in a service?

3/1/2017

I have a service exposed of type=LoadBalancer and when I do a

kubectl describe services servicename,

I get this output :

Name:           ser1
Namespace:      default
Labels:         app=online1
Selector:       app=online1
Type:           LoadBalancer
IP:         10.0.0.32
External IPs:       192.168.99.100
Port:           <unset> 8080/TCP
NodePort:       <unset> 30545/TCP
Endpoints:      172.17.0.10:8080,172.17.0.11:8080,172.17.0.8:8080 + 1 more...
Session Affinity:   None

Can someone please guide on the following doubts :

1.) I can't understand what <unset> means in Port and NodePort. Also, how does it affect my service?

2.) When I want to hit a service, I hit the service using <external-ip:NodePort> right? Then what's the use of Port?

-- Dreams
kubernetes

1 Answer

3/1/2017

Port unset means: You didn't specify a name in service creation.

Service Yaml excerpt (note name: grpc):

spec:
  ports:
  - port: 26257
    targetPort: 26257
    name: grpc
  type: NodePort

kubectl describe services servicename output excerpt:

Type:                   NodePort
IP:                     10.101.87.248
Port:                   grpc    26257/TCP
NodePort:               grpc    31045/TCP
Endpoints:              10.20.12.71:26257,10.20.12.73:26257,10.20.8.81:26257

Port is definition of container ports that service will send the traffic on (Actual Endpoint).

-- Farhad Farahi
Source: StackOverflow