Commit Graph

737 Commits

Author SHA1 Message Date
Adrian Reber
8c24857ba3
kubelet: add CheckpointContainer() to the runtime
Signed-off-by: Adrian Reber <areber@redhat.com>
2022-07-14 10:27:41 +00:00
Adrian Reber
3e6f50683f
kubelet: add CheckpointContainer() on the service level
Signed-off-by: Adrian Reber <areber@redhat.com>
2022-07-14 10:27:40 +00:00
Claudiu Belu
7e6e31577e unittests: Adds Windows unittests
Adds unit tests for a few functions that are not covered.
2022-07-08 17:24:15 +03:00
Kubernetes Prow Robot
10bea49c12
Merge pull request #110140 from marosset/hpc-sandbox-config-fixes
Fixing issue in generatePodSandboxWindowsConfig for hostProcess containers
2022-06-27 20:21:57 -07:00
Kubernetes Prow Robot
60902b7caf
Merge pull request #109692 from yxxhero/remove_ioutil_in_kubelet
remove ioutil in kubelet
2022-06-03 09:30:51 -07:00
Mark Rossetti
0c6088861b Fixing issue in generatePodSandboxWindowsConfig for hostProcess containers by
where pod sandbox won't have HostProcess bit set if pod does not have a
security context but containers specify HostProcess.

Signed-off-by: Mark Rossetti <marosset@microsoft.com>
2022-06-02 12:10:10 -07:00
Kubernetes Prow Robot
1b2de5cf01
Merge pull request #109042 from bjorand/network_panic_kubelet
kubelet: fix panic triggered when playing with a wip CRI
2022-05-03 18:24:20 -07:00
yxxhero
4fac7486d4 remove ioutil in kubelet
Signed-off-by: yxxhero <aiopsclub@163.com>
2022-04-27 21:08:42 +08:00
Kir Kolyshkin
37761a329e
pkg/kubelet: changes to update runc to 1.1.0
The changes (mostly in pkg/kubelet/cm) are there to adopt changed
runc 1.1 API, and simplify things a bit. In particular:

1. simplify cgroup manager instantiation, using a new, easier way of
   libcontainers/cgroups/manager.New;

2. replace libcontainerAdapter with a boolean variable (all it did
   was passing on whether systemd manager should be used);

3. trivial change due to removed cgroupfs.HugePageSizes and added
    cgroups.HugePageSizes();

4. do not calculate cgroup paths in update / destroy, since libcontainer
   cgroup managers now calculate the paths upon creation (previously,
   they were doing that only in Apply, so using e.g. Set or Destroy right
   after creation was impossible without specifying paths).

We currently still calculate cgroup paths in Exists -- this is to be
addressed separately.

Co-Authored-By: Elana Hashman <ehashman@redhat.com>
2022-03-28 16:23:20 -07:00
Benjamin Jorand
3c65728ede
kubelet: fix panic triggered when playing with a wip CRI 2022-03-26 00:23:35 +01:00
waynepeking348
51883193c5 keep original cpu limit logic to be in line with the comments 2022-03-22 10:09:10 +08:00
waynepeking348
0b6d27002f fix test cases for cpu shares 2022-03-21 21:54:32 +08:00
waynepeking348
4c87589300 fix bugs of container cpu shares when cpu request set to zero 2022-03-20 21:53:22 +08:00
Paco Xu
acd696266e mark PodOverhead to GA in v1.24; remove in v1.26 2022-03-17 09:30:14 +08:00
Deep Debroy
023d6fb8f4 Pass instrumented runtime service to containergc
Signed-off-by: Deep Debroy <ddebroy@gmail.com>
2022-03-08 14:33:37 +00:00
Kubernetes Prow Robot
0e8e307567
Merge pull request #106570 from odinuge/fix-cpu-shares-on-big-systems
Fix cpu share issues on systems with large amounts of cpu
2022-03-01 10:15:55 -08:00
KeZhang
3946d99904 Ignore container notfound error while getPodstatuses 2022-02-16 08:55:19 +08:00
Kubernetes Prow Robot
64e83a7e43
Merge pull request #107945 from saschagrunert/cri-verbose
Add support for CRI `verbose` fields
2022-02-14 17:58:12 -08:00
Kubernetes Prow Robot
1659924a97
Merge pull request #108070 from jsafrane/remove-selinux
Remove util/selinux package
2022-02-11 18:19:47 -08:00
Jan Safranek
77aa06d0c8 Remove util/selinux package
The package says:

> the libcontainer SELinux package is only built for Linux, so it is
> necessary to have a NOP wrapper which is built for non-Linux platforms

This is not true, Kubernetes now imports
github.com/opencontainers/selinux/go-selinux and it has proper
multiplatform support (i.e. NOOP on non-Linux platforms).

Removing the whole package and calling go-selinux directly.
2022-02-11 15:20:35 +01:00
Sascha Grunert
effbcd3a0a
Add support for CRI verbose fields
The remote runtime implementation now supports the `verbose` fields,
which are required for consumers like cri-tools to enable multi CRI
version support.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2022-02-10 17:12:26 +01:00
Ciprian Hacman
0819451ea6 Clean up logic for deprecated flag --container-runtime in kubelet
Signed-off-by: Ciprian Hacman <ciprian@hakman.dev>
2022-02-10 13:26:59 +02:00
cyclinder
07999dac70 Clean up dockershim flags in the kubelet
Signed-off-by: cyclinder <qifeng.guo@daocloud.io>
Co-authored-by: Ciprian Hacman <ciprian@hakman.dev>
Signed-off-by: Ciprian Hacman <ciprian@hakman.dev>
2022-01-14 16:02:50 +02:00
Ciprian Hacman
5bae9b9288 Clean up DockerLegacyService interface
Signed-off-by: Ciprian Hacman <ciprian@hakman.dev>
2021-12-18 12:24:54 +02:00
Sascha Grunert
de37b9d293
Make CRI v1 the default and allow a fallback to v1alpha2
This patch makes the CRI `v1` API the new project-wide default version.
To allow backwards compatibility, a fallback to `v1alpha2` has been added
as well. This fallback can either used by automatically determined by
the kubelet.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2021-11-17 11:05:05 -08:00
Kubernetes Prow Robot
42d8b2f3b9
Merge pull request #106289 from CatherineF-dev/fix-metrics-AlreadyRegisteredError-in-unit-test
Fix metrics AlreadyRegisteredError on TestRecordOperation and TestGetHistogramVecFromGatherer unit test
2021-11-16 16:36:15 -08:00
CatherineF-dev
5646120fbb Use Reset at first 2021-11-16 18:57:24 +00:00
Kubernetes Prow Robot
463802765d
Merge pull request #104650 from yxxhero/initcontainer_oomkiil_as_a_failure
fix init container oomkilled as a failure
2021-11-15 17:51:25 -08:00
Odin Ugedal
de0ece541c
Fix cpu share issues on systems with large amounts of cpu
On systems where the calculated cpu shares results in a value above the
max value in linux, containers getting that value are unable to start.
This occur on systems with 300+ cpu cores, and where containers are
given such a value.

This issue was fixed for the pod and qos control groups in the similar
cm.MilliCPUToShares that also has tests verifying the behavior. Since
this code already has an dependency on kubelet/cm, lets reuse that code
instead.
2021-11-14 19:49:19 +00:00
CatherineF-dev
d9737eabf4 Use HandlerFor 2021-11-12 23:09:51 +00:00
CatherineF-dev
49d341aa2b Use defer in non-loop 2021-11-12 23:03:38 +00:00
CatherineF-dev
a30af261f1 remove lint 2021-11-12 15:03:44 +00:00
Ryan Phillips
d6f9df424a defer close the rotated log open 2021-11-12 08:13:24 -06:00
CatherineF-dev
a8324a3bb7 clean 2021-11-12 03:52:19 +00:00
CatherineF-dev
744785ee40 remove prometheus.DefaultRegisterer 2021-11-12 02:17:28 +00:00
CatherineF-dev
8290400e9c format 2021-11-10 03:29:13 +00:00
CatherineF-dev
ef0b2dfbf4 Fix metrics AlreadyRegisteredError on TestRecordOperation and TestGetHistogramVecFromGatherer unit test 2021-11-10 03:23:54 +00:00
Kubernetes Prow Robot
5d60c8d857
Merge pull request #102393 from mengjiao-liu/fix-sysctl-regex
Upgrade preparation to verify sysctl values containing forward slashes by regex
2021-11-09 18:23:26 -08:00
Mark Rossetti
ef324d6bbd Adding kubelet metrics for started and failed to start HostProcess containers
Signed-off-by: Mark Rossetti <marosset@microsoft.com>
2021-11-04 14:39:57 -07:00
Mengjiao Liu
275d832ce2 Upgrade preparation to verify sysctl values containing forward slashes by regex 2021-11-04 11:49:56 +08:00
Tim Hockin
11a25bfeb6
De-share the Handler struct in core API (#105979)
* De-share the Handler struct in core API

An upcoming PR adds a handler that only applies on one of these paths.
Having fields that don't work seems bad.

This never should have been shared.  Lifecycle hooks are like a "write"
while probes are more like a "read". HTTPGet and TCPSocket don't really
make sense as lifecycle hooks (but I can't take that back). When we add
gRPC, it is EXPLICITLY a health check (defined by gRPC) not an arbitrary
RPC - so a probe makes sense but a hook does not.

In the future I can also see adding lifecycle hooks that don't make
sense as probes.  E.g. 'sleep' is a common lifecycle request. The only
option is `exec`, which requires having a sleep binary in your image.

* Run update scripts
2021-10-29 13:15:11 -07:00
Eric Ernst
2c0fad1f52 kuberuntime: populate sandbox resources, overhead
Populate Resources and Overhead fields which, are now part of
LinuxPodSandboxConfig.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2021-10-20 11:30:23 -07:00
Eric Ernst
ddcf815d12 kuberuntime: refactor linux resources for better reuse
Seperate the CPU/Memory req/limit -> linux resource conversion into its
own function for better reuse.

Elsewhere in kuberuntime pkg, we will want to leverage this
requests/limits to Linux Resource type conversion.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2021-10-20 11:30:23 -07:00
Eric Ernst
b1361aed93 kuberuntime: augment linux container config unit test
Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2021-10-20 11:30:23 -07:00
Eric Ernst
a73502a0be kuberuntime: augment linux container config unit test
Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2021-10-20 11:29:22 -07:00
Mark Rossetti
99e43bfa8c Stop passing WindowsHostProcessContainer annotations for CRI calls in kubelet
Signed-off-by: Mark Rossetti <marosset@microsoft.com>
2021-10-05 10:08:53 -07:00
yxxhero
35df409a7e remove StartedPodsErrorsTotal metrice message
Signed-off-by: yxxhero <aiopsclub@163.com>
2021-09-23 22:18:56 +08:00
yxxhero
c1b94d27d9 fix typo
Signed-off-by: yxxhero <aiopsclub@163.com>
2021-09-14 23:24:14 +08:00
yxxhero
20b3cd5198 fix typo
Signed-off-by: yxxhero <aiopsclub@163.com>
2021-09-14 09:04:59 +08:00
yxxhero
5ba76eb911 fix typo
Signed-off-by: yxxhero <aiopsclub@163.com>
2021-09-14 09:03:29 +08:00
yxxhero
2f448a0789 fix oomkilled description
Signed-off-by: yxxhero <aiopsclub@163.com>
2021-09-03 22:07:46 +08:00
yxxhero
71a91d55cb update func description 2021-09-03 07:20:28 +08:00
yxxhero
afde4c8bc4 fix init container oomkilled as a failure
Signed-off-by: yxxhero <aiopsclub@163.com>
2021-09-03 07:04:57 +08:00
Sascha Grunert
46077e6be7
Remove deprecated --seccomp-profile-root/seccompProfileRoot configuration
The configuration is deprecated and targets removal for v1.23. Tests
cases have been changed as well.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2021-08-31 09:55:28 +02:00
Stephen Augustus
481cf6fbe7
generated: Run hack/update-gofmt.sh
Signed-off-by: Stephen Augustus <foo@auggie.dev>
2021-08-24 15:47:49 -04:00
Antonio Ojea
0cd75e8fec run hack/update-netparse-cve.sh 2021-08-20 10:42:09 +02:00
Ryan Phillips
30e9a420c4 kubelet: fix sandbox creation error suppression when pods are quickly deleted 2021-08-10 08:55:25 -05:00
Kubernetes Prow Robot
4b2f2a0cd8
Merge pull request #102789 from haircommander/add-summary-stats-to-cri
CRI: add fields for pod level stats to satisfy the /stats/summary API
2021-08-04 18:59:43 -07:00
rarashid
bf2ae14501 Move feature flag to beta (but leave as false) and remove the feature flag from Kubelet 2021-07-13 14:25:44 -05:00
Elana Hashman
642eff0c69
Rename NodeSwapEnabled flag to NodeSwap 2021-07-09 11:39:52 -07:00
Kubernetes Prow Robot
dab6f6a43d
Merge pull request #102344 from smarterclayton/keep_pod_worker
Prevent Kubelet from incorrectly interpreting "not yet started" pods as "ready to terminate pods" by unifying responsibility for pod lifecycle into pod worker
2021-07-08 16:48:53 -07:00
Kubernetes Prow Robot
a9d7526864
Merge pull request #102970 from tkestack/feature-memory-qos
Feature: Support memory qos with cgroups v2
2021-07-08 14:01:36 -07:00
Kubernetes Prow Robot
7c84064a4f
Merge pull request #99000 from verb/1.21-kubelet-metrics
Add kubelet metrics for ephemeral containers
2021-07-08 14:00:55 -07:00
Peter Hunt
a9b7dcc8c2 kubelet: update remote runtimes for cri stat changes
Signed-off-by: Peter Hunt <pehunt@redhat.com>
2021-07-08 13:17:04 -04:00
Li Bo
c3d9b10ca8 feature: support Memory QoS for cgroups v2 2021-07-08 09:26:46 +08:00
Elana Hashman
5584725605
Explicitly set LimitedSwap case with fallthrough 2021-07-06 13:50:09 -07:00
Clayton Coleman
3eadd1a9ea
Keep pod worker running until pod is truly complete
A number of race conditions exist when pods are terminated early in
their lifecycle because components in the kubelet need to know "no
running containers" or "containers can't be started from now on" but
were relying on outdated state.

Only the pod worker knows whether containers are being started for
a given pod, which is required to know when a pod is "terminated"
(no running containers, none coming). Move that responsibility and
podKiller function into the pod workers, and have everything that
was killing the pod go into the UpdatePod loop. Split syncPod into
three phases - setup, terminate containers, and cleanup pod - and
have transitions between those methods be visible to other
components. After this change, to kill a pod you tell the pod worker
to UpdatePod({UpdateType: SyncPodKill, Pod: pod}).

Several places in the kubelet were incorrect about whether they
were handling terminating (should stop running, might have
containers) or terminated (no running containers) pods. The pod worker
exposes methods that allow other loops to know when to set up or tear
down resources based on the state of the pod - these methods remove
the possibility of race conditions by ensuring a single component is
responsible for knowing each pod's allowed state and other components
simply delegate to checking whether they are in the window by UID.

Removing containers now no longer blocks final pod deletion in the
API server and are handled as background cleanup. Node shutdown
no longer marks pods as failed as they can be restarted in the
next step.

See https://docs.google.com/document/d/1Pic5TPntdJnYfIpBeZndDelM-AbS4FN9H2GTLFhoJ04/edit# for details
2021-07-06 15:55:22 -04:00
Elana Hashman
d3fd1362ca
Rename NoSwap to LimitedSwap as workloads may still swap
Also made the options a kubelet type, address API review feedback
2021-06-29 12:08:21 -07:00
Elana Hashman
0deef4610e
Set MemorySwapLimitInBytes for CRI when NodeSwapEnabled 2021-06-29 11:59:02 -07:00
Sascha Grunert
8b7003aff4
Add SeccompDefault feature
This adds the gate `SeccompDefault` as new alpha feature. Seccomp path
and field fallbacks are now passed to the helper functions, whereas unit
tests covering those code paths have been added as well.

Beside enabling the feature gate, the feature has to be enabled by the
`SeccompDefault` kubelet configuration or its corresponding
`--seccomp-default` CLI flag.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>

Apply suggestions from code review

Co-authored-by: Paulo Gomes <pjbgf@linux.com>
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2021-06-23 10:22:57 +02:00
Kubernetes Prow Robot
13cafd5cb0
Merge pull request #101480 from yuzhiquan/little-nit-for-kubelet
Fix some nit for kubelet
2021-05-24 21:49:05 -07:00
Kubernetes Prow Robot
a49b4a1018
Merge pull request #100608 from pacoxu/fix/poststart-hook
correct messages in post start hook error handling
2021-05-24 21:48:32 -07:00
pacoxu
75c19da843 correct messages in post start hook error handling
Signed-off-by: pacoxu <paco.xu@daocloud.io>
2021-05-20 15:14:47 +08:00
marosset
fd94032b21 Kubelet updates for Windows HostProcess Containers 2021-05-19 16:24:14 -07:00
Kubernetes Prow Robot
a238eb2fe8
Merge pull request #99748 from rphillips/fixes/check_log_path_for_restart_count
kubelet: fix log files being overwritten on container state loss
2021-05-03 16:14:19 -07:00
yuzhiquan
bebca30309 comment should have function name as prefix 2021-04-28 15:26:46 +08:00
Lee Verberne
29178fff1c Add kubelet managed pod metrics 2021-04-13 14:13:30 +02:00
Quan Tian
a90df057ac Fix panic when killing container fails
Use runningPod for logging as the pod passed in could be nil.
2021-04-12 14:02:53 +08:00
Kubernetes Prow Robot
862aa6d3a0
Merge pull request #99970 from krzysiekg/structured_logging_pkg_kubelet_kuberuntime
Migrate pkg/kubelet/kuberuntime to structured logging
2021-03-17 11:45:31 -07:00
Krzysztof Gibuła
629d5ab213 Migrate pkg/kubelet/kuberuntime to structured logging 2021-03-17 01:53:44 +01:00
Kubernetes Prow Robot
e082d84575
Merge pull request #100196 from ehashman/remains-of-logs
Migrate remaining logs to structured logging
2021-03-16 13:12:55 -07:00
Ryan Phillips
d169c81496 check log directory for restartCount 2021-03-15 15:33:29 -05:00
Elana Hashman
1c95d63df0
Migrate kuberuntime_gc.go to structured logs 2021-03-15 12:39:35 -07:00
Aditi Sharma
461c0c1656 Fix structured logging for kuberuntime_manger.go 2021-03-15 10:13:18 +05:30
Elana Hashman
9fb6e712ff
Override terminationLivenessGracePeriod for probes 2021-03-11 14:38:03 -08:00
Kubernetes Prow Robot
c22f099395
Merge pull request #99841 from adisky/kuberuntime_manager
Migrate pkg/kubelet/kuberuntime/kuberuntime_manager.go to structured logging
2021-03-08 16:27:44 -08:00
Aditi Sharma
45c7608379 Migrate to structured logging
pkg/kubelet/kuberuntime/kuberuntime_manager.go

Signed-off-by: Aditi Sharma <adi.sky17@gmail.com>
2021-03-08 11:27:44 +05:30
Kubernetes Prow Robot
c193c1b234
Merge pull request #98376 from matthyx/mega
Make all health checks probing consistent
2021-03-06 11:45:41 -08:00
Matthias Bertschy
431e6a7044 Move readinessManager updates handling to kubelet 2021-03-05 07:02:25 +01:00
chenyw1990
68457812f3 Use structured logging to refactor log printing code, and add containerName to log output information 2021-03-05 09:10:05 +08:00
Kubernetes Prow Robot
d85aed6e5b
Merge pull request #99491 from uzuku/2021-feb-fix-typo
Fix typo in comment for purgeInitContainers.
2021-03-01 17:13:21 -08:00
Benjamin Elder
56e092e382 hack/update-bazel.sh 2021-02-28 15:17:29 -08:00
uzuku
8c53bfe1ea Fix typo in comment for purgeInitContainers. 2021-02-26 21:33:31 +08:00
pacoxu
3de4dd841f
remove featuregate for sysctl
Co-authored-by: Skyler Clark <wgahnagl@protonmail.com>
2021-02-22 16:51:43 -05:00
Ryan Phillips
f989adaa18 kubelet: fix create create sandbox delete pod race 2021-02-18 11:22:12 -06:00
Kubernetes Prow Robot
ee2b7a5049
Merge pull request #98049 from pacoxu/enhancements/redir-links
fix all keps links 404 for kep folder migration
2021-02-01 21:48:28 -08:00
pacoxu
a10bdfed09 fix all keps links 404 for kep folder migration
Signed-off-by: pacoxu <paco.xu@daocloud.io>
2021-02-01 19:41:59 +08:00
ialidzhikov
21608e49a7 Remove WindowsGMSA and WindowsRunAsUserName feature gates
Signed-off-by: ialidzhikov <i.alidjikov@gmail.com>
2021-01-30 02:01:48 +02:00
Kubernetes Prow Robot
6fae18523d
Merge pull request #98019 from cynepco3hahue/specify_resource_during_container_creation_cpu_manager
cpu manager: specify the container CPU set during the creation
2021-01-25 14:15:12 -08:00
Kubernetes Prow Robot
cea1098997
Merge pull request #97715 from changshuchao/files_tmptag
Made some optimizations, including modifying variable names, omitting…
2021-01-21 22:55:26 -08:00
Artyom Lukianov
38dc7509f8 cpu manager: specify the container CPU set during the creation
We can set the container cpuset.cpus diring the creation and it
will not need to call to update resources after the container creation.

Additional side effect of the change, that the runc process that responsible
to create the container will run with the same CPU affinity because the
runc runs on the cpuset provided in the config.json arg.

It will allow to prevent undesirable interupts on isolated CPUs.

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-01-20 17:53:33 +02:00
changshuchao
42eb85e4fb Made some optimizations, including modifying variable names, omitting unnecessary parentheses, and conflicting variable names and package names.
Signed-off-by: changshuchao <chang.shuchao1@zte.com.cn>
2021-01-16 17:24:08 +08:00
wawa0210
ea9df6361b
remove windows container hyper-v support 2021-01-14 22:49:34 +08:00
Sergey Kanzhelev
4c9e96c238 Revert "Merge pull request #92817 from kmala/kubelet"
This reverts commit 88512be213, reversing
changes made to c3b888f647.
2021-01-12 22:27:22 +00:00
Kubernetes Prow Robot
125530629a
Merge pull request #96572 from sjenning/dont-rerun-init
kubelet: do not rerun init containers if any main containers have status
2020-12-08 17:29:18 -08:00
Kubernetes Prow Robot
1588d58151
Merge pull request #95099 from brianpursley/TestReadLogs
Added unit tests for ReadLogs
2020-12-08 16:29:02 -08:00
Kubernetes Prow Robot
b6e0aac05c
Merge pull request #93920 from zhouya0/log_with_limited_tail
[Flaky Test] Add limited lines to log when having tail option
2020-12-08 16:28:45 -08:00
Seth Jennings
c8d02f703b kubelet: do not rerun init containers if any main containers have status 2020-12-01 14:59:03 -06:00
Kubernetes Prow Robot
12d9183da0
Merge pull request #95718 from SergeyKanzhelev/runtimeClass2
RuntimeClass GA
2020-11-12 00:44:51 -08:00
Sergey Kanzhelev
06da0e5e74 GA of RuntimeClass feature gate and API 2020-11-11 19:22:32 +00:00
Andrew Sy Kim
51441fd052 kubelet: support alpha credential provider exec plugins
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
2020-11-10 13:44:06 -05:00
Mrunal Patel
32b9ac7d0c kubelet: Use CRI SecurityProfile for Seccomp
We set both the old and the new fields for now and will
remove the old field in the next release.

Signed-off-by: Mrunal Patel <mpatel@redhat.com>
2020-11-05 15:43:29 -08:00
brianpursley
52cd3252d6 Add unit tests for ReadLogs 2020-09-28 08:20:05 -04:00
Kubernetes Prow Robot
e92f8c8457
Merge pull request #94911 from wawa0210/fix-94898
Enhance log information of verifyRunAsNonRoot, add pod, container information
2020-09-24 13:57:25 -07:00
Kubernetes Prow Robot
402b94f313
Merge pull request #91469 from kinvolk/rata/fix-kubelet-log-msg
Fix kubelet log message when starting a container
2020-09-21 22:28:46 -07:00
wawa0210
be1c85d915
Enhance the prompt information of verifyRunAsNonRoot, add pod, container information 2020-09-22 08:10:54 +08:00
Kubernetes Prow Robot
73dda0af5d
Merge pull request #92355 from wawa0210/fix-91482
fix windows container root validate
2020-09-14 10:42:59 -07:00
Kubernetes Prow Robot
f5a42d69c9
Merge pull request #93475 from ravisantoshgudimetla/fix-kubelet-scc
Strip unnecessary security contexts on Windows
2020-09-10 18:14:14 -07:00
Kubernetes Prow Robot
88512be213
Merge pull request #92817 from kmala/kubelet
Check for sandboxes before deleting the pod from apiserver
2020-09-10 07:27:45 -07:00
knight42
c6f9b402fb
test(kuberuntime): deflake TestRecordOperation
Avoid using hard-coded port

Signed-off-by: knight42 <anonymousknight96@gmail.com>
2020-09-05 13:36:26 +08:00
Kubernetes Prow Robot
1d1daaa044
Merge pull request #94084 from brianpursley/kubernetes-93925-logging
Add logging when fail to kill container or pod
2020-09-04 03:32:23 -07:00
Kubernetes Prow Robot
48d5d204c3
Merge pull request #92614 from tnqn/onfailure-recreate
Don't create a new sandbox for pod with RestartPolicyOnFailure if all containers succeeded
2020-09-03 14:57:40 -07:00
brianpursley
6d001ebb68 Add logging if container or pod fails to be killed 2020-08-25 20:37:49 -04:00
knight42
cfeddcf654
test(kuberuntime): deflake TestRemoveContainer
Signed-off-by: knight42 <anonymousknight96@gmail.com>
2020-08-24 11:14:02 +08:00
Kubernetes Prow Robot
6da73aa572
Merge pull request #93333 from loburm/fix-logrotate
Fix an issue when rotated logs of dead containers are not removed.
2020-08-20 03:27:23 -07:00
zhouya0
44c24758b0 [Flaky Test] Add limited lines to log when having tail option 2020-08-18 17:13:25 +08:00
Rodrigo Campos
e6c67c32e1 Fix kubelet log message when starting a container
This code can be called not only when a container is dead and restarted,
but when is started for the first time too. For example, any pod with
initContainer and containers will exhibit this behaviour. The reason is
that in that case, the "if createPodSandbox" path will return the
initContainers only and on the next call to this function this code is
executed to start the containers for the fist time.

In that case, it is wrong to log that the container is dead and will be
restarted, as it was never started. In fact, the restart count will not
be increased.

This commit just changes this to say that the container is not in the
desired state and should be started. In the end, the kubelet is a state
machine and that is all we really care about.

No tests are added, as the behaviour was correct and tests don't check
logs messages.

Signed-off-by: Rodrigo Campos <rodrigo@kinvolk.io>
2020-08-04 14:58:27 -03:00
ravisantoshgudimetla
cd8686bc57 Strip unnecessary security contexts on Windows
As of now, the kubelet is passing the security context to container runtime even
if the security context has invalid options for a particular OS. As a result,
the pod fails to come up on the node. This error is particularly pronounced on
the Windows nodes where kubelet is allowing Linux specific options like SELinux,
RunAsUser etc where as in [documentation](https://kubernetes.io/docs/setup/production-environment/windows/intro-windows-in-kubernetes/#v1-container),
we clearly state they are not supported. This PR ensures that the kubelet strips
the security contexts of the pod, if they don't make sense on the Windows OS.
2020-08-03 23:43:31 -04:00
Jordan Liggitt
7335770670 Make toKubeContainerImageSpec deterministic 2020-07-31 14:41:11 -04:00
wawa0210
ccde63b9c1
fix windows container root validate 2020-07-24 19:59:58 +08:00
Marian Lobur
5d1b3e26af Fix an issue when rotated logs of dead containers are not removed. 2020-07-24 10:06:24 +02:00
Keerthan Reddy,Mala
872859b422 correct the sandboxId attribute in unit tests 2020-07-22 11:54:58 -07:00
Keerthan Reddy,Mala
851d778531 address review comments 2020-07-22 11:54:58 -07:00
Keerthan Reddy,Mala
90cc954eed add sandbox deletor to delete sandboxes on pod delete event 2020-07-22 11:54:58 -07:00
Paulo Gomes
b451563560
Add seccomp least privilege for kuberuntime 2020-07-08 22:03:29 +01:00
Quan Tian
b2b082f54f Don't create a new sandbox for pod with RestartPolicyOnFailure if all containers succeeded
The kubelet would attempt to create a new sandbox for a pod whose
RestartPolicy is OnFailure even after all container succeeded. It caused
unnecessary CRI and CNI calls, confusing logs and conflicts between the
routine that creates the new sandbox and the routine that kills the Pod.

This patch checks the containers to start and stops creating sandbox if
no container is supposed to start.
2020-07-07 22:49:48 +08:00
Paulo Gomes
8976e3620f
Add seccomp enforcement and validation based on new GA fields
Adds seccomp validation.

This ensures that field and annotation values must match when present.

Co-authored-by: Sascha Grunert <sgrunert@suse.com>
2020-07-06 09:13:25 +01:00
Kubernetes Prow Robot
9a3276548b
Merge pull request #91956 from kinvolk/rata/fix-kubelet-log-on-kill
kubelet: Fix log typo when killing a container
2020-06-24 13:30:38 -07:00
Kubernetes Prow Robot
14d9b5d758
Merge pull request #92325 from brianpursley/sync-pod-log
Add pod and container name in log message when container fails to start
2020-06-24 04:55:18 -07:00
Brian Pursley
2afc8e0eab Add pod and container name in log message when container fails to start 2020-06-23 12:59:53 -04:00
Rodrigo Campos
82856541fb kubelet: Fix log typo when killing a container
Signed-off-by: Rodrigo Campos <rodrigo@kinvolk.io>
2020-06-20 20:15:27 -03:00
Kubernetes Prow Robot
3b466d1c48
Merge pull request #91971 from SergeyKanzhelev/renamesInContainer
fix linter issues for pkg/kubelet/container
2020-06-19 21:51:32 -07:00
Sergey Kanzhelev
ee53488f19 fix golint issues in pkg/kubelet/container 2020-06-19 15:48:08 +00:00
Javier Diaz-Montes
3538936587 Adding Bazel deps 2020-06-15 08:58:02 -04:00
Javier Diaz-Montes
9743cda4a7 Adding Kubelet changes to enable SetHostnameAsFQDN feature
These changes allow to set FQDN as hostname of pods for pods
that set the new PodSpec field setHostnameAsFQDN to true. The PodSpec
new field was added in related PR.

This is PART2 (last) of the changes to enable KEP #1797 and addresses #91036
2020-06-14 21:26:27 -04:00
Kubernetes Prow Robot
99c50dfd3c
Merge pull request #85225 from DataDog/eric.mountain/cleanup_refmanager_master
Removes container RefManager
2020-05-28 16:37:15 -07:00
Kubernetes Prow Robot
b98d9407cf
Merge pull request #91207 from iamchuckss/fixed-width-log-timestamps
Fix log timestamps to maintain a fixed width
2020-05-21 18:20:37 -07:00
Davanum Srinivas
0608e8be25
update bazel BUILD files
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-20 10:57:47 -04:00
Davanum Srinivas
5692926914
Move packages for slightly better UX for consumers
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-20 10:57:46 -04:00
iamchuckss
b5a02c4190 Fix log timestamps to be displayed in fixed width 2020-05-19 13:07:56 +08:00