Search code examples
kuberneteskubernetes-service

Why is my minikube's NodePort service's external IP <none> and not <nodes>?


I'm working through chapter 5.3 of Kubernetes In Action by Marko Luska. I'm creating a nodeport service from the following file:

apiVersion: v1
kind: Service
metadata:
  name: kubia-nodeport
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 8080
    nodePort: 30123
  selector:
    app: kubia

It works, and I can hit all the IPs I'm expecting to hit (localhost, cluterIP...) but the external IP is shown as <none>:

$ kubectl get svc 
NAME             TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
kubernetes       ClusterIP   10.96.0.1      <none>        443/TCP        17h
kubia-nodeport   NodePort    10.96.191.43   <none>        80:30123/TCP   12s

$ kubectl get rc --show-labels
NAME    DESIRED   CURRENT   READY   AGE   LABELS
kubia   3         3         3       21h   app=kubia

$ kubectl get po --show-labels
NAME          READY   STATUS    RESTARTS   AGE   LABELS
kubia-fb7h8   1/1     Running   0          17h   app=kubia
kubia-nnkc4   1/1     Running   0          17h   app=kubia
kubia-s88mt   1/1     Running   0          17h   app=kubia

Minikube should be showing <nodes> as it does in this question and this other question. Why is it not?


Solution

  • Probably because this was the case in 2017 and it's not anymore.
    The question you're referencing are from 2016 and 2017.

    Since then you'll always see <none> unless it's a LoadBalancer. See this particular comment on github which is from 2019.

    Sorry I can't find the PR nor the issue corresponding to that change.