-2

I am trying to learn k8s and following along in the official tutorials https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-interactive/

Why is the endpoint empty? The tutorial says that

We have now a running Service called kubernetes-bootcamp. Here we see that the Service received a unique cluster-IP, an internal port and an external-IP (the IP of the Node)

I only see <none> . This SO question says it should be name, not app, should it be name instead of app?

$ kubectl expose deployment/kubernetes-bootcamp --type="NodePort" --port 8080
service/kubernetes-bootcamp exposed

$ kubectl get services
NAME                  TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
kubernetes            ClusterIP   10.96.0.1      <none>        443/TCP          9m13s
kubernetes-bootcamp   NodePort    10.101.46.87   <none>        8080:30568/TCP   7m49s

$ kubectl describe services/kubernetes-bootcamp
Name:                     kubernetes-bootcamp
Namespace:                default
Labels:                   app=kubernetes-bootcamp
Annotations:              <none>
Selector:                 app=kubernetes-bootcamp
Type:                     NodePort
IP Families:              <none>
IP:                       10.101.46.87
IPs:                      10.101.46.87
Port:                     <unset>  8080/TCP
TargetPort:               8080/TCP
NodePort:                 <unset>  30568/TCP
Endpoints:                172.18.0.4:8080
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>


$ kubectl get services
NAME                  TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
kubernetes            ClusterIP   10.96.0.1      <none>        443/TCP          9m13s
kubernetes-bootcamp   NodePort    10.101.46.87   <none>        8080:30568/TCP   7m49s
likejudo
  • 3,396
  • 6
  • 52
  • 107

2 Answers2

0

It's correct that you don't see EXTERNAL-IP if you use a service of type NodePort.

"If you set the type field to NodePort, the Kubernetes control plane allocates a port from a range specified by --service-node-port-range flag (default: 30000-32767). Each node proxies that port (the same port number on every Node) into your Service." https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport

Take a look at this example: https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/

glv
  • 994
  • 1
  • 1
  • 15
0

"External-IP is <none> when there is no load balancer" (Sander Van Vugt)

likejudo
  • 3,396
  • 6
  • 52
  • 107