Kubernetes の manifetst に ホストエイリアスを書く

kubernetes
2022-04-22 22:24 (2年前) ytyng
View in English

よく忘れるのでメモ

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
現在未評価
タイトルとURLをコピー

コメント

アーカイブ

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011