Kubernetes: Why my NodePort can not get an external ip?

Viewed 1915

Environment information:

Computer detail: One master node and four slave nodes. All are CentOS Linux release 7.8.2003 (Core).
Kubernetes version: v1.18.0.
Zero to JupyterHub version: 0.9.0.
Helm version: v2.11.0

Recently, I try to deploy "Zero to Jupyterhub" on kubernetes. My jupyterhub config file such below:

config.yaml

proxy:
  secretToken: "2fdeb3679d666277bdb1c93102a08f5b894774ba796e60af7957cb5677f40706"
  service:
    type: NodePort
    nodePorts:
      http: 30080
      https: 30443
singleuser:
  storage:
    dynamic:
      storageClass: local-storage
    capacity: 10Gi

Note: I set the service type as NodePort, because I not have any cloud provider(deploy on my lab servers cluster), and I try using nginx-ingress also then got failure, that reason why I do not using LoadBalance.

But when I using this config file to install jupyterhub via Helm, I can not access jupyterhub from browser, even all Pods running. These pods detail like below:

kubectl get pod --namespace jhub

NAME                              READY   STATUS    RESTARTS   AGE
continuous-image-puller-8gxxk     1/1     Running   0          27m
continuous-image-puller-8tmdh     1/1     Running   0          27m
continuous-image-puller-lwdcx     1/1     Running   0          27m
continuous-image-puller-pszsr     1/1     Running   0          27m
hub-7b9cbbcf59-fbppq              1/1     Running   0          27m
proxy-6b699b54c8-2pxmb            1/1     Running   0          27m
user-scheduler-65f4cbb9b7-9vmfr   1/1     Running   0          27m
user-scheduler-65f4cbb9b7-lqfrh   1/1     Running   0          27m

and its services like this:

kubectl get service --namespace jhub

NAME           TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)                      AGE
hub            ClusterIP   10.10.55.78    <none>        8081/TCP                     28m
proxy-api      ClusterIP   10.10.27.133   <none>        8001/TCP                     28m
proxy-public   NodePort    10.10.97.11    <none>        443:30443/TCP,80:30080/TCP   28m

Is seem to work well, right? (I guessed.) But the fact is that I can not use ip 10.10.97.11 to access the jupyter main page, and I did not get any external ip also.

So, my problems are:

  1. Do my config have any wrong?
  2. How to get an external ip?

Finally, thank you for save my day so much!

1 Answers

For NodePort service you will not get EXTERNAL-IP. You can not use the CLUSTER-IP to access it from outside the kubernetes cluster because CLUSTER-IP is for accessing it from inside the kubernetes cluster typically from another pod.For accessing from outside the kubernetes cluster you need to use NodeIP:NodePort where NodeIP is your kubernetes nodes IP address.

Related