2 min read
The /etc/hosts file is a Kubernetes-managed file so we cannot add entries freely to it. If we want to add entries to it we will have to use the hostAliases field in the Pod's spec.
$ kubectl exec -it demo-pod -- 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
10.103.198.74 demo-pod
11/05/2021
Read more...