简体   繁体   English

Kubernetes:为所有 Pod/服务启用主机网络

[英]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?是否可以在不修改 yaml 文件的情况下默认为所有已安装的 pod(或服务)启用主机和集群之间的主机网络? Modifying only kubelet or docker setup仅修改 kubelet 或 docker 设置

On pod it's possible with flag在 pod 上可以使用 flag

hostNetwork: true

Okay I got your question.好的,我明白了你的问题。 You basically want all port forwarding from host port to the pod port.您基本上希望所有端口从主机端口转发到 pod 端口。

To do: 1.- Add these to your port config in manifest要做:1.-将这些添加到清单中的端口配置中

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.现在可以直接使用 nodeIp:9100 访问 pod,这将使 pod 能够在主机端口 9100 中运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM