Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不能访问通过NodePort暴露的Nginx服务 #13747

Closed
Remering opened this issue Mar 4, 2022 · 7 comments
Closed

不能访问通过NodePort暴露的Nginx服务 #13747

Remering opened this issue Mar 4, 2022 · 7 comments
Labels
l/zh-CN Issues in or relating to Chinese lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@Remering
Copy link

Remering commented Mar 4, 2022

重现问题所需的命令

~
❯ minikube start
😄  Microsoft Windows 10 Pro 10.0.19043 Build 19043 上的 minikube v1.25.2
✨  根据现有的配置文件使用 docker 驱动程序
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
🔄  Restarting existing docker container for "minikube" ...
❗  This container is having trouble accessing https://registry.cn-hangzhou.aliyuncs.com/google_containers
💡  To pull new external images, you may need to configure a proxy: https://minikube.sigs.k8s.io/docs/reference/networking/proxy/
🐳  正在 Docker 20.10.12 中准备 Kubernetes v1.23.3…
    ▪ kubelet.housekeeping-interval=5m
🔎  Verifying Kubernetes components...
    ▪ Using image registry.cn-hangzhou.aliyuncs.com/google_containers/storage-provisioner:v5
🌟  Enabled addons: storage-provisioner, default-storageclass
🏄  Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
~
❯ kubectl run web --image=nginx
pod/web created
~
❯ kubectl get pod/web
NAME   READY   STATUS    RESTARTS   AGE
web    1/1     Running   0          16s
~
❯ kubectl expose pod web --port 80 --type NodePort
service/web exposed
~
❯ kubectl get svc/web
NAME   TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
web    NodePort   10.102.114.207   <none>        80:30212/TCP   7s
~
❯ minikube service web --url
http://192.168.49.2:30212
🏃  Starting tunnel for service web.
❗  Because you are using a Docker driver on windows, the terminal needs to be open to run it.

失败的命令的完整输出

~
❯ curl http://192.168.49.2:30212
curl : 无法连接到远程服务器
所在位置 行:1 字符: 1
+ curl http://192.168.49.2:30212
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest],WebE
    xception
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

~
❯ netstat -ano | findstr 30212

minikube logs命令的输出


minikube.log

使用的操作系统版本
Microsoft Windows 10 Pro 10.0.19043 Build 19043

备注
我使用同一台电脑WSL版本的minikube没有遇到对应的问题

@Remering Remering added the l/zh-CN Issues in or relating to Chinese label Mar 4, 2022
@zhan9san
Copy link
Contributor

Hi @Remering

Both the following way may work for you.

Method 1. Access service exposed by tunnel

```bash
$ curl http://127.0.0.1:30212
```

Method 2. Access service from minikube VM

```bash
$ minikube ssh
$ curl http://192.168.49.2:80
```

@grey8848
Copy link

grey8848 commented Apr 4, 2022

你好,我也是同样的问题
grey@DESKTOP-DGIJU5L:/mnt/c/Users/jack20/kubernetesYaml$ kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-minikube1 LoadBalancer 10.109.94.61 8080:32046/TCP 9m16s
kubernetes ClusterIP 10.96.0.1 443/TCP 27m
grey@DESKTOP-DGIJU5L:/mnt/c/Users/jack20/kubernetesYaml$ minikube service hello-minikube1 --url
http://192.168.49.2:32046
🏃 Starting tunnel for service hello-minikube1.
❗ Because you are using a Docker driver on linux, the terminal needs to be open to run it.

http://192.168.49.2:32046 这个地址浏览器打不开
而且ip还ping不通
PS C:\Users\jack20> ping 192.168.49.2

正在 Ping 192.168.49.2 具有 32 字节的数据:
请求超时。
请求超时。
请求超时。
请求超时。

192.168.49.2 的 Ping 统计信息:
数据包: 已发送 = 4,已接收 = 0,丢失 = 4 (100% 丢失),

@zhan9san
Copy link
Contributor

zhan9san commented Apr 26, 2022

Hi @Yjq14114

你用最新版的minikube,然后对照这个文档,#13806

你发的这个URL, http://192.168.49.2:32046在windows上是不可以直接访问的,需要使用127.0.0.1这样的地址,具体端口在上面文档里可以查到

试试可以解决吗?

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 25, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Aug 24, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
l/zh-CN Issues in or relating to Chinese lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

5 participants