英文:
Where in the yaml do I set "HostNetwork: true"?
问题
我找到了一篇帖子建议我在我的bind9-deployment.yaml文件的spec:部分中使用
HostNetwork: true
但我不确定它应该放在文件的哪个部分:
kind: Service
还是
kind: Deployment
我希望最终将我的本地bind9服务提供给我的本地网络。
英文:
I found one post that suggested I use
HostNetwork: true
in the spec: section on my bind9-deployment.yaml file but I'm not sure whether it goes in the spec: under
kind: Service
or
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 策略的更多信息。
version: v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
container:
- name: nginx
image: nginx
ports:
- containerPort: 80
英文:
See here for more info about DNS policy when using hostNetwork.
version: v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
container:
- name: nginx
image: nginx
ports:
- containerPort: 80
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论