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 get
command to view the Deployment status:oc get -n openshift-dns-operator deployment/dns-operator
$ oc get -n openshift-dns-operator deployment/dns-operator
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME READY UP-TO-DATE AVAILABLE AGE dns-operator 1/1 1 1 23h
NAME READY UP-TO-DATE AVAILABLE AGE dns-operator 1/1 1 1 23h
Copy 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 get
command to view the state of the DNS Operator:oc get clusteroperator/dns
$ oc get clusteroperator/dns
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE dns 4.1.0-0.11 True False False 92m
NAME VERSION AVAILABLE PROGRESSING DEGRADED SINCE dns 4.1.0-0.11 True False False 92m
Copy to Clipboard Copied! Toggle word wrap Toggle overflow AVAILABLE
,PROGRESSING
andDEGRADED
provide information about the status of the operator.AVAILABLE
isTrue
when at least 1 pod from the CoreDNS DaemonSet is reporting anAvailable
status condition.
4.2. View the default DNS 링크 복사링크가 클립보드에 복사되었습니다!
Every new OpenShift Container Platform installation has a dns.operator
named default
.
Procedure
Use the
oc describe
command to view the defaultdns
:oc describe dns.operator/default
$ oc describe dns.operator/default
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To find the Service CIDR of your cluster, use the
oc get
command:oc get networks.config/cluster -o jsonpath='{$.status.serviceNetwork}'
$ oc get networks.config/cluster -o jsonpath='{$.status.serviceNetwork}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Example output
[172.30.0.0/16]
[172.30.0.0/16]
4.3. Using DNS forwarding 링크 복사링크가 클립보드에 복사되었습니다!
You can use DNS forwarding to override the forwarding configuration identified in etc/resolv.conf
on a per-zone basis by specifying which name server should be used for a given zone.
Procedure
Modify the DNS Operator object named
default
:oc edit dns.operator/default
$ oc edit dns.operator/default
Copy to Clipboard Copied! Toggle word wrap Toggle overflow This allows the Operator to create and update the ConfigMap named
dns-default
with additional server configuration blocks based onServer
. If none of the servers has a zone that matches the query, then name resolution falls back to the name servers that are specified in/etc/resolv.conf
.Sample DNS
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf
servers
is undefined or invalid, the ConfigMap only contains the default server.View the ConfigMap:
oc get configmap/dns-default -n openshift-dns -o yaml
$ oc get configmap/dns-default -n openshift-dns -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Sample DNS ConfigMap based on previous sample DNS
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Changes to the
forwardPlugin
triggers a rolling update of the CoreDNS DaemonSet.
Additional resources
- For more information on DNS forwarding, see the CoreDNS forward documentation.
4.4. 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.5. 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 -n openshift-dns-operator deployment/dns-operator -c dns-operator
$ oc logs -n openshift-dns-operator deployment/dns-operator -c dns-operator