【问题标题】:Can't access container's port in microk8s在 microk8s 中无法访问容器的端口
【发布时间】:2020-03-26 09:11:43
【问题描述】:

尝试在microk8s 中运行容器。

根据https://docs.docker.com/get-started/part3/,部署服务后。

microk8s.kubectl get services 显示:

   NAME               TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
   bb-entrypoint      NodePort    10.152.183.182   <none>        8080:30001/TCP   5m51s
   kubernetes         ClusterIP   10.152.183.1     <none>        443/TCP          35d
   microbot-service   NodePort    10.152.183.80    <none>        80:31223/TCP     19

但是,我无法通过以下任何地址访问bb-entrypoint 服务:

  • localhost:30001
  • 10.152.183.182:8080

操作系统是基于(ubuntu)的mint mate,我禁用了ufw

有什么想法吗?

【问题讨论】:

  • 您需要提供minimal reproducible example 以使其可调试:您从哪里进行此调用,您遇到了什么具体错误,以及您使用哪些 YAML 文件来定义部署和服务对象?这可能是由于从错误的位置进行 HTTP 调用,或者 Pod 和服务标签不匹配,或者 Pod 没有启动,或者......

标签: docker kubernetes containers microk8s


【解决方案1】:

您必须通过运行 kubectl get ep 确保是否为此服务创建了端点 在这种情况下,我看到没有创建端点,因为 pod 在从 docker 拉取图像时遇到问题,所以它没有处于就绪状态

[root@master tmp]# kubectl get ep
NAME            ENDPOINTS           AGE
bb-entrypoint                       9m24s

[root@master tmp]# kubectl get po
NAME                         READY   STATUS                       RESTARTS   AGE
bb-demo-7ffb568776-q6xs2     0/1     ImagePullBackOff             0          9m55s

Warning  Failed          6h15m (x3 over 6h17m)   kubelet, node1.k8s  Failed to pull image "bulletinboard:1.0": rpc error: code = Unknown desc = repository docker.io/bulletinboard not found: does not exist or no pull access
  Warning  Failed          6h15m (x3 over 6h17m)   kubelet, node1.k8s  Error: ErrImagePull
  Normal   BackOff         6h15m (x7 over 6h17m)   kubelet, node1.k8s  Back-off pulling image "bulletinboard:1.0"
  Normal   Pulling         6h14m (x4 over 6h17m)   kubelet, node1.k8s  Pulling image "bulletinboard:1.0"
  Warning  Failed          6h12m (x15 over 6h17m)  kubelet, node1.k8s  Error: ImagePullBackOff

【讨论】:

猜你喜欢
  • 2016-12-06
  • 1970-01-01
  • 1970-01-01
  • 2019-09-10
  • 1970-01-01
  • 2021-11-17
  • 1970-01-01
  • 2016-05-30
  • 1970-01-01
相关资源
最近更新 更多