在yaml中,我应该设置”HostNetwork: true”在哪里?

huangapple go评论77阅读模式
英文:

Where in the yaml do I set "HostNetwork: true"?

问题

我找到了一篇帖子建议我在我的bind9-deployment.yaml文件的spec:部分中使用

  1. HostNetwork: true

但我不确定它应该放在文件的哪个部分:

  1. kind: Service

还是

  1. kind: Deployment

我希望最终将我的本地bind9服务提供给我的本地网络。

英文:

I found one post that suggested I use

  1. HostNetwork: true

in the spec: section on my bind9-deployment.yaml file but I'm not sure whether it goes in the spec: under

  1. kind: Service

or

  1. kind: Deployment

section of my file.

I am hoping eventually to make my on-prem bind9 service available to my local network.

答案1

得分: 0

请参考这里了解在使用 hostNetwork 时有关 DNS 策略的更多信息。

  1. version: v1
  2. kind: Deployment
  3. metadata:
  4. name: nginx
  5. spec:
  6. replicas: 1
  7. selector:
  8. matchLabels:
  9. app: nginx
  10. template:
  11. metadata:
  12. labels:
  13. app: nginx
  14. spec:
  15. hostNetwork: true
  16. dnsPolicy: ClusterFirstWithHostNet
  17. container:
  18. - name: nginx
  19. image: nginx
  20. ports:
  21. - containerPort: 80
英文:

See here for more info about DNS policy when using hostNetwork.

  1. version: v1
  2. kind: Deployment
  3. metadata:
  4. name: nginx
  5. spec:
  6. replicas: 1
  7. selector:
  8. matchLabels:
  9. app: nginx
  10. template:
  11. metadata:
  12. labels:
  13. app: nginx
  14. spec:
  15. hostNetwork: true
  16. dnsPolicy: ClusterFirstWithHostNet
  17. container:
  18. - name: nginx
  19. image: nginx
  20. ports:
  21. - containerPort: 80

huangapple
  • 本文由 发表于 2023年1月9日 08:32:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/75052268.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定