Set kubernetes controller-manager "terminated-pod-gc-threshold" flag to a lower value

9/19/2019

I like to change the Kubernetes control manager --terminated-pod-gc-threshold value from the default 12500 pods to a lower value (Like 100 or 50) in my kubernetes cluster. Setting this flag to a small one will cause any issues ? Why kubernetes itself set it to a very high value by default. Is that purposefully set ?

Also is there any way we can find/calculate this value required for a cluster ?

Any help appreciated.

-- Jyothish Kumar S
kubernetes

1 Answer

9/19/2019

Yes, there is an appropriate Issue #78693 and PR #79047

Changed the default terminated-pod-gc-threshold to 500 by hpandeycodeit · Pull Request #79047 · kubernetes/kubernetes

// run it in your wrapper struct of this type in its \`SetDefaults_\` method.
func RecommendedDefaultPodGCControllerConfiguration(obj *kubectrlmgrconfigv1alpha1.PodGCControllerConfiguration) { 
  if obj.TerminatedPodGCThreshold == 0 { 
    obj.TerminatedPodGCThreshold = 500 
  } 
}

PR is not accepted yet.

-- Yasen
Source: StackOverflow