Commit Graph

108 Commits

Author SHA1 Message Date
Shintaro Murakami
fe7a862c2d Unify determination of whether a volume is ephemeral 2021-03-05 14:49:09 +09:00
JunYang
af0b4c9031 Structured Logging migration: modify eviction part logs of kubelet.
Signed-off-by: JunYang <yang.jun22@zte.com.cn>
2021-02-21 08:36:14 +08:00
shawnhanx
fa8d07d3e1
Apply suggestions from code review
Co-authored-by: bl-ue <54780737+bl-ue@users.noreply.github.com>
2021-02-07 09:23:07 +08:00
shawnhanx
0bee739a2f Change the upper limit of threshold from 10000% to 100% 2021-02-03 21:55:49 +08:00
Joel Smith
29ff2fe528 Remove now-unused eviction helpers, fix unit test TestCRIListPodStats 2020-12-03 13:04:25 -07:00
Joel Smith
39a11744ce Partially revert "Include pod /etc/hosts in ephemeral storage calculation for eviction"
This reverts (most of) commit f34b586d01.
2020-12-03 04:47:16 -07:00
Masashi Honma
4c12900643 kube-eviction: Fix SI of process quantity
Use DecimalSI instead of BinarySI because process count is decimal.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
2020-10-13 18:24:43 +09:00
Jan Chaloupka
274c536da3 Removing GetPodPriority from pkg/api and importing PodPriority from k8s.io/component-helpers 2020-10-11 21:40:11 +02:00
Marek Siarkowicz
7d309e0104 Move Kubelet Summary API to staging repo 2020-09-22 18:23:28 +02:00
Joel Smith
f34b586d01 Include pod /etc/hosts in ephemeral storage calculation for eviction 2020-07-08 12:58:11 -06:00
kadisi
a75323c76b fix unexpected append mutations about pkg/kubelet package
Signed-off-by: kadisi <iamkadisi@163.com>
Co-authored-by: Dr. Stefan Schimanski <stefan.schimanski@gmail.com>
2020-06-03 13:36:57 +08:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
louisgong
0efb70c0a2 eviction by process number 2020-03-24 09:25:04 +08:00
yuxiaobo
81e9f21f83 Correct spelling mistakes
Signed-off-by: yuxiaobo <yuxiaobogo@163.com>
2019-11-06 20:25:19 +08:00
Harsh Singh
6a9ef7f04f Move GetPodPriority from /scheduler/util to /api/pod 2019-09-24 22:02:13 +05:30
Eric Ernst
476c1c7a2b kube-eviction: use common resource summation functions
Utilize resource helpers' GetResourceRequestQuantity instead of
duplicating the logic here.

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
2019-08-13 16:23:28 -07:00
draveness
ca6003bc75 feat: cleanup PodPriority features gate 2019-06-23 11:57:24 +08:00
Kubernetes Prow Robot
145232c1a0
Merge pull request #78673 from tedyu/threshold-min-reclaim
Remove inner loop for finding MinReclaim in ParseThresholdConfig
2019-06-14 13:27:02 -07:00
Ted Yu
f7d9e037d9 Remove inner loop for finding MinReclaim in ParseThresholdConfig 2019-06-03 19:20:19 -07:00
Ted Yu
19c91a59ab Iterate through thresholds in managerImpl#synchronize 2019-06-03 13:16:09 -07:00
Robert Krawitz
f8661d6240 Use xfs_quota command to apply quotas 2019-05-29 15:12:28 -04:00
Robert Krawitz
448e0c44c6 Apply quotas via syscalls using cgo. 2019-05-29 15:12:28 -04:00
Davanum Srinivas
7b8c9acc09
remove unused code
Change-Id: If821920ec8872e326b7d85437ad8d2620807799d
2019-04-19 08:36:31 -04:00
David Ashpole
8b440c6424 Fix PidPressure, make it evict by priority, and add fork-bomb node e2e test 2019-01-14 09:41:36 -08:00
Kubernetes Prow Robot
33a37702a6
Merge pull request #64280 from dashpole/eviction_pod_metrics
Use memory metrics from the pod cgroup for eviction ranking
2018-12-04 08:26:03 -08:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
David Ashpole
b7deb6d9e0 fix eviction event formatting 2018-06-11 11:38:00 -07:00
David Ashpole
93b6d026d9 fix memcg fd leak 2018-06-11 11:37:50 -07:00
David Ashpole
2be67e7dde use memory metrics from the pod cgroup for eviction ranking 2018-05-24 10:59:53 -07:00
David Ashpole
fd1f19fc42 add metadata to kubelet eviction event annotations 2018-05-23 16:12:54 -07:00
David Ashpole
a5df208866 eviction test ensures failed pods are evicted 2018-05-08 16:08:35 -07:00
David Ashpole
db99c20a9a cleanup eviction events 2018-05-04 11:02:25 -07:00
David Ashpole
39d9fa60e8 refresh eviction interval periodically 2018-03-06 15:14:05 -08:00
David Ashpole
960856f4e8 collect metrics on the /kubepods cgroup on-demand 2018-02-17 12:32:40 -08:00
Kubernetes Submit Queue
270ed995f4
Merge pull request #59841 from dashpole/metrics_after_reclaim
Automatic merge from submit-queue (batch tested with PRs 59683, 59964, 59841, 59936, 59686). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Reevaluate eviction thresholds after reclaim functions

**What this PR does / why we need it**:
When the node comes under `DiskPressure` due to inodes or disk space, the eviction manager runs garbage collection functions to clean up dead containers and unused images.
Currently, we use the strategy of trying to measure the disk space and inodes freed by garbage collection.  However, as #46789 and #56573 point out, there are gaps in the implementation that can cause extra evictions even when they are not required.  Furthermore, for nodes which frequently cycle through images, it results in a large number of evictions, as running out of inodes always causes an eviction.

This PR changes this strategy to call the garbage collection functions and ignore the results.  Then, it triggers another collection of node-level metrics, and sees if the node is still under DiskPressure.
This way, we can simply observe the decrease in disk or inode usage, rather than trying to measure how much is freed.

**Which issue(s) this PR fixes**:
Fixes #46789
Fixes #56573
Related PR #56575

**Special notes for your reviewer**:
This will look cleaner after #57802  removes arguments from [makeSignalObservations](https://github.com/kubernetes/kubernetes/pull/57802/files#diff-9e5246d8c78d50ce4ba440f98663f3e9R719).

**Release note**:
```release-note
NONE
```

/sig node
/kind bug
/priority important-soon
cc @kubernetes/sig-node-pr-reviews
2018-02-16 16:31:33 -08:00
Kubernetes Submit Queue
eac5bc0035
Merge pull request #57136 from k82cn/k8s_54313
Automatic merge from submit-queue (batch tested with PRs 57136, 59920). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Updated PID pressure node condition.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
part of #54313 

**Release note**:

```release-note
Updated PID pressure node condition
```
2018-02-16 10:35:33 -08:00
David Ashpole
e0830d0b71 reevaluate eviction thresholds after reclaim functions 2018-02-16 08:35:24 -08:00
Michael Taufen
21dbbe14f2 Ignore 0% and 100% eviction thresholds
Primarily, this gives a way to explicitly disable eviction, which is
necessary to use omitempty on EvictionHard.
See: https://github.com/kubernetes/kubernetes/pull/53833#discussion_r166672137

As justification for this approach, neither 0% nor 100% make sense as
eviction thresholds; in the "less-than" case, you can't have less than
0% of a resource and 100% perpetually evicts; in the
"greater-than" case (assuming we ever add a resource with this
semantic), the reasoning is the reverse (not more than 100%, 0%
perpetually evicts).
2018-02-12 14:13:00 -08:00
Lantao Liu
91cbf93b90 Remove unnecessary summary api call.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-02-08 22:57:30 +00:00
Yassine TIJANI
ed8e75a15c fixing array out of bound by checking initContainers instead of containers 2018-01-25 09:58:51 +01:00
Da K. Ma
9a78753144 Updated PID pressure node condition.
Signed-off-by: Da K. Ma <madaxa@cn.ibm.com>
2018-01-14 18:26:00 +08:00
David Ashpole
f6721480f4 enable on-demand metrics for eviction 2018-01-08 10:20:02 -08:00
Jonathan Basseri
30b89d830b Move scheduler code out of plugin directory.
This moves plugin/pkg/scheduler to pkg/scheduler and
plugin/cmd/kube-scheduler to cmd/kube-scheduler.

Bulk of the work was done with gomvpkg, except for kube-scheduler main
package.
2018-01-05 15:05:01 -08:00
xiangpengzhao
1f2262e6b0 Move some kubelet constants to a common place. 2017-12-01 11:24:04 +08:00
David Ashpole
8b3bd5ae60 take disk requests into account during evictions 2017-11-21 10:21:30 -08:00
David Ashpole
527611ee41 remove disk allocatable evictions 2017-11-18 10:34:59 -08:00
Michael Taufen
1085b6f730 Lift embedded structure out of eviction-related KubeletConfiguration fields
- Changes the following KubeletConfiguration fields from `string` to
`map[string]string`:
  - `EvictionHard`
  - `EvictionSoft`
  - `EvictionSoftGracePeriod`
  - `EvictionMinimumReclaim`
- Adds flag parsing shims to maintain Kubelet's public flags API, while
enabling structured input in the file API.
- Also removes `kubeletconfig.ConfigurationMap`, which was an ad-hoc flag
parsing shim living in the kubeletconfig API group, and replaces it
with the `MapStringString` shim introduced in this PR. Flag parsing
shims belong in a common place, not in the kubeletconfig API.
I manually audited these to ensure that this wouldn't cause errors
parsing the command line for syntax that would have previously been
error free (`kubeletconfig.ConfigurationMap` was unique in that it
allowed keys to be provided on the CLI without values. I believe this was
done in `flags.ConfigurationMap` to facilitate the `--node-labels` flag,
which rightfully accepts value-free keys, and that this shim was then
just copied to `kubeletconfig`). Fortunately, the affected fields
(`ExperimentalQOSReserved`, `SystemReserved`, and `KubeReserved`) expect
non-empty strings in the values of the map, and as a result passing the
empty string is already an error. Thus requiring keys shouldn't break
anyone's scripts.
- Updates code and tests accordingly.

Regarding eviction operators, directionality is already implicit in the
signal type (for a given signal, the decision to evict will be made when
crossing the threshold from either above or below, never both). There is
no need to expose an operator, such as `<`, in the API. By changing
`EvictionHard` and `EvictionSoft` to `map[string]string`, this PR
simplifies the experience of working with these fields via the
`KubeletConfiguration` type. Again, flags stay the same.

Other things:
- There is another flag parsing shim, `flags.ConfigurationMap`, from the
shared flag utility. The `NodeLabels` field still uses
`flags.ConfigurationMap`. This PR moves the allocation of the
`map[string]string` for the `NodeLabels` field from
`AddKubeletConfigFlags` to the defaulter for the external
`KubeletConfiguration` type. Flags are layered on top of an internal
object that has undergone conversion from a defaulted external object,
which means that previously the mere registration of flags would have
overwritten any previously-defined defaults for `NodeLabels` (fortunately
there were none).
2017-11-16 18:35:13 -08:00
David Ashpole
539fddb49d kubelet evictions take priority into account 2017-10-12 13:15:05 -07:00
David Ashpole
8659676408 feature gate local storage allocatable eviction 2017-10-11 09:53:56 -07:00
Kubernetes Submit Queue
6fcf841d69 Merge pull request #52692 from wackxu/fbc
Automatic merge from submit-queue (batch tested with PRs 44596, 52708, 53163, 53167, 52692). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix the bad code comment and make the format unify

**What this PR does / why we need it**:

Fix the bad code comment and make the format unify

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #


**Release note**:

```release-note
NONE
```
2017-09-28 21:15:43 -07:00