SUSE Support

Here When You Need Us

How to check the default CoreDNS configmap of a Rancher Kubernetes Engine (RKE) Kubernetes version

This document (000020036) is provided subject to the disclaimer at the end of this document.

Situation

Task

You might have modified the default configmap for CoreDNS using Rancher Kubernetes Engine's (RKE) cluster configuration YAML (cluster.yml). In this case, you may want to know the default configmap prior to upgrading Kubernetes. This verification step will help you to add all of the default/mandatory parameters to the modified configmap in RKE's cluster.yml, upon upgrade.

Pre-requisites

  • python2

Resolution

Download the kontainer-metadata according to the Rancher version you are running.

Rancher 2.4.x:

curl -O https://raw.githubusercontent.com/rancher/kontainer-driver-metadata/release-v2.4/data/data.json

Rancher v2.5.x:

curl -O https://raw.githubusercontent.com/rancher/kontainer-driver-metadata/dev-v2.5/data/data.json

Get the available template list:

python2 -c "import sys, json; d=json.load(sys.stdin)['K8sVersionedTemplates']['coreDNS']; print json.dumps(d,indent=4)" <data.json

Output:

{
    ">=1.8.0-rancher0 <1.16.0-alpha": "coredns-v1.8",
    ">=1.17.0-alpha": "coredns-v1.17",
    ">=1.16.0-alpha <1.17.0-alpha": "coredns-v1.16"
}

Translation of one of the entry from the list is as follows:

">=1.8.0-rancher0 <1.16.0-alpha": "coredns-v1.8",

If Kubenetes version is greater than or equal to 1.8.0-rancher0 and less than 1.16.0-alpha ,then the CoreDNS key we have to use in next step is coredns-v1.8

python2 -c "import sys, json; print json.load(sys.stdin)['K8sVersionedTemplates']['templateKeys']['coredns-v1.8']" <data.json

The configmap will be printed on the screen along with other YAML template specs associated with CoreDNS.

Sample output:

[...]
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: coredns
  namespace: kube-system
  labels:
      addonmanager.kubernetes.io/mode: EnsureExists
data:
  Corefile: |
    .:53 {
        errors
        health
        kubernetes {{.ClusterDomain}} {{ if .ReverseCIDRs }}{{ .ReverseCIDRs }}{{ else }}{{ "in-addr.arpa ip6.arpa" }}{{ end }} {
          pods insecure
          upstream
          fallthrough in-addr.arpa ip6.arpa
          ttl 30
        }
        prometheus :9153
    {{- if .UpstreamNameservers }}
        forward . {{range $i, $v := .UpstreamNameservers}}{{if $i}} {{end}}{{.}}{{end}}
    {{- else }}
        forward . "/etc/resolv.conf"
    {{- end }}
        cache 30
        loop
        reload
        loadbalance
    }
---
[...]

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000020036
  • Creation Date: 06-May-2021
  • Modified Date:06-May-2021
    • SUSE Rancher

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.