Docker 为什么我的节点端口不能获得外部ip?
环境资料:Docker 为什么我的节点端口不能获得外部ip?,docker,kubernetes,jupyterhub,Docker,Kubernetes,Jupyterhub,环境资料: 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 最近,我尝试在kubernetes上部署“Zero to Jupyterhub”。我的jupyterhub配置文
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
最近,我尝试在kubernetes上部署“Zero to Jupyterhub”。我的jupyterhub配置文件如下:
config.yaml
proxy:
secretToken: "2fdeb3679d666277bdb1c93102a08f5b894774ba796e60af7957cb5677f40706"
service:
type: NodePort
nodePorts:
http: 30080
https: 30443
singleuser:
storage:
dynamic:
storageClass: local-storage
capacity: 10Gi
注意:我将服务类型设置为NodePort
,因为我没有任何云提供商(部署在我的实验室服务器集群上),并且我尝试使用nginx-ingres
也失败了,这就是我不使用LoadBalance
的原因
但当我使用此配置文件通过Helm
安装jupyterhub时,我无法从浏览器访问jupyterhub,即使所有pod
都在运行。这些吊舱的细节如下所示:
kubectl get pod——名称空间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
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
其服务如下:
kubectl获取服务——名称空间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
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
名称类型群集IP外部IP端口
集线器组IP 10.10.55.78 8081/TCP 28m
代理api ClusterIP 10.10.27.133 8001/TCP 28m
代理公共节点端口10.10.97.11 443:30443/TCP,80:30080/TCP 28m
它似乎工作得很好,对吗?(我猜)但事实是我不能使用ip10.10.97.11
访问jupyter主页,而且我也没有获得任何外部ip
因此,我的问题是:
最后,非常感谢你救了我一天 对于
NodePort
服务,您将无法获得EXTERNAL-IP
。您不能使用CLUSTER-IP
从kubernetes群集外部访问它,因为CLUSTER-IP
用于从kubernetes群集内部访问它,通常是从另一个pod访问。要从kubernetes群集外部访问它,您需要使用NodeIP:NodePort
其中NodeIP
是您的kubernetes群集节点IP地址