0

I am unable to connect to my Jenkins master (running outside the cluster) from a pod running on the same machine as the Jenkins master instance.

When the pods run from another host machine, ping/connection works fines.

I'm using flannel. The only thing I can see is the this host IP address is in the cni.conf file configured in the exception list for OutBoundNAT endpoint Policy.

How can I run a Jenkins Agent pod on the same host as the Jenkins master if I cannot connect the IP of the host from the pod it's running on?

Thanks,

Mariusz
  • 346
  • 3
  • 6

1 Answers1

-1

You need to assign the pods to that specific node.

There are so many ways to do that but you can test by using NodeSelector.

Example:

spec:
  containers:
  - name: nginx
    image: nginx
    imagePullPolicy: IfNotPresent
  nodeSelector:
    key1: value1
    key2: value2

Which your node should have similar key and value in the labels.

To check nodes labels you can use:

kubectl get nodes --show-labels

To add a label to node:

kubectl label nodes <your-node-name> <label>

Example:

kubectl label nodes worker-2.example.com color=blue

for full and different examples you can check this link.

https://gist.github.com/devops-school/3da18faede22b18ac7013c404bc10740

Goodluck!

Sam
  • 345
  • 3
  • 14
  • When I use the NodeSelector to assign the pod to the node that Jenkins master is running on. That's when I notice the connection doesn't work. The POD cannot ping the IP address of the node (ip of the jenkins master) and the connection timeout. – Mariusz May 11 '22 at 16:41