Skip to content

Latest commit

 

History

History
129 lines (111 loc) · 3.68 KB

nodes-nodes-garbage-collection-configuring.adoc

File metadata and controls

129 lines (111 loc) · 3.68 KB

Configuring garbage collection for containers and images

As an administrator, you can configure how {product-title} performs garbage collection by creating a kubeletConfig object for each Machine Config Pool.

Note

{product-title} supports only one kubeletConfig object for each Machine Config Pool.

You can configure any combination of the following:

  • soft eviction for containers

  • hard eviction for containers

  • eviction for images

For soft container eviction you can also configure a grace period before eviction.

Prerequisites
  1. Obtain the label associated with the static Machine Config Pool CRD for the type of node you want to configure. Perform one of the following steps:

    1. View the Machine Config Pool:

      $ oc describe machineconfigpool <name>

      For example:

      $ oc describe machineconfigpool worker
      
      apiVersion: machineconfiguration.openshift.io/v1
      kind: MachineConfigPool
      metadata:
        creationTimestamp: 2019-02-08T14:52:39Z
        generation: 1
        labels:
          custom-kubelet: small-pods (1)
      1. If a label has been added it appears under labels.

    2. If the label is not present, add a key/value pair:

      $ oc label machineconfigpool worker custom-kubelet=small-pods
Procedure
  1. Create a Custom Resource (CR) for your configuration change.

    Sample configuration for a container garbage collection CR:
    apiVersion: machineconfiguration.openshift.io/v1
    kind: KubeletConfig
    metadata:
      name: worker-kubeconfig (1)
    spec:
      machineConfigPoolSelector:
        matchLabels:
          custom-kubelet: small-pods (2)
      kubeletConfig:
        evictionSoft: (3)
        evictionSoft:
          memory.available: "500Mi" (4)
          nodefs.available: "10%"
          nodefs.inodesFree: "5%"
          imagefs.available: "15%"
          imagefs.inodesFree: "10%"
        evictionSoftGracePeriod:  (5)
          memory.available: "1m30s"
          nodefs.available: "1m30s"
          nodefs.inodesFree: "1m30s"
          imagefs.available: "1m30s"
          imagefs.inodesFree: "1m30s"
        evictionHard:
          memory.available: "200Mi"
          nodefs.available: "5%"
          nodefs.inodesFree: "4%"
          imagefs.available: "10%"
          imagefs.inodesFree: "5%"
        evictionPressureTransitionPeriod: 0s (6)
        imageMinimumGCAge: 5m (7)
        imageGCHighThresholdPercent: 80 (8)
        imageGCLowThresholdPercent: 75 (9)
    1. Name for the object.

    2. Selector label.

    3. Type of eviction: EvictionSoft and EvictionHard.

    4. Eviction thresholds based on a specific eviction trigger signal.

    5. Grace periods for the soft eviction. This parameter does not apply to eviction-hard.

    6. The duration to wait before transitioning out of an eviction pressure condition

    7. The minimum age for an unused image before the image is removed by garbage collection.

    8. The percent of disk usage (expressed as an integer) which triggers image garbage collection.

    9. The percent of disk usage (expressed as an integer) to which image garbage collection attempts to free.

  2. Create the object:

    $ oc create -f <file-name>.yaml

    For example:

    oc create -f gc-container.yaml
    
    kubeletconfig.machineconfiguration.openshift.io/gc-container created
  3. Verify that garbage collection is active. The Machine Config Pool you specified in the custom resource appears with UPDATING as 'true` until the change is fully implemented:

    $ oc get machineconfigpool
    
    NAME     CONFIG                                   UPDATED   UPDATING
    master   rendered-master-546383f80705bd5aeaba93   True      False
    worker   rendered-worker-b4c51bb33ccaae6fc4a6a5   False     True