OpenShift Container Platform (OCP) uses CoreDNS as its default, native DNS engine for service discovery and name resolution within the cluster.
Red Hat deeply integrates CoreDNS into OCP via an automated framework called the DNS Operator.
How CoreDNS is Deployed in OpenShift
If you are running OpenShift 4.x, you don’t manually install or configure CoreDNS binaries. Instead, OpenShift manages it natively:
- The DNS Operator: OCP features a dedicated controller (
dns-operator) in theopenshift-dns-operatornamespace. This operator is responsible for deploying, upgrading, and maintaining CoreDNS automatically. - DaemonSet Topology: The operator deploys CoreDNS as a DaemonSet (named
dns-default) inside theopenshift-dnsnamespace. This means every node in your OpenShift cluster runs a local replica of the CoreDNS pod, ensuring lightning-fast local DNS lookups and robust high availability. - The Fixed Cluster IP: The operator maps CoreDNS to a static cluster IP address, which is traditionally the 10th IP of your defined service network range (e.g.,
172.30.0.10). Every pod created in OCP is automatically configured to point to this IP for name resolution.
What CoreDNS Handles Inside OCP
CoreDNS acts as the traffic cop for routing names inside your OpenShift environment. It splits requests into two primary pathways:
1. Internal Service Discovery (cluster.local)
When a container in Pod A wants to talk to a microservice or an internal OpenShift registry, CoreDNS resolves it instantly without leaving the cluster:
- Services: Resolves
my-app.my-namespace.svc.cluster.localto its stable internal ClusterIP. - Pods: Resolves individual pod IPs dynamically.
2. External / Upstream Forwarding
If a pod tries to access an external endpoint (e.g., api.github.com or an internal enterprise Active Directory domain), CoreDNS intercepts the request. Because it doesn’t own that domain, CoreDNS uses its forward plugin to safely hand the request off to the upstream DNS servers configured on the host node’s /etc/resolv.conf.
How to Check It in Your Cluster
If you have cluster administrator privileges, you can see CoreDNS at work by running these standard OpenShift CLI commands:
To view the health of the DNS operator:
oc get clusteroperator/dns
To see the live CoreDNS pods running across your nodes:
oc get pods -n openshift-dns -o wide