-
Type:
Bug
-
Resolution: Not A Defect
-
Priority:
Minor
-
Component/s: kubernetes-plugin
Hello
I have the example below
I defined a ContainerTemplate with a hostPort and ContainerPort and try to access that using the hostPort, but I got connection refused. if use the containerPort works.
Am i doing something wrong? or how can I access the hostport?
thanks
podTemplate(label: 'jenkins-slave', containers: [ containerTemplate( name: 'golang', image: 'golang:1.8', ttyEnabled: true, command: 'cat', alwaysPullImage: false, resourceRequestCpu: '1000m', resourceLimitCpu: '2000m', resourceRequestMemory: '2Gi', resourceLimitMemory: '4Gi' ), containerTemplate( name: 'inbucket', image: 'jhillyerd/inbucket:latest', ports: [portMapping(name: 'inbucket', containerPort: 10080, hostPost: 9000), portMapping(name: 'inbucket2', containerPort: 10025, hostPost: 2500)], resourceRequestCpu: '250m', resourceLimitCpu: '250m', resourceRequestMemory: '256Mi', resourceLimitMemory: '256Mi' ) ] ) { node('jenkins-slave') { stage('test') { container('golang') { sh 'curl http://localhost:9000' // works only with 10080 } } } }