Kubernetes Networking - CloudCommandos/JohnChan GitHub Wiki

Without additional Network Policy in place, all pods are ping-able by their IP and DNS A record within the same K8s cluster.

DNS A Record

All Pods:

  • Pod IP: 10.244.2.135
  • Namespace: my-namespace
  • Pod DNS A Record: 10-244-2-135.my-namespace.pod.cluster.local

Pods with Hostname and Subdomain configured:

  • Hostname: hostname
  • Subdomain : svc-1 (must have Service object with the same name)
  • Namespace: my-namespace
  • Pod DNS A Record: hostname.svc-1.my-namespace.svc.cluster.local

Pods under Deployments with only Subdomain configured:

  • Deployment metadata name: deploy-1
  • Subdomain : svc-1 (must have Service object with the same name)
  • Namespace: my-namespace
  • Pod DNS A Record: deploy-1-XXXXXXXX.svc-1.my-namespace.svc.cluster.local

Pods under Deployments with Hostname and Subdomain configured:

  • Hostname: hostname
  • Subdomain : svc-1 (must have Service object with the same name)
  • Namespace: my-namespace
  • Pod DNS A Record: hostname.svc-1.my-namespace.svc.cluster.local

Pods under StatefulSets:

  • StatefulSet metadata name: stateful-1
  • Service metadata name: svc-1
  • Namespace: my-namespace
  • Pod DNS A Record: stateful-1-0.svc-1.my-namespace.svc.cluster.local

Useful links:
kubernetes-dns default ndots may affect performance