K8S pod hosts和resolv.conf

通过 HostAliases 增加额外的hosts条目

注:只能修改非hostNetwork的pod

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

自定义resolv.conf

猜你喜欢

转载自www.cnblogs.com/lingfenglian/p/11758828.html