mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Merge pull request #25372 from derekwaynecarr/more-eviction-flags
Automatic merge from submit-queue Add eviction-pressure-transitition-period flag to kubelet This PR does the following: * add the new flag to control how often a node will go out of memory pressure or disk pressure conditions see: https://github.com/kubernetes/kubernetes/pull/25282 * pass an `eviction.Config` into `kubelet` so we can group config /cc @vishh
This commit is contained in:
commit
17345bf857
@ -237,6 +237,7 @@ func startComponents(firstManifestURL, secondManifestURL string) (string, string
|
||||
3*time.Second, /* NodeStatusUpdateFrequency */
|
||||
10*time.Second, /* SyncFrequency */
|
||||
10*time.Second, /* OutOfDiskTransitionFrequency */
|
||||
10*time.Second, /* EvictionPressureTransitionPeriod */
|
||||
40, /* MaxPods */
|
||||
cm, net.ParseIP("127.0.0.1"))
|
||||
|
||||
@ -269,8 +270,8 @@ func startComponents(firstManifestURL, secondManifestURL string) (string, string
|
||||
3*time.Second, /* NodeStatusUpdateFrequency */
|
||||
10*time.Second, /* SyncFrequency */
|
||||
10*time.Second, /* OutOfDiskTransitionFrequency */
|
||||
|
||||
40, /* MaxPods */
|
||||
10*time.Second, /* EvictionPressureTransitionPeriod */
|
||||
40, /* MaxPods */
|
||||
cm,
|
||||
net.ParseIP("127.0.0.1"))
|
||||
|
||||
|
@ -117,30 +117,31 @@ func NewKubeletServer() *KubeletServer {
|
||||
OOMScoreAdj: int32(qos.KubeletOOMScoreAdj),
|
||||
LockFilePath: "",
|
||||
PodInfraContainerImage: GetDefaultPodInfraContainerImage(),
|
||||
Port: ports.KubeletPort,
|
||||
ReadOnlyPort: ports.KubeletReadOnlyPort,
|
||||
RegisterNode: true, // will be ignored if no apiserver is configured
|
||||
RegisterSchedulable: true,
|
||||
RegistryBurst: 10,
|
||||
RegistryPullQPS: 5.0,
|
||||
KubeletCgroups: "",
|
||||
ResolverConfig: kubetypes.ResolvConfDefault,
|
||||
RktPath: "",
|
||||
RktAPIEndpoint: rkt.DefaultRktAPIServiceEndpoint,
|
||||
RktStage1Image: "",
|
||||
RootDirectory: defaultRootDir,
|
||||
RuntimeCgroups: "",
|
||||
SerializeImagePulls: true,
|
||||
StreamingConnectionIdleTimeout: unversioned.Duration{Duration: 4 * time.Hour},
|
||||
SyncFrequency: unversioned.Duration{Duration: 1 * time.Minute},
|
||||
SystemCgroups: "",
|
||||
ReconcileCIDR: true,
|
||||
KubeAPIQPS: 5.0,
|
||||
KubeAPIBurst: 10,
|
||||
ExperimentalFlannelOverlay: experimentalFlannelOverlay,
|
||||
OutOfDiskTransitionFrequency: unversioned.Duration{Duration: 5 * time.Minute},
|
||||
HairpinMode: componentconfig.PromiscuousBridge,
|
||||
BabysitDaemons: false,
|
||||
Port: ports.KubeletPort,
|
||||
ReadOnlyPort: ports.KubeletReadOnlyPort,
|
||||
RegisterNode: true, // will be ignored if no apiserver is configured
|
||||
RegisterSchedulable: true,
|
||||
RegistryBurst: 10,
|
||||
RegistryPullQPS: 5.0,
|
||||
KubeletCgroups: "",
|
||||
ResolverConfig: kubetypes.ResolvConfDefault,
|
||||
RktPath: "",
|
||||
RktAPIEndpoint: rkt.DefaultRktAPIServiceEndpoint,
|
||||
RktStage1Image: "",
|
||||
RootDirectory: defaultRootDir,
|
||||
RuntimeCgroups: "",
|
||||
SerializeImagePulls: true,
|
||||
StreamingConnectionIdleTimeout: unversioned.Duration{Duration: 4 * time.Hour},
|
||||
SyncFrequency: unversioned.Duration{Duration: 1 * time.Minute},
|
||||
SystemCgroups: "",
|
||||
ReconcileCIDR: true,
|
||||
KubeAPIQPS: 5.0,
|
||||
KubeAPIBurst: 10,
|
||||
ExperimentalFlannelOverlay: experimentalFlannelOverlay,
|
||||
OutOfDiskTransitionFrequency: unversioned.Duration{Duration: 5 * time.Minute},
|
||||
HairpinMode: componentconfig.PromiscuousBridge,
|
||||
BabysitDaemons: false,
|
||||
EvictionPressureTransitionPeriod: unversioned.Duration{Duration: 5 * time.Minute},
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -255,4 +256,5 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.StringVar(&s.EvictionHard, "eviction-hard", s.EvictionHard, "A set of eviction thresholds (e.g. memory.available<1Gi) that if met would trigger a pod eviction.")
|
||||
fs.StringVar(&s.EvictionSoft, "eviction-soft", s.EvictionSoft, "A set of eviction thresholds (e.g. memory.available<1.5Gi) that if met over a corresponding grace period would trigger a pod eviction.")
|
||||
fs.StringVar(&s.EvictionSoftGracePeriod, "eviction-soft-grace-period", s.EvictionSoftGracePeriod, "A set of eviction grace periods (e.g. memory.available=1m30s) that correspond to how long a soft eviction threshold must hold before triggering a pod eviction.")
|
||||
fs.DurationVar(&s.EvictionPressureTransitionPeriod.Duration, "eviction-pressure-transition-period", s.EvictionPressureTransitionPeriod.Duration, "Duration for which the kubelet has to wait before transitioning out of an eviction pressure condition.")
|
||||
}
|
||||
|
@ -188,6 +188,10 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
evictionConfig := eviction.Config{
|
||||
PressureTransitionPeriod: s.EvictionPressureTransitionPeriod.Duration,
|
||||
Thresholds: thresholds,
|
||||
}
|
||||
|
||||
return &KubeletConfig{
|
||||
Address: net.ParseIP(s.Address),
|
||||
@ -267,8 +271,8 @@ func UnsecuredKubeletConfig(s *options.KubeletServer) (*KubeletConfig, error) {
|
||||
HairpinMode: s.HairpinMode,
|
||||
BabysitDaemons: s.BabysitDaemons,
|
||||
ExperimentalFlannelOverlay: s.ExperimentalFlannelOverlay,
|
||||
NodeIP: net.ParseIP(s.NodeIP),
|
||||
Thresholds: thresholds,
|
||||
NodeIP: net.ParseIP(s.NodeIP),
|
||||
EvictionConfig: evictionConfig,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -513,7 +517,7 @@ func SimpleKubelet(client *clientset.Clientset,
|
||||
configFilePath string,
|
||||
cloud cloudprovider.Interface,
|
||||
osInterface kubecontainer.OSInterface,
|
||||
fileCheckFrequency, httpCheckFrequency, minimumGCAge, nodeStatusUpdateFrequency, syncFrequency, outOfDiskTransitionFrequency time.Duration,
|
||||
fileCheckFrequency, httpCheckFrequency, minimumGCAge, nodeStatusUpdateFrequency, syncFrequency, outOfDiskTransitionFrequency, evictionPressureTransitionPeriod time.Duration,
|
||||
maxPods int,
|
||||
containerManager cm.ContainerManager, clusterDNS net.IP) *KubeletConfig {
|
||||
imageGCPolicy := kubelet.ImageGCPolicy{
|
||||
@ -524,7 +528,9 @@ func SimpleKubelet(client *clientset.Clientset,
|
||||
DockerFreeDiskMB: 256,
|
||||
RootFreeDiskMB: 256,
|
||||
}
|
||||
|
||||
evictionConfig := eviction.Config{
|
||||
PressureTransitionPeriod: evictionPressureTransitionPeriod,
|
||||
}
|
||||
kcfg := KubeletConfig{
|
||||
Address: net.ParseIP(address),
|
||||
CAdvisorInterface: cadvisorInterface,
|
||||
@ -582,6 +588,7 @@ func SimpleKubelet(client *clientset.Clientset,
|
||||
VolumePlugins: volumePlugins,
|
||||
Writer: &io.StdWriter{},
|
||||
OutOfDiskTransitionFrequency: outOfDiskTransitionFrequency,
|
||||
EvictionConfig: evictionConfig,
|
||||
}
|
||||
return &kcfg
|
||||
}
|
||||
@ -783,7 +790,7 @@ type KubeletConfig struct {
|
||||
Writer io.Writer
|
||||
VolumePlugins []volume.VolumePlugin
|
||||
OutOfDiskTransitionFrequency time.Duration
|
||||
Thresholds []eviction.Threshold
|
||||
EvictionConfig eviction.Config
|
||||
|
||||
ExperimentalFlannelOverlay bool
|
||||
NodeIP net.IP
|
||||
@ -880,7 +887,7 @@ func CreateAndInitKubelet(kc *KubeletConfig) (k KubeletBootstrap, pc *config.Pod
|
||||
kc.ContainerRuntimeOptions,
|
||||
kc.HairpinMode,
|
||||
kc.BabysitDaemons,
|
||||
kc.Thresholds,
|
||||
kc.EvictionConfig,
|
||||
kc.Options,
|
||||
)
|
||||
|
||||
|
@ -88,6 +88,7 @@ kubelet
|
||||
--event-burst=10: Maximum size of a bursty event records, temporarily allows event records to burst to this number, while still not exceeding event-qps. Only used if --event-qps > 0
|
||||
--event-qps=5: If > 0, limit event creations per second to this value. If 0, unlimited.
|
||||
--eviction-hard="": A set of eviction thresholds (e.g. memory.available<1Gi) that if met would trigger a pod eviction.
|
||||
--eviction-pressure-transition-period=5m0s: Duration for which the kubelet has to wait before transitioning out of an eviction pressure condition.
|
||||
--eviction-soft="": A set of eviction thresholds (e.g. memory.available<1.5Gi) that if met over a corresponding grace period would trigger a pod eviction.
|
||||
--eviction-soft-grace-period="": A set of eviction grace periods (e.g. memory.available=1m30s) that correspond to how long a soft eviction threshold must hold before triggering a pod eviction.
|
||||
--experimental-flannel-overlay[=false]: Experimental support for starting the kubelet with the default overlay network (flannel). Assumes flanneld is already running in client mode. [default=false]
|
||||
@ -157,7 +158,7 @@ kubelet
|
||||
--volume-stats-agg-period=1m0s: Specifies interval for kubelet to calculate and cache the volume disk usage for all pods and volumes. To disable volume calculations, set to 0. Default: '1m'
|
||||
```
|
||||
|
||||
###### Auto generated by spf13/cobra on 3-May-2016
|
||||
###### Auto generated by spf13/cobra on 10-May-2016
|
||||
|
||||
|
||||
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
|
||||
|
@ -121,6 +121,7 @@ event-ttl
|
||||
eviction-hard
|
||||
eviction-soft
|
||||
eviction-soft-grace-period
|
||||
eviction-pressure-transition-period
|
||||
executor-bindall
|
||||
executor-logv
|
||||
executor-path
|
||||
|
@ -308,6 +308,9 @@ func DeepCopy_componentconfig_KubeletConfiguration(in KubeletConfiguration, out
|
||||
out.EvictionHard = in.EvictionHard
|
||||
out.EvictionSoft = in.EvictionSoft
|
||||
out.EvictionSoftGracePeriod = in.EvictionSoftGracePeriod
|
||||
if err := unversioned.DeepCopy_unversioned_Duration(in.EvictionPressureTransitionPeriod, &out.EvictionPressureTransitionPeriod, c); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -349,6 +349,8 @@ type KubeletConfiguration struct {
|
||||
EvictionSoft string `json:"evictionSoft,omitempty"`
|
||||
// Comma-delimeted list of grace periods for each soft eviction signal. For example, 'memory.available=30s'.
|
||||
EvictionSoftGracePeriod string `json:"evictionSoftGracePeriod,omitempty"`
|
||||
// Duration for which the kubelet has to wait before transitioning out of an eviction pressure condition.
|
||||
EvictionPressureTransitionPeriod unversioned.Duration `json:"evictionPressureTransitionPeriod,omitempty"`
|
||||
}
|
||||
|
||||
type KubeSchedulerConfiguration struct {
|
||||
|
@ -39,6 +39,14 @@ const (
|
||||
OpLessThan ThresholdOperator = "LessThan"
|
||||
)
|
||||
|
||||
// Config holds information about how eviction is configured.
|
||||
type Config struct {
|
||||
// PressureTransitionPeriod is duration the kubelet has to wait before transititioning out of a pressure condition.
|
||||
PressureTransitionPeriod time.Duration
|
||||
// Thresholds define the set of conditions monitored to trigger eviction.
|
||||
Thresholds []Threshold
|
||||
}
|
||||
|
||||
// Threshold defines a metric for when eviction should occur.
|
||||
type Threshold struct {
|
||||
// Signal defines the entity that was measured.
|
||||
|
@ -223,7 +223,7 @@ func NewMainKubelet(
|
||||
containerRuntimeOptions []kubecontainer.Option,
|
||||
hairpinMode string,
|
||||
babysitDaemons bool,
|
||||
thresholds []eviction.Threshold,
|
||||
evictionConfig eviction.Config,
|
||||
kubeOptions []Option,
|
||||
) (*Kubelet, error) {
|
||||
if rootDirectory == "" {
|
||||
|
@ -72,6 +72,7 @@ func NewHollowKubelet(
|
||||
10*time.Second, /* NodeStatusUpdateFrequency */
|
||||
10*time.Second, /* SyncFrequency */
|
||||
5*time.Minute, /* OutOfDiskTransitionFrequency */
|
||||
5*time.Minute, /* EvictionPressureTransitionPeriod */
|
||||
maxPods,
|
||||
containerManager,
|
||||
nil,
|
||||
|
Loading…
Reference in New Issue
Block a user