Disable MachineHealthCheck persistently
search cancel

Disable MachineHealthCheck persistently

book

Article ID: 445235

calendar_today

Updated On:

Products

VMware Tanzu Kubernetes Grid Management

Issue/Introduction

Manually deleting MachineHealthCheck (MHC) resources from a TKG cluster results in Cluster API (CAPI) controllers automatically recreating them.

Environment

TKG 2.5.4

Cause

Cluster API (CAPI) controllers actively reconcile cluster state based on the parent cluster resource topology. Manual deletion of child MHC objects is overridden by the parent topology specification where MHC is enabled by default or previously configured.

Resolution

  1. Edit the parent cluster resource using the following command:

    kubectl edit cluster -n <namespace> <name>
     
  2. To disable MHC for the control plane, add or modify the following configuration under spec.topology.controlPlane:

    spec:
      topology:
        controlPlane:
          machineHealthCheck:
            enable: false
     
  3. To disable MHC for worker node deployments, add or modify the following configuration under spec.topology.workers.machineDeployments:

    spec:
      topology:
        workers:
          machineDeployments:
          - name: md01
            machineHealthCheck:
              enable: false
     
  4. Save the configuration and exit the editor.

Additional Information

Modifying the cluster resource updates the desired state within the CAPI topology. Post-modification, CAPI controllers will successfully reconcile the new desired state (enable: false) and automatically remove the associated MachineHealthCheck child resources persistently.