This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.此内容没有您所选择的语言版本。
Chapter 4. DNS Operator in OpenShift Container Platform
The DNS Operator deploys and manages CoreDNS to provide a name resolution service to pods, enabling DNS-based Kubernetes Service discovery in OpenShift.
4.1. 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.
Use the
oc getcommand to view the Deployment status:oc get -n openshift-dns-operator deployment/dns-operator
$ oc get -n openshift-dns-operator deployment/dns-operator NAME READY UP-TO-DATE AVAILABLE AGE dns-operator 1/1 1 1 23hCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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.
Use the
oc getcommand to view the state of the DNS Operator:oc get clusteroperator/dns
$ oc get clusteroperator/dns NAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE dns 4.1.0-0.11 True False False 92mCopy to Clipboard Copied! Toggle word wrap Toggle overflow AVAILABLE,PROGRESSINGandDEGRADEDprovide information about the status of the operator.AVAILABLEisTruewhen at least 1 pod from the CoreDNS DaemonSet is reporting anAvailablestatus condition.
4.2. 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
Use the
oc describecommand to view the defaultdns:Copy to Clipboard Copied! Toggle word wrap Toggle overflow To find the Service CIDR of your cluster, use the
oc getcommand:oc get networks.config/cluster -o jsonpath='{$.status.serviceNetwork}'$ oc get networks.config/cluster -o jsonpath='{$.status.serviceNetwork}' [172.30.0.0/16]Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Configuration of the CoreDNS Corefile or Kubernetes plugin is not supported.
4.3. 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
$ oc describe clusteroperators/dns
4.4. 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
$ oc logs --namespace=openshift-dns-operator deployment/dns-operator