kubernetesopenshiftkubernetes-podopenshift-originopenshift-enterprise

Update node condition type in status


I am trying to patch, clear Node conditions in OpenShift and/or Kubernetes cluster on a worker node. Patch isn't working, trying even workarounds, maybe update the key in etcd.

Main problem that i created new node conditions and then i removed them but they are not removed from list although they are no longer there or being updated by the controller.

$ oc describe node node1.example.com

Conditions:                 
  Type             Status  LastHeartbeatTime                 LastTransitionTime                Reason                       Message
  ----             ------  -----------------                 ------------------                ------                       -------
  ExampleToRemove        False   Wed, 13 Feb 2019 15:09:42 -0500   Wed, 13 Feb 2019 11:05:57 -0500   KubeletHasSufficientDisk     kubelet has sufficient disk space available
  MemoryPressure   False   Wed, 13 Feb 2019 15:09:42 -0500   Wed, 13 Feb 2019 11:05:57 -0500   KubeletHasSufficientMemory   kubelet has sufficient memory available
  DiskPressure     False   Wed, 13 Feb 2019 15:09:42 -0500   Wed, 13 Feb 2019 11:05:57 -0500   KubeletHasNoDiskPressure     kubelet has no disk pressure
  PIDPressure      False   Wed, 13 Feb 2019 15:09:42 -0500   Wed, 13 Feb 2019 11:05:57 -0500   KubeletHasSufficientPID      kubelet has sufficient PID available
  Ready            True    Wed, 13 Feb 2019 15:09:42 -0500

Solution

  • Posting answer from comment as Community Wiki.

    I found the fix, you can edit whatever you want in the node description by updating the etcd key /kubernetes.io/minions/<node-name>

    Edit: Finally I found a way to patch and update the Node condition type status, add new or even delete

    Example:

    curl -k -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json-patch+json" -X PATCH https://APISERVER:6443/api/v1/nodes/NAME-OF-NODE-Update-Condition/status --data '[{ "op": "remove", "path": "/status/conditions/2"}]'
    

    Note: each condition has an index number, so try to know what is the index number and then target it in /status/condition/