简体   繁体   中英

How to alias Hostnames in Kubernetes Deployment Configuration

How to alias POD Ip Address with different domain name instead of default name.

For Example: 
10.1.1.1 testxyz

My output has to be with the new entry like below. I have tried with hostAliases but the problem here is ipaddress will be dynamic when pod scales up. so in that case i can't keep my ip address as static in deployment config yaml file. Moreover i don't have permissions to change the /etc/hosts file with non-root user. Kindly suggest.

Output:
    10.1.1.1 testxyz
    10.1.1.1 abc.xyz.com

Use a Service with type ExternalName to register arbitrary IPs into a cluster DNS entry.

So you would make a service testxyz with the address set to 10.1.1.1 and then use the DNS name testxyz.mynamespace.svc.cluster.local in config files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM