Kubernetes is creating a nodeport service with incorrect port and it's not accessible

3/7/2018
Name:           abcxyz5
Namespace:      diyclientapps
Labels:         <none>
Annotations:        kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"name":"abcxyz5","namespace":"diyclientapps"},"spec":{"ports":[{"port":8080,"protocol"...
Selector:       app=abcxyz5
Type:           NodePort
IP:         10.97.214.209
Port:           <unset> 8080/TCP
NodePort:       <unset> 30097/TCP
Endpoints:      <none>
Session Affinity:   None
Events:         <none>

Here is my service definition:

apiVersion: v1
kind: Service
spec:
  selector:
    app: abcxyz5
  ports:
  - port: 8080
    targetPort: 8123
    protocol: TCP
  type: NodePort
metadata:
  name: abcxyz5

Why is it not using the targetPort value of 8123? None the less, I'm not able to access this service:

telnet 192.168.99.100 30097       
Trying 192.168.99.100...
telnet: Unable to connect to remote host: Connection refused

I have referenced the IP returned from: minikube ip: 192.168.99.100.

-- Chris Stryczynski
kubernetes

1 Answer

3/7/2018

The selector did not match any endpoint.

I modified it and now the describe service command shows this: N

ame:            abcxyz7
Namespace:      diyclientapps
Labels:         <none>
Annotations:        <none>
Selector:       appId=abcxyz7
Type:           NodePort
IP:         10.99.201.118
Port:           http    8080/TCP
NodePort:       http    30385/TCP
Endpoints:      172.17.0.11:8080
Session Affinity:   None
Events:         <none>
-- Chris Stryczynski
Source: StackOverflow