如何在掌舵图中添加额外的主机条目 [英] How to add extra hosts entries in helm charts

查看:50
本文介绍了如何在掌舵图中添加额外的主机条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我将在kubernetes上使用舵图来部署我的应用程序堆栈,现在我需要在pods/etc/hosts文件内添加一些依赖的服务器ip和主机名,因此在这种情况下需要帮助

So i'm deploying my application stack on kubernetes sing helm charts and now i need to add some dependant server ip's and hostnames inside my pods /etc/hosts file so need help on this scenario

推荐答案

根据文档中的内容,您可以使用

As standing in documentation you can add extra hosts to POD by using host aliases feature

文档示例:

apiVersion: v1
kind: Pod
metadata:
  name: hostaliases-pod
spec:
  restartPolicy: Never
  hostAliases:
  - ip: "127.0.0.1"
    hostnames:
    - "foo.local"
    - "bar.local"
  - ip: "10.1.2.3"
    hostnames:
    - "foo.remote"
    - "bar.remote"
  containers:
  - name: cat-hosts
    image: busybox
    command:
    - cat
    args:
    - "/etc/hosts"

这篇关于如何在掌舵图中添加额外的主机条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆