Files
doc-exports/docs/cce/umn/cce_10_0493.html
qiujiandong1 ab1e53a279 CCE UMN 20251031 version
Reviewed-by: Gergo-Bence Lorincz <a200452876@noreply.gitea.eco.tsi-dev.otc-service.com>
Co-authored-by: qiujiandong1 <qiujiandong1@huawei.com>
Co-committed-by: qiujiandong1 <qiujiandong1@huawei.com>
2026-01-15 10:25:22 +00:00

5.6 KiB

CoreDNS Configuration Consistency

Check Items

Check whether the current CoreDNS key configuration Corefile is different from that in the Helm release record. The difference may be overwritten during the add-on upgrade, affecting domain name resolution in the cluster.

Solutions

You can upgrade CoreDNS separately after confirming the configuration difference.

  1. Configure the kubectl command. For details, see Accessing a Cluster Using kubectl.
  2. Obtain the Corefile that takes effect currently.

    kubectl get cm -nkube-system coredns -o jsonpath='{.data.Corefile}' > corefile_now.txt
    cat corefile_now.txt

  3. Obtain the Corefile in the Helm Release record.

    latest_release=`kubectl get secret -nkube-system -l owner=helm -l name=cceaddon-coredns --sort-by=.metadata.creationTimestamp | awk 'END{print $1}'`
    kubectl get secret -nkube-system $latest_release -o jsonpath='{.data.release}' | base64 -d | base64 -d | gzip -d | python -m json.tool | python -c "
    from __future__ import print_function
    import json,sys,re,yaml;
    manifests = json.load(sys.stdin)['manifest']
    files = re.split('(?:^|\s*\n)---\s*',manifests)
    for file in files:
        if 'coredns/templates/configmap.yaml' in file and 'Corefile' in file:
          corefile = yaml.safe_load(file)['data']['Corefile']
          print(corefile,end='')
          exit(0);
    print('error')
    exit(1);
    " > corefile_record.txt
    cat corefile_record.txt

  4. Compare the output between 2 and 3.

    diff corefile_now.txt corefile_record.txt -y;
    Figure 1 Viewing output differences

  5. Return to the CCE console and click the cluster name to access the cluster console. Choose Add-ons in the navigation pane, select CoreDNS, and click Upgrade.

    To retain custom configurations, use either of the following methods:
    • (Recommended) Set parameterSyncStrategy to inherit. In this case, custom settings are automatically inherited. The system automatically parses, identifies, and inherits custom parameters.

      After the automatic inheritance of parameter settings (parameterSyncStrategy=inherit) is enabled, stub domain settings will be cleared and merged into the extended parameter settings. The original stub domain settings remain unchanged and can still be viewed under Extended Parameter Settings.

    • Set parameterSyncStrategy to force. Manually enter the differential configuration. For details, see CoreDNS.

  6. Click OK. After the add-on upgrade is complete, check whether all CoreDNS pods are available and whether Corefile meets the expectation.

    kubectl get cm -nkube-system coredns -o jsonpath='{.data.Corefile}'

  7. Change the value of parameterSyncStrategy to ensureConsistent to enable configuration consistency verification.

    In addition, it is a good practice to use the parameter configuration function of CCE add-ons to modify the Corefile configuration for consistency.