Search code examples
kuberneteskubectlkubelet

Kubernetes: enable host network for all pods/services


Is it possible to enable host network between host and cluster for all installed pods (or services) by default without modifying yaml files? Modifying only kubelet or docker setup

On pod it's possible with flag

hostNetwork: true

Solution

  • Okay I got your question . You basically want all port forwarding from host port to the pod port.

    To do : 1.- Add these to your port config in manifest

    name: portA
    
    containerPort: 9100
    
    hostPort: 9100
    

    Add this to your deployment manifest . Now the pod will be accessible by directly using nodeIp:9100 which will enable the pod to run in the hostport 9100.