Commit Graph

672 Commits

Author SHA1 Message Date
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
Kubernetes Prow Robot
f4112710f5
Merge pull request #90061 from marosset/runtimehandler-image-spec-annotations
Add annotations to CRI ImageSpec objects
2020-05-18 16:29:36 -07:00
Davanum Srinivas
07d88617e5
Run hack/update-vendor.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:33 -04: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
Kubernetes Prow Robot
96e13de777
Merge pull request #88980 from tedyu/evict-delay-sorting
Delay sorting of evictUnits slice in kuberuntime_gc
2020-05-14 21:24:58 -07:00
Kubernetes Prow Robot
f7907083c2
Merge pull request #89160 from tedyu/symlink-first-seen
Remove potentially unhealthy symlink only for dead containers
2020-04-28 09:58:07 -07:00
Ted Yu
18e9f33fc6 Remove unhealthy symlink only for dead containers
Signed-off-by: Ted Yu <yuzhihong@gmail.com>
2020-04-21 12:30:51 -07:00
marosset
90367729a3 Adding/updating kubelet/kuberuntime tests 2020-04-20 22:25:05 +00:00
marosset
03479e4d12 kubelet - adding pod annotations to various image calls to get runtime-handler info to CRI 2020-04-17 23:57:09 +00:00
ZP-AlwaysWin
5796b7a32e Repair description 2020-04-17 09:36:38 +08:00
Kubernetes Prow Robot
7061dddf26
Merge pull request #88521 from mattjmcnaughton/mattjmcnaughton/add-error-testing-image-service
Add error path testing to image handling by `kubeGenericRuntimeManager`
2020-04-07 22:45:43 -07:00
Kubernetes Prow Robot
0d8b4b5df4
Merge pull request #85994 from coderanger/patch-1
Tiny typo in a comment.
2020-04-06 15:41:47 -07:00
Shihang Zhang
b56da85a77 sync api/v1/pod/util with api/pod/util and remove DefaultContainers 2020-03-24 16:42:32 -07:00
Kubernetes Prow Robot
e74ad38854
Merge pull request #89013 from dims/copy-jsonlog-from-docker/docker-locally
Copy jsonlog from docker/docker locally
2020-03-19 12:08:37 -07:00
Davanum Srinivas
825f99c396
run update-vendor.sh
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-03-17 21:26:07 -04:00
Davanum Srinivas
0c52ffe08f
make local copy of JSONLog
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-03-17 21:25:55 -04:00
Davanum Srinivas
25c3ddf22e
Just use runtime.NumCPU on windows
docker folks added NumCPU implementation for windows that
supported hot-plugging of CPUs. The implementation used the
GetProcessAffinityMask to be able to check which CPUs are
active as well.
3707a76921

The golang "runtime" package has also bene using GetProcessAffinityMask
since 1.6 beta1:
6410e67a1e

So we don't seem to need the sysinfo.NumCPU from docker/docker.

(Note that this is PR is an effort to get away from dependencies from
docker/docker)

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-03-17 15:53:52 -04:00
Eric Mountain
22e0ee768b Removes container RefManager 2020-03-16 14:30:57 +01:00
zyu
78e2668539 Delay sorting of evictUnits slice in kuberuntime_gc
Signed-off-by: zyu <yuzhihong@gmail.com>
2020-03-09 12:24:42 -07:00
mattjmcnaughton
f215096715
Add error path testing to image handling by kubeGenericRuntimeManager
In https://github.com/kubernetes/kubernetes/pull/88372, we added the
ability to inject errors to the `FakeImageService`. Use this ability to
test the error paths executed by the `kubeGenericRuntimeManager` when
underlying `ImageService` calls fail.

I don't foresee this change having a huge impact, but it should set a
good precedent for test coverage, and should the failure case behavior
become more "interesting" or risky in the future, we already will have
the scaffolding in place with which we can expand the tests.
2020-02-25 08:27:30 -05:00
Patrick Lang
63ff616aa8 Adding Windows CPU limit tests 2020-02-24 19:46:39 +00:00
Patrick Lang
19acf7d051 Fix cpu resource limit on Windows 2020-02-24 19:46:39 +00:00
Kubernetes Prow Robot
d0983b562d
Merge pull request #84731 from verb/ec-pid
Add namespace targeting mode to CRI and kubelet
2020-02-20 04:29:17 -08:00
Kubernetes Prow Robot
d8b325b534
Merge pull request #85856 from adelina-t/cpu_requests_fix_ctrd
Fix Cpu Requests priority Windows.
2020-02-07 15:19:58 -08:00
Kubernetes Prow Robot
d90dd93855
Merge pull request #82111 from xieyanker/xieyanker-patch-2
remove stateCheckPeriod
2020-02-05 04:17:55 -08:00
Lee Verberne
4d4e111f01 Generated code for kubelet namespace targeting 2020-01-30 15:31:43 +01:00
Lee Verberne
9a6d50cb2a Add namespace targeting to the kubelet 2020-01-30 15:31:43 +01:00
sewon.oh
463442aa29
Update container hugepage limit when creating the container
Unit test for updating container hugepage limit
Add warning message about ignoring case.
Update error handling about hugepage size requirements

Signed-off-by: sewon.oh <sewon.oh@samsung.com>
2020-01-28 09:35:02 +09:00
danielqsj
1a9b121764 remove deprecated metrics of kubelet 2020-01-10 16:46:52 +08:00
Kubernetes Prow Robot
9ddbc90039
Merge pull request #84191 from langyenan/getTypedVersion
invoke getTypedVersion() instead of direct runtime call
2019-12-10 16:04:19 -08:00
ianlang
babdcd0d14 invoke getTypedVersion() instead of direct runtime call 2019-12-09 15:31:45 +08:00
Kubernetes Prow Robot
e624d1b7bf
Merge pull request #85001 from bmoix/fix-golint-kubelet-httpgetter
kubelet: rename HTTPGetter interface
2019-12-06 17:05:53 -08:00
Kubernetes Prow Robot
c9f690d418
Merge pull request #85170 from timyinshi/logSymlink
modify dockerID to containerID
2019-12-06 14:27:35 -08:00
Noah Kantrowitz
0ac25f51fc
Tiny typo in a comment. 2019-12-06 01:32:09 -08:00
Adelina Tuvenie
bc7d254317 Fix Cpu Requests priority Windows.
For Windows, CPU Requests ( Shares, Count and Maximum ) are mutually exclusive, however
Kubernetes sends them all anyway in the pod spec.
When using dockershim this is not an issue, as Docker checks for this specific situation
here: 1bd184a4c2/daemon/daemon_windows.go (L87-L106)

However, when using CRI-Containerd this pods fail to spawn with an error from hcsshim.

This PR intends to filter these values before they are sent to the CRI and not rely on the
runtime for it.

Related to: https://github.com/kubernetes/kubernetes/issues/84804
2019-12-04 19:32:26 +02:00
Kubernetes Prow Robot
4e45328e65
Merge pull request #83123 from aramase/dualstack-downward-api
Dualstack downward api
2019-11-14 22:13:42 -08:00
Kubernetes Prow Robot
d3593c07de
Merge pull request #83057 from bclau/windows/containerd
Windows: Fixes termination-file mounting support for containerd
2019-11-13 17:27:36 -08:00
Kubernetes Prow Robot
a08b09d52f
Merge pull request #84279 from matthyx/kuberuntime-startupprobe
Add startupProbe result handling to kuberuntime
2019-11-13 13:01:53 -08:00
Kubernetes Prow Robot
c10d29ba88
Merge pull request #84356 from verb/pid-ga
Promote PodProcessNamespaceSharing feature to GA
2019-11-13 09:25:42 -08:00
Claudiu Belu
d4d7f58362 Windows: Fixes termination-file mounting for containerd
If Containerd is used on Windows, then we can also mount individual
files into containers (e.g.: termination-log files), which was not
possible with Docker.

Checks if the container runtime is containerd, and if it is, then also
mount the termination-log file.
2019-11-12 23:33:55 -08:00
Matthias Bertschy
66595d54a0 Add startupProbe result handling to kuberuntime 2019-11-13 08:12:54 +01:00
root
e9edfbc539 modify dockerID to containerID 2019-11-13 10:43:55 +08:00
Bernat Moix
fc8ea98890 kubelet: rename HTTPGetter interface 2019-11-08 18:18:59 +01:00
Jordan Liggitt
297570e06a hack/update-vendor.sh 2019-11-06 17:42:34 -05:00
yuxiaobo
81e9f21f83 Correct spelling mistakes
Signed-off-by: yuxiaobo <yuxiaobogo@163.com>
2019-11-06 20:25:19 +08:00
Lee Verberne
cbbe7d1bb9 Remove checks for PodShareProcessNamespace feature gate 2019-10-31 17:15:23 +00:00
Anish Ramasekar
af4d18ccf9
add status.podIPs in downward api
add host file write for podIPs

update tests

remove import alias

update type check

update type check

remove import alias

update open api spec

add tests

update test

add tests

address review comments

update imports

remove todo and import alias
2019-10-25 09:18:49 -07:00
Kubernetes Prow Robot
4cff1c3ea1
Merge pull request #81280 from yqwang-ms/yqwang/exitmsglost
Fix Container exit message lost due to FallbackToLogsOnError is not compatible with ContainerCannotRun
2019-10-08 15:41:51 -07:00
Kubernetes Prow Robot
e972912fe4
Merge pull request #74881 from qingsenLi/k8s190304-fix-syntactic
fix syntactic error in kuberuntime_manager.go
2019-09-10 14:28:48 -07:00
Kubernetes Prow Robot
da986c56ab
Merge pull request #73944 from xiaoanyunfei/cleanup/rm_unuse_judge
rm unnecessary judgement
2019-08-29 13:30:57 -07:00
xieyanker
4b775046d4
remove stateCheckPeriod
If exec logForceCheckPeriod, there is no need to exec stateCheckPeriod
2019-08-29 11:06:45 +08:00
Han Kang
3a50917795 migrate kubelet's metrics/probes & metrics endpoint to metrics stability framework 2019-08-28 11:16:38 -07:00
Kubernetes Prow Robot
0e1bad3764
Merge pull request #81747 from Random-Liu/fix-windows-log-follow
Fix windows kubectl log -f.
2019-08-23 06:53:24 -07:00
Lantao Liu
7767ff3bb2 Fix windows kubectl log -f. 2019-08-21 15:44:20 -07:00
Tim Allclair
8a495cb5e4 Clean up error messages (ST1005) 2019-08-21 10:40:21 -07:00
Tim Allclair
e06912ca3e Clean up deprecated references 2019-08-21 10:40:21 -07:00
Tim Allclair
6510d26b6a Fix misc static check issues 2019-08-21 10:40:21 -07:00
Tim Allclair
3f510c69f6 Remove dead code from pkg/kubelet/... 2019-08-21 10:40:21 -07:00
Yuqi Wang
f82be3d3d0 Fix Container exit message lost due to FallbackToLogsOnError is not compatible with ContainerCannotRun 2019-08-12 16:15:59 +08:00
Lee Verberne
906286c743 Change order kubelet starts containers
This starts ephemeral containers prior to init containers so that
ephemeral containers will still be started when init containers fail to
start.

Also improves tests and comments with review suggestions.
2019-08-02 19:56:38 +00:00
Lee Verberne
7bce18b0ce Generated code for Ephemeral Containers in kubelet 2019-07-24 16:25:52 +00:00
Lee Verberne
ea212d5d49 Add support for ephemeral containers to the kubelet 2019-07-24 16:24:26 +00:00
James Sturtevant
a8c78d1359 Windows: Sets the effective SecurityContext's RunAsUserName
Co-Authored-By: Claudiu Belu <cbelu@cloudbasesolutions.com>
2019-07-17 15:03:11 +00:00
Kubernetes Prow Robot
becf718143
Merge pull request #78368 from tedyu/evict-sandboxes
Call getKubeletSandboxes first in containerGC#evictSandboxes
2019-07-11 14:33:21 -07:00
tiffany jernigan
27a0d91f2d Remove lazy provide from credential provider and kubelet (#79674)
* Remove LazyProvide from kubelet

* Remove LazyProvide from cloud providers

* Remove LazyProvide from credential provider keyring and provider
2019-07-03 13:52:52 -07:00
Khaled Henidak(Kal)
dba434c4ba kubenet for ipv6 dualstack 2019-07-02 22:26:25 +00:00
Yu-Ju Hong
3fac48f86a kubelet: retry pod sandbox creation when containers were never created
If kubelet never gets past sandbox creation (i.e., never attempted to
create containers for a pod), it should retry the sandbox creation on
failure, regardless of the restart policy of the pod.
2019-06-26 18:19:27 -07:00
Ted Yu
58dfe186d8 Call getKubeletSandboxes first in containerGC#evictSandboxes 2019-05-26 14:40:11 -07:00
Tim Allclair
91e593546c Revert "Use consistent imageRef during container startup"
This reverts commit 26e3c8674e.
2019-05-23 11:36:32 -07:00
Jean Rouge
b39d8f4777 Kubelet & implementation changes for Windows GMSA support
This patch comprises the kubelet changes outlined in the Windows GMSA KEP
(https://github.com/kubernetes/enhancements/blob/master/keps/sig-windows/20181221-windows-group-managed-service-accounts-for-container-identity.md)
to add GMSA support to Windows workloads.

Updated tests.

Signed-off-by: Jean Rouge <rougej+github@gmail.com>
2019-05-16 22:07:03 -04:00
Jean Rouge
181706b0f0 Auto-generated changes for Windows GMSA support
This patch comprises the auto-generated changes for the API changes outlined in
the Windows GMSA KEP
(https://github.com/kubernetes/enhancements/blob/master/keps/sig-windows/20181221-windows-group-managed-service-accounts-for-container-identity.md)
to add GMSA support to Windows workloads.

Signed-off-by: Jean Rouge <rougej+github@gmail.com>
2019-05-16 15:34:22 -07:00
yameiwang
503ac59abe fix typo in kuberuntime_manager.go 2019-05-13 08:35:01 +08:00
Andrew Kim
c919139245 update import of generic featuregate code from k8s.io/apiserver/pkg/util/feature -> k8s.io/component-base/featuregate 2019-05-08 10:01:50 -04:00
Kubernetes Prow Robot
aff3f0c61c
Merge pull request #76665 from tallclair/imageref
Use consistent imageRef during container startup
2019-04-16 19:14:34 -07:00
Kubernetes Prow Robot
097d58523a
Merge pull request #75278 from Nessex/updatecontainerresources-label-fix
Fix label on UpdateContainerResources operation
2019-04-12 08:44:48 -07:00
Tim Allclair
26e3c8674e Use consistent imageRef during container startup 2019-04-10 12:06:42 -07:00
Robert Krawitz
022f7c2cd7 Clean up PR #71617 2019-04-08 10:34:40 -04:00
Kubernetes Prow Robot
dc1ff116dc
Merge pull request #74220 from tedyu/master
Aggregate errors for kube runtime GC
2019-04-04 17:47:19 -07:00
Giuseppe Scrivano
a561196bfe
logs: consume all file until EOF on exited container
If the container is not found, do not stop reading the log file
immediately but wait until we reach again EOF.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-30 17:42:21 +01:00
Giuseppe Scrivano
8f68b281e4
kubelet: force checking the log file every second
it seems fsnotify can miss some read events, blocking the kubelet to
receive more data from the log file.

If we end up waiting for events with fsnotify, force a read from the
log file every second so that are sure to not miss new data for longer
than that.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-30 17:42:20 +01:00
Giuseppe Scrivano
341c2c0d1f
kubelet: handle recreated log files
if the runtime is configured to rotate the log file, we might end up
watching the old fd where there are no more writes.

When a fsnotify event other than Write is received, reopen the log
file and recreate the watcher.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-30 17:42:20 +01:00
Giuseppe Scrivano
2c30eee92f
kubelet: read immediately after creating the watcher
if some events happen between the Read and while we set the watcher,
we might miss them.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-03-30 17:42:11 +01:00
Kubernetes Prow Robot
dabeb20a1a
Merge pull request #75587 from tiffanyfay/cred-provider
Refactor AWS credential provider
2019-03-29 14:48:47 -07:00
Kubernetes Prow Robot
4b3eb60081
Merge pull request #75531 from dims/add-new-staging-repository-for-cri-api
New staging repository for cri-api
2019-03-26 18:10:49 -07:00
tiffany jernigan
847cb24aa1 Credential provider Provide takes image (general) 2019-03-27 01:00:26 +00:00
Davanum Srinivas
33081c1f07
New staging repository for cri-api
Change-Id: I2160b0b0ec4b9870a2d4452b428e395bbe12afbb
2019-03-26 18:21:04 -04:00
shinytang6
5c9f4d9dc6 replace time.Now().Sub with time.Since 2019-03-21 18:02:55 +08:00
Nathan Essex
394c581a56 Fix label on UpdateContainerResources operation 2019-03-12 14:18:53 +09:00
Lantao Liu
0ac651bfc3 Include pod logs in the pod ephemeral storage.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-03-08 16:42:14 -08:00
Lantao Liu
f14c6c95d6 New pod log directory /var/log/pods/NAMESPACE_NAME_UID.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-03-08 16:42:14 -08:00
Lubomir I. Ivanov
e29c6e1b38 go-1.12: fix 'go vet' failures 2019-03-01 18:48:17 +02:00
Kubernetes Prow Robot
44d13d3b77
Merge pull request #73726 from wk8/wk8/gmsa_alpha
Kubelet changes for Windows GMSA support
2019-02-25 21:48:21 -08:00
qingsenLi
8086b8f71d fix syntactic error in kuberuntime_manager.go-2 2019-02-23 10:51:17 +08:00
haiyanmeng
ec18200f8b Fit RuntimeClass metrics to prometheus conventions
1) Add suffix (`seconds` or `total`) to metric name
2) Switch Summary metric to Histogram metric (Summary metrics are not
supported completely by prometheus-to-sd and can't be aggregated.)
2019-02-19 12:46:37 -08:00
Ted Yu
dae6950f04 Aggregate errors for kube runtime GC
Signed-off-by: Ted Yu <yute@vmware.com>
2019-02-18 13:29:22 -08:00
danielqsj
79a3eb816c rename latency to duration in metrics 2019-02-18 17:40:04 +08:00
danielqsj
9fd99a48f5 Change kubelet metrics to conform guideline 2019-02-18 14:01:58 +08:00
sunxiaofei03
91e6dab9f8 rm unused judgement 2019-02-15 10:57:42 +08:00
Kubernetes Prow Robot
6a9902deee
Merge pull request #73802 from Random-Liu/handle-unknown-state
Stop container in unknown state before recreate or remove.
2019-02-14 15:50:12 -08:00
Jean Rouge
b435dbf718 Merge branch 'master' into wk8/gmsa_alpha
Signed-off-by: Jean Rouge <rougej+github@gmail.com>
2019-02-14 15:38:25 -08:00
Lantao Liu
de8ee94d14 Stop container in unknown state before recreate or remove. 2019-02-14 02:31:17 -08:00
Kubernetes Prow Robot
19e57c616c
Merge pull request #73892 from smarterclayton/fix_container_message
Make container create, start, and stop events consistent
2019-02-12 20:01:36 -08:00
Kubernetes Prow Robot
0480214903
Merge pull request #73804 from Random-Liu/remove-unused-functions
Remove unused function from the legacy runtime interface.
2019-02-11 22:56:00 -08:00
Kubernetes Prow Robot
c9964aa519
Merge pull request #73342 from szuecs/fix/period-not-reset-if-gate-not-set
cpuPeriod was not reset
2019-02-11 19:58:07 -08:00
Clayton Coleman
49250c6efc
Make container create, start, and stop events consistent
The messages for container lifecycle events are subtly inconsistent
and should be unified.

First, the field format for containers is hard to parse for a human,
so include the container name directly in the message for create
and start, and for kill remove the container runtime prefix.

Second, the pulling image event has inconsistent capitalization, fix
that to be sentence without punctuation.

Third, the kill container event was unnecessarily wordy and inconsistent
with the create and start events. Make the following changes:

* Use 'Stopping' instead of 'Killing' since kill is usually reserved for
  when we decide to hard stop a container
* Send the event before we dispatch the prestop hook, since this is an
  "in-progress" style event vs a "already completed" type event
* Remove the 'cri-o://' / 'docker://' prefix by printing the container
  name instead of id (we already do that replacement at the lower level
  to prevent high cardinality events)
* Use 'message' instead of 'reason' as the argument name since this is a
  string for humans field, not a string for machines field
* Remove the hash values on the container spec changed event because no
  human will ever be able to do anything with the hash value
* Use 'Stopping container %s(, explanation)?' form without periods to
  follow event conventions

The end result is a more pleasant message for humans:

```
35m         Normal    Created                       Pod    Created container
35m         Normal    Started                       Pod    Started container
10m         Normal    Killing                       Pod    Killing container cri-o://installer:Need to kill Pod
10m         Normal    Pulling                       Pod    pulling image "registry.svc.ci.openshift.org/openshift/origin-v4.0-2019-02-10-172026@sha256:3da5303d4384d24691721c1cf2333584ba60e8f82c9e782f593623ce8f83ddc5"
```

becomes

```
35m         Normal    Created                       Pod    Created container installer
35m         Normal    Started                       Pod    Started container installer
10m         Normal    Killing                       Pod    Stopping container installer
10m         Normal    Pulling                       Pod    Pulling image "registry.svc.ci.openshift.org/openshift/origin-v4.0-2019-02-10-172026@sha256:3da5303d4384d24691721c1cf2333584ba60e8f82c9e782f593623ce8f83ddc5"
```
2019-02-10 16:39:42 -05:00
Lantao Liu
1a92e218e0 Remove unused function from the legacy runtime interface.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-02-07 16:57:19 -08:00
Jean Rouge
c4806186d4 Review comments
* value names are now purely random
* cleaning up leaked registry keys at Kubelet init
* fixing a small bug masking create errors

Signed-off-by: Jean Rouge <rougej+github@gmail.com>
2019-02-05 16:53:17 -08:00
Kubernetes Prow Robot
459e509f94
Merge pull request #73549 from haiyanmeng/runtimeclass
Add monitoring for RuntimeClass
2019-02-05 15:14:38 -08:00
Jean Rouge
3f5675880d Kubelet changes for Windows GMSA support
This patch comprises the kubelet changes outlined in the GMSA KEP
(https://github.com/kubernetes/enhancements/blob/master/keps/sig-windows/20181221-windows-group-managed-service-accounts-for-container-identity.md)
to add GMSA support to Windows workloads.

More precisely, it includes the logic proposed in the KEP to resolve
which GMSA spec should be applied to which containers, and changes
`dockershim` to copy the relevant GMSA credential specs to Windows
registry values prior to creating the container, passing them down
to docker itself, and finally removing the values from the registry
afterwards; both these changes need to be activated with the `WindowsGMSA`
feature gate.

Includes unit tests.

Signed-off-by: Jean Rouge <rougej+github@gmail.com>
2019-02-05 09:17:46 -08:00
Kubernetes Prow Robot
6a149864fb
Merge pull request #73285 from tallclair/typed-runtimeclass
Migrate RuntimeClass support to the generated typed client
2019-02-04 16:13:30 -08:00
haiyanmeng
18bcdcecce Add monitoring for RuntimeClass 2019-02-04 16:01:29 -08:00
Kubernetes Prow Robot
53a7601e6a
Merge pull request #64648 from dcbw/remove-unused-param
kubelet: remove unused parameter from runtime's SyncPod()
2019-02-01 09:03:45 -08:00
Sandor Szücs
fd0cff9c77
fix #73264 cpuPeriod was not reset, but used as it is if alpha gate is disabled
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
2019-02-01 16:45:43 +01:00
Kubernetes Prow Robot
7b7f18c6c8
Merge pull request #70978 from Pingan2017/gracePeriod
correct log output when specifed delete gracePeriod < minimumGracePer…
2019-01-31 16:05:33 -08:00
Seth Jennings
6b51d48c4f TestCreatePodSandbox_RuntimeClass should not expect RunPodSandbox when runtime class is not found 2019-01-31 12:55:56 -06:00
Tim Allclair
aab3523e0e Migrate RuntimeClass support to the generated typed client 2019-01-24 11:08:30 -08:00
Kubernetes Prow Robot
a6d7527ac3
Merge pull request #72280 from verb/kubelet-no-containertype
Remove container type from kubelet runtime labels
2019-01-10 01:18:41 -08:00
Kubernetes Prow Robot
998167767f
Merge pull request #71764 from linxiulei/fix_cri_pullimage
Pass PodSandboxConfig to PullImage method in CRI
2019-01-07 15:24:48 -08:00
Lee Verberne
f6084f7eab Remove container type from kubelet runtime labels
We've changed the Ephemeral Containers API, and container type will no
longer be required. Since this is the only feature using it, remove it.

This reverts commit ba6f31a6c6.
2018-12-21 15:47:47 +01:00
Tim Allclair
e27f7ef151 Surface selected pod RuntimeHandler in Kubelet logs 2018-12-17 16:36:47 -08:00
Kubernetes Prow Robot
61ed586bb9
Merge pull request #71297 from Pingan2017/event-kill-container
correct the event msg of kill container
2018-12-13 18:18:58 -08:00
Eric Lin
5e2ed11cf7 Pass PodSandboxConfig to PullImage method in CRI
Fix #71745
2018-12-07 10:10:22 +08:00
Robert Krawitz
bc091be66a Issue 71614: Protect log message maps 2018-11-30 18:04:08 -05:00
k8s-ci-robot
79e5cb2cb7
Merge pull request #71302 from liggitt/verify-unit-test-feature-gates
Split mutable and read-only access to feature gates, limit tests to readonly access
2018-11-29 21:45:12 -08:00
k8s-ci-robot
7ae97bcd0b
Merge pull request #66308 from RobertKrawitz/bug-1581483
Reduce logspam for crash looping containers
2018-11-29 02:00:54 -08:00
Robert Krawitz
3373fcf0fc Reduce logspam for crash looping containers 2018-11-28 10:48:52 -05:00
Jordan Liggitt
2498ca7606 drop VerifyFeatureGatesUnchanged 2018-11-21 11:51:33 -05:00
Jordan Liggitt
70ad4dff48 Fix unit tests calling SetFeatureGateDuringTest incorrectly 2018-11-21 11:51:33 -05:00
Jordan Liggitt
4dca07ef7e Fixup incorrect use of DefaultFeatureGate.Set in tests 2018-11-21 11:51:33 -05:00
Pingan2017
75d9a7bebd correct the event msg of kill container 2018-11-21 10:59:21 +08:00
Jordan Liggitt
733dd9dfd7 Add tests to ensure feature gate changes don't escape kubelet/scheduler packages 2018-11-16 10:52:53 -05:00
Pingan2017
fae9bae1aa correct log output when specifed delete gracePeriod < minimumGracePeriodInSeconds 2018-11-13 15:20:24 +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
Christoph Blecker
97b2992dc1
Update gofmt for go1.11 2018-10-05 12:59:38 -07:00
k8s-ci-robot
6c1688712d
Merge pull request #68181 from Pingan2017/golint
fix golint failures - some packages under /pkg/kubelet
2018-09-28 01:56:26 -07:00
Derek Carr
5f473bc8e1 Kubelet should not create a new pod sandbox if all containers are done 2018-09-27 14:21:50 -04:00
Benjamin Elder
8b56eb8588 hack/update-gofmt.sh 2018-09-24 12:21:29 -07:00
Benjamin Elder
f828c6f662 hack/update-bazel.sh 2018-09-24 12:03:24 -07:00
Benjamin Elder
088cf3c37b find & replace version import 2018-09-24 12:03:24 -07:00
Pingan2017
158552ff35 fix golint failures - /pkg/kubelet/images 2018-09-17 10:52:25 +08:00
Yu-Ju Hong
a1f7ae7ab3 kubelet: skip initializing/using the RuntimeClass in standalone mode
In standalone mode, kubelet will not be configured to talk to an
apiserver. The RuntimeClass manager should be disabled in this case.
2018-09-11 13:21:53 -07:00
Tim Allclair
63f3bc1b7e
Implement RuntimeClass support for the Kubelet & CRI 2018-09-04 13:45:11 -07:00
Sandor Szücs
588d2808b7
fix #51135 make CFS quota period configurable, adds a cli flag and config option to kubelet to be able to set cpu.cfs_period and defaults to 100ms as before.
It requires to enable feature gate CustomCPUCFSQuotaPeriod.

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
2018-09-01 20:19:59 +02:00
Jess Frazelle
31ffd9f881
vendor: update docker cadvisor winterm
This vendor change was purely for the changes in docker to allow for
setting the Masked and Read-only paths.

See: moby/moby#36644

But because of the docker dep update it also needed cadvisor to be
updated and winterm due to changes in pkg/tlsconfig in docker

See: google/cadvisor#1967

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
2018-08-30 11:40:05 -04:00
Jess Frazelle
dbf7186bee
update jsonlog path for updated vendor
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
2018-08-30 11:40:05 -04:00
Jess Frazelle
30dcca6233
ProcMount: add api options and feature gate
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
2018-08-30 11:40:02 -04:00
Kubernetes Submit Queue
cd06419973
Merge pull request #67369 from tianshapjq/should-not-eventf-directly
Automatic merge from submit-queue. 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>.

should not event directly

**What this PR does / why we need it**:
should not event directly, using recordContainerEvent() to generate ref and deduplicate events instead.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
none
```
2018-08-28 16:18:13 -07:00
Laszlo Janosi
a6da2b1472 K8s SCTP support implementation for the first pull request
The requested Service Protocol is checked against the supported protocols of GCE Internal LB. The supported protocols are TCP and UDP.

SCTP is not supported by OpenStack LBaaS. If SCTP is requested in a Service with type=LoadBalancer, the request is rejected. Comment style is also corrected.

SCTP is not allowed for LoadBalancer Service and for HostPort. Kube-proxy can be configured not to start listening on the host port for SCTP: see the new SCTPUserSpaceNode parameter

changed the vendor github.com/nokia/sctp to github.com/ishidawataru/sctp. I.e. from now on we use the upstream version.

netexec.go compilation fixed. Various test cases fixed

SCTP related conformance tests removed. Netexec's pod definition and Dockerfile are updated to expose the new SCTP port(8082)

SCTP related e2e test cases are removed as the e2e test systems do not support SCTP

sctp related firewall config is removed from cluster/gce/util.sh. Variable name sctp_addr is corrected to sctpAddr in pkg/proxy/ipvs/proxier.go

cluster/gce/util.sh is copied from master
2018-08-27 05:56:27 +00:00
Kubernetes Submit Queue
c65f65cf6a
Merge pull request #65065 from sjenning/reduce-backoff-logging
Automatic merge from submit-queue (batch tested with PRs 66177, 66185, 67136, 67157, 65065). 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>.

kubelet: reduce logging for backoff situations

xref https://bugzilla.redhat.com/show_bug.cgi?id=1555057#c6

Pods that are in `ImagePullBackOff` or `CrashLoopBackOff` currently generate a lot of logging at the `glog.Info()` level.  This PR moves some of that logging to `V(3)` and avoids logging in situations where the `SyncPod` only fails because pod are in a BackOff error condition.

@derekwaynecarr @liggitt
2018-08-15 02:09:20 -07:00
tianshapjq
27c5ced809 should not event directly 2018-08-14 14:35:47 +08:00
Yu-Ju Hong
390b158db9 kubelet: plumb context for log requests
This allows kubelets to stop the necessary work when the context has
been canceled (e.g., connection closed), and not leaking a goroutine
and inotify watcher waiting indefinitely.
2018-08-10 17:35:46 -07:00
Lantao Liu
3193a4a469 Fix RunAsGroup. 2018-07-06 15:42:26 -07:00
Jeff Grafton
23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
Jeff Grafton
a725660640 Update to gazelle 0.12.0 and run hack/update-bazel.sh 2018-06-22 16:22:18 -07:00
Kubernetes Submit Queue
aa25539ef6
Merge pull request #64451 from wgliang/master.remove-kubelet
Automatic merge from submit-queue (batch tested with PRs 64688, 64451, 64504, 64506, 56358). 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>.

cleanup some dead kubelet code

**Release note**:

```release-note
NONE
```
2018-06-20 05:48:11 -07:00
Seth Jennings
f1551798e4 reduce logging for backoff situations 2018-06-13 13:25:20 -05:00
Kubernetes Submit Queue
b6f75ac30e
Merge pull request #63717 from ingvagabund/promote-sysctl-annotations-to-fields
Automatic merge from submit-queue. 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>.

Promote sysctl annotations to fields

#


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

Promoting experimental sysctl feature from annotations to API fields.

**Special notes for your reviewer**:

Following sysctl KEP: https://github.com/kubernetes/community/pull/2093

**Release note**:

```release-note
The Sysctls experimental feature has been promoted to beta (enabled by default via the `Sysctls` feature flag). PodSecurityPolicy and Pod objects now have fields for specifying and controlling sysctls. Alpha sysctl annotations will be ignored by 1.11+ kubelets. All alpha sysctl annotations in existing deployments must be converted to API fields to be effective.
```

**TODO**:

* [x] - Promote sysctl annotation in Pod spec
* [x] - Promote sysctl annotation in PodSecuritySpec spec
* [x] - Feature gate the sysctl
* [x] - Promote from alpha to beta
* [x] - docs PR - https://github.com/kubernetes/website/pull/8804
2018-06-06 00:47:36 -07:00
Seth Jennings
6729add11c sysctls: create feature gate to track promotion 2018-06-06 00:23:11 +02:00
Jan Chaloupka
3cc15363bc Run make update 2018-06-06 00:12:40 +02:00
Jan Chaloupka
ab616a88b9 Promote sysctl annotations to API fields 2018-06-05 23:17:00 +02:00
Pengfei Ni
6da502e016 Setup windows security context in CRI 2018-06-05 09:27:40 +08:00
Dan Williams
931f6718b0 kubelet: remove unused parameter from runtime's SyncPod() 2018-06-01 21:55:40 -05:00
Lantao Liu
aeb6cacf01 Remove direct and indirect streaming runtime interface. 2018-05-29 15:08:15 -07:00
Guoliang Wang
9449a4372e cleanup some dead kubelet code 2018-05-29 22:38:01 +08:00
Lantao Liu
4bb16659ee Make kubelet ReadLogs backward compatible.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-04-27 16:03:29 -07:00
Kubernetes Submit Queue
284e8182a4
Merge pull request #63160 from sjenning/no-waitlogs-stopped-pod
Automatic merge from submit-queue (batch tested with PRs 63252, 63160). 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>.

kubelet: logs: do not wait when following terminated container

Currently, a `kubectl logs -f` on a terminated container will output the logs, wait 5 seconds (`stateCheckPeriod`), then return.  The 5 seconds delay should not occur as the container is terminated and unable to generate additional log messages.

This PR puts a check at the beginning of `waitLogs()` to avoid doing the wait when the container is not running.

@derekwaynecarr @smarterclayton
2018-04-27 12:27:05 -07:00