Skip to Content
Kubernetes Cookbook - Second Edition
book

Kubernetes Cookbook - Second Edition

by Hideto Saito, Hui-Chuan Chloe Lee, Ke-Jou Carol Hsu
May 2018
Intermediate to advanced
554 pages
13h 51m
English
Packt Publishing
Content preview from Kubernetes Cookbook - Second Edition

DNS for pod

Kubernetes assigns the domain name for the pod as <IP address>.<Namespace name>.pod.cluster.local. Because it uses the pod's IP address, FQDN is not guaranteed to be present permanently, but it is nice to have in case an application needs FQDN. 

Let's deploy apache2 (httpd) on chap8-domain1 and chap8-domain2, as follows:

$ kubectl run my-apache --image=httpd --namespace chap8-domain1deployment "my-apache" created$ kubectl run my-apache --image=httpd --namespace chap8-domain2deployment "my-apache" created

Type kubectl get pod -o wide to capture an IP address for those pods:

$ kubectl get pods -o wide --namespace=chap8-domain1NAME                         READY     STATUS    RESTARTS   AGE       IP           NODEmy-apache-55fb679f49-qw58f   1/1       Running   0          27s        172.17.0.4 minikube ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Kubernetes Cookbook

Kubernetes Cookbook

Sébastien Goasguen, Michael Hausenblas
DevOps with Kubernetes - Second Edition

DevOps with Kubernetes - Second Edition

Hideto Saito, Hui-Chuan Chloe Lee, Cheng-Yang Wu

Publisher Resources

ISBN: 9781788837606Supplemental Content