diff --git a/lib/ansible/module_utils/k8s/inventory.py b/lib/ansible/module_utils/k8s/inventory.py index 9cc4301758..c8c48c39c0 100644 --- a/lib/ansible/module_utils/k8s/inventory.py +++ b/lib/ansible/module_utils/k8s/inventory.py @@ -212,7 +212,8 @@ class K8sInventoryHelper(object): ports = [{'name': port.name, 'port': port.port, 'protocol': port.protocol, - 'targetPort': port.target_port} for port in service.spec.ports] + 'targetPort': port.target_port, + 'nodePort': port.node_port} for port in service.spec.ports] # add hostvars self.inventory.set_variable(service_name, 'object_type', 'service')