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

hostPort not working in cluster created via kubeadm #35875

Closed
linfan opened this issue Oct 30, 2016 · 3 comments
Closed

hostPort not working in cluster created via kubeadm #35875

linfan opened this issue Oct 30, 2016 · 3 comments

Comments

@linfan
Copy link

linfan commented Oct 30, 2016

Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see http://kubernetes.io/docs/troubleshooting/.): No

What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.): nodePort, kubeadm


Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Kubernetes version (use kubectl version):

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.3", GitCommit:"4957b090e9a4f6a68b4a40375408fdc74a212260", GitTreeState:"clean", BuildDate:"2016-10-16T06:36:33Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"4", GitVersion:"v1.4.5", GitCommit:"5a0a696437ad35c133c0c8493f7e9d22b0f9b81b", GitTreeState:"clean", BuildDate:"2016-10-29T01:32:42Z", GoVersion:"go1.6.3", Compiler:"gc", Platform:"linux/amd64"}

Environment:

  • Cloud provider or hardware configuration: AWS
  • OS (e.g. from ca): Ubuntu 16.04.1 LTS
  • Kernel (e.g. uname -a): 4.4.0-31-generic x86_64 GNU/Linux
  • Install tools: kubeadm
  • Others: single node cluster, with calico network plugin

What happened:

nodePort attribute in pod does not map container port to host.

What you expected to happen:

Yaml file like:

ports:
- containerPort: 80
   hostPort: 80

should expose the container port 80 to host port 80.

How to reproduce it (as minimally and precisely as possible):

Create a pod use below yaml file:

apiVersion: v1
kind: Pod
metadata:
  name: demo
spec:
  containers:
  - name: nginx-demo
    image: nginx
    ports:
    - containerPort: 80
      hostPort: 80

Then use curl <node-ip>:80 try access it, will get Connection refused error.

Check the docker container via docker inspect <container-id>, the container port is actually not exposed:

"HostConfig": {
  "PortBindings": null
}
"Config": {
  "ExposedPorts": {
    "443/tcp": {},
    "80/tcp": {}
  }
}
"NetworkSettings": {
  "Ports": null,
}

Anything else do we need to know:

Issue was found originally because the rc-default.yaml file in ingress example require nodePort.

@luxas luxas changed the title nodePort not working in cluster created via kubeadm hostPort not working in cluster created via kubeadm Oct 30, 2016
@luxas
Copy link
Member

luxas commented Oct 30, 2016

This is a known issue, but I agree we should document it.
See: #31307

We're using cni networking.

Do you want to make the change in the docs or should I take it?

@linfan
Copy link
Author

linfan commented Nov 3, 2016

Sure, PR-1615 created.

@mikedanese
Copy link
Member

This issue was moved to kubernetes/kubeadm#11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants