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 #11

Closed
mikedanese opened this issue Nov 22, 2016 · 3 comments
Closed

hostPort not working in cluster created via kubeadm #11

mikedanese opened this issue Nov 22, 2016 · 3 comments
Labels
documentation/improvement kind/support Categorizes issue or PR as a support question.

Comments

@mikedanese
Copy link
Member

From @linfan on October 30, 2016 16:26

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.

Copied from original issue: kubernetes/kubernetes#35875

@mikedanese
Copy link
Member Author

From @luxas on October 30, 2016 19:21

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

We're using cni networking.

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

@mikedanese
Copy link
Member Author

From @linfan on November 3, 2016 17:42

Sure, PR-1615 created.

@luxas
Copy link
Member

luxas commented Nov 25, 2016

This is documented both on the kubeadm page and on the network plugin page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation/improvement kind/support Categorizes issue or PR as a support question.
Projects
None yet
Development

No branches or pull requests

2 participants