Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
#below command opens the file for editing. Edit and save the file to get the "configmap coredns edited" response.
# Notice the A record for sdnc: "sdnc         IN  A  10.147.99.140" is commented out by appending ;; to the line (\n;;sdnc         IN  A  10.147.99.140\n)
# Notice the A record for sdnc: "sdnc         IN  A  10.147.101.23" is uncommented out by removing;; from the line (\nsdnc\t\t    IN A   10.147.101.23)
root@kubefed-1:~# kubectl edit configmap coredns -n kube-system -oyaml
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
  Corefile: |
    .:53 {
        errors
        log
        health
        kubernetes cluster.local 10.96.0.0/12 {
           pods insecure
        }
        file /dockerdata-nfs/zone.db example.com
        prometheus
        proxy . /etc/resolv.conf
        cache 30
    }
  zone.db: "$ORIGIN example.com.     ; designates the start of this zone file in the
    namespace\n$TTL 1h         ; default expiration time of all resource records without
    their own TTL value\nexample.com.  IN  SOA   ns.example.com. username.example.com.
    ( 2007120710 1d 2h 4w 1h )\nexample.com.  IN  NS    ns                    ; ns.example.com
    is a nameserver for example.com\nexample.com.  IN  NS    ns.somewhere.example.
    ; ns.somewhere.example is a backup nameserver for example.com\nexample.com.  IN
    \ A     10.147.101.135             ; IPv4 address for example.com\nns            IN
    \ A     10.247.5.11             ; IPv4 address for ns.example.com\nwww           IN
    \ CNAME example.com.          ; www.example.com is an alias for example.com\nwwwtest
    \      IN  CNAME www              ; wwwtest.example.com is another alias for www.example.com\nsdnc.example.com.
    \   IN      SRV    30202 10 10 example.com.\n;;site1\n;;sdnc         IN  A  10.147.99.140\n;;site2\nsdnc\t\t
    IN A   10.147.101.23"
kind: ConfigMap
metadata:
  creationTimestamp: 2018-02-28T20:13:03Z
  name: coredns
  namespace: kube-system
  resourceVersion: "102077"
  selfLink: /api/v1/namespaces/kube-system/configmaps/coredns
  uid: c8489771-1cc3-11e8-a0cb-fa163eabcb60

configmap "coredns" edited


     4. Send Note that there is a cache time configured in config map. Wait for some time (30s or so) and then send signal to refresh the settings for coreDNS.

...