【发布时间】:2020-11-05 03:18:09
【问题描述】:
我根据这里的步骤https://ubuntu.com/kubernetes/install#single-node在我的ubuntu机器上安装了microk8s
然后我按照 kubernetes 官方教程,创建并暴露了一个这样的部署
microk8s.kubectl create deployment kubernetes-bootcamp --image=gcr.io/google-samples/kubernetes-bootcamp:v1
microk8s.kubectl expose deployment/kubernetes-bootcamp --type=NodePort --port 8083
这是我的kubectl get services 输出
akila@ubuntu:~$ microk8s.kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 25h
kubernetes-bootcamp NodePort 10.152.183.11 <none> 8083:31695/TCP 17s
这是我的kubectl get pods 输出
akila@ubuntu:~$ microk8s.kubectl get pods
NAME READY STATUS RESTARTS AGE
kubernetes-bootcamp-6f6656d949-rllgt 1/1 Running 0 51m
但我无法使用 http://localhost:8083 或使用 http://10.152.183.11:31695 从浏览器访问服务
当我尝试 http://localhost:31695 时,我得到了 ERR_CONNECTION_REFUSED。
如何从我的浏览器访问这个“kubernetes-bootcamp”服务? 我错过了什么吗?
【问题讨论】:
-
您应该使用
http://localhost:31695访问应用程序 -
@DashrathMundkar 我收到 ERR_CONNECTION_REFUSED
标签: kubernetes kubernetes-ingress kubernetes-pod microk8s