This is a cache of https://docs.openshift.com/container-platform/4.1/networking/dns-operator.html. It is a snapshot of the page at 2024-11-19T02:13:04.828+0000.
Understanding the <strong>dns</strong> Operator | Networking | OpenShift Container Platform 4.1
×

The dns Operator deploys and manages Coredns to provide a name resolution service to pods, enabling dns-based Kubernetes Service discovery in OpenShift.

dns Operator

The dns Operator implements the dns API from the operator.openshift.io API group. The operator deploys Coredns using a DaemonSet, creates a Service for the DaemonSet, and configures the kubelet to instruct pods to use the Coredns Service IP for name resolution.

Procedure

The dns Operator is deployed during installation as a Kubernetes Deployment.

  1. Use the oc get command to view the Deployment status:

    $ oc get -n openshift-dns-operator deployment/dns-operator
    NAME           READY     UP-TO-DATE   AVAILABLE   AGE
    dns-operator   1/1       1            1           23h

    ClusterOperator is the Custom Resource object which holds the current state of an operator. This object is used by operators to convey their state to the rest of the cluster.

  2. Use the oc get command to view the state of the dns Operator:

    $ oc get clusteroperator/dns
    NAME      VERSION     AVAILABLE   PROGRESSING   DEGRADED   SINCE
    dns       4.1.0-0.11  True        False         False      92m

    AVAILABLE, PROGRESSING and DEGRADED provide information about the status of the operator. AVAILABLE is True when at least 1 pod from the Coredns DaemonSet is reporting an Available status condition.

View the default dns

Every new OpenShift Container Platform installation has a dns.operator named default. It cannot be customized, replaced, or supplemented with additional dnses.

Procedure
  1. Use the oc describe command to view the default dns:

    $ oc describe dns.operator/default
    Name:         default
    Namespace:
    Labels:       <none>
    Annotations:  <none>
    API Version:  operator.openshift.io/v1
    Kind:         dns
    ...
    Status:
      Cluster Domain:  cluster.local (1)
      Cluster IP:      172.30.0.10 (2)
    ...
    1 The Cluster Domain field is the base dns domain used to construct fully qualified Pod and Service domain names.
    2 The Cluster IP is the address pods query for name resolution. The IP is defined as the 10th address in the Service CIDR range.
  2. To find the Service CIDR of your cluster, use the oc get command:

    $ oc get networks.config/cluster -o jsonpath='{$.status.serviceNetwork}'
    [172.30.0.0/16]

Configuration of the Coredns Corefile or Kubernetes plugin is not supported.

dns Operator status

You can inspect the status and view the details of the dns Operator using the oc describe command.

Procedure

View the status of the dns Operator:

$ oc describe clusteroperators/dns

dns Operator logs

You can view dns Operator logs by using the oc logs command.

Procedure

View the logs of the dns Operator:

$ oc logs --namespace=openshift-dns-operator deployment/dns-operator