よく忘れるのでメモ
https://kubernetes.io/ja/docs/tasks/network/customize-hosts-file-for-pods/
apiVersion: apps/v1
kind: Deployment
spec:
...
template:
...
spec:
hostAliases:
- hostnames:
- target-host.example.com
ip: 192.168.0.XX
確認方法
$ cat /etc/hosts
# Kubernetes-managed hosts file.
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
fe00::0 ip6-mcastprefix
fe00::1 ip6-allnodes
fe00::2 ip6-allrouters
172.31.XX.XX podname-aaaabbbb
# Entries added by HostAliases.
192.168.0.XX target-host.example.com
コメント