Commit Graph

926 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
e6616033cb
Merge pull request #120844 from bzsuni/cleanup/sets/kubelet
[kubelet] Use a generic Set instead of a specified Set
2024-06-14 09:09:17 -07:00
Kubernetes Prow Robot
f057f2de1c
Merge pull request #124956 from TommyStarK/remove-deprecated-otel-noop-tracer
cmd/kubelet: remove deprecated otel NewNoopTracerProvider
2024-06-06 17:05:34 -07:00
Kubernetes Prow Robot
009a291573
Merge pull request #124677 from HirazawaUi/add-const-ContainerStatusUnknown
kubelet: Use constant replace same value variables of the ContainerStateTerminated Reason field
2024-06-06 17:05:23 -07:00
Kubernetes Prow Robot
a8d51f4f05 Use a generic Set instead of a specified Set in kubelet
Signed-off-by: bzsuni <bingzhe.sun@daocloud.io>
2024-06-04 14:25:43 +08:00
TommyStarK
c0ed4972ac
kubelet: remove deprecated otel NewNoopTracerProvider
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
2024-05-22 17:38:20 +02:00
Sascha Grunert
2aa9e76be1
Move pkg/kubelet/cri/remote to cri-client
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2024-05-14 10:58:18 +02:00
Sascha Grunert
9c712466f6
Make remote runtime and image service logging independent
It's now possible to pass around the `*klog.Logger` which can also be
`nil` to disable logging at all.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2024-05-08 10:32:21 +02:00
HirazawaUi
7a4531c5ba add ContainerStatusUnknown constant 2024-05-03 00:27:19 +08:00
Marek Siarkowicz
3ee8178768 Cleanup defer from SetFeatureGateDuringTest function call 2024-04-24 20:25:29 +02:00
Kubernetes Prow Robot
ef2c682635
Merge pull request #122082 from carlory/remove-keep-terminated-pod-volumes
keep-terminated-pod-volumes flag on kubelet is removed
2024-04-17 23:59:54 -07:00
Stephen Kitt
6bf667af06
Switch from golang/mock to uber-go/mock
See https://github.com/golang/mock#gomock: golang/mock is no longer
maintained, and should be replaced by go.uber.org/mock.

This allows golang/mock to be dropped from the status and vendored
fields in unwanted-dependencies.json.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2024-03-07 09:12:16 +01:00
carlory
b47c73ee26 keep-terminated-pod-volumes flag on kubelet is removed 2024-03-01 18:42:15 +08:00
Maksym Pavlenko
ae0a813be1 Fix tests after rebase
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-16 16:02:10 -08:00
Maksym Pavlenko
d9e2487d0c Add PodLogsPath to kubelet config
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-16 09:55:59 -08:00
KubeKyrie
9860e12d6e expected and actual field position adjustment
Signed-off-by: KubeKyrie <shaolong.qin@daocloud.io>
2024-01-13 12:16:14 +08:00
Kubernetes Prow Robot
2b1ccec47e
Merge pull request #122087 from fatsheep9146/fix-kubelet-trace-broke
fix kubelet trace broke in 1.28
2024-01-04 17:59:39 +01:00
Davanum Srinivas
d621e09a52
remove unused GetRawContainerInfo
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2023-12-15 05:56:22 -08:00
Ziqi Zhao
51495bb4c5 optimize the unit test
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2023-12-05 08:02:03 +08:00
Ziqi Zhao
69c40a3396 fix lints
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2023-12-02 19:37:49 +08:00
Ziqi Zhao
24c4d6f7c9 add unit test for kubelet trace
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2023-12-02 17:09:01 +08:00
Taahir Ahmed
1ebe5774d0 kubelet: Support ClusterTrustBundlePEM projections 2023-11-03 11:40:48 -07:00
Kubernetes Prow Robot
e1824b6a47
Merge pull request #117615 from aheng-ch/checkpoint
Fix: do not assign an empty value to the resource (CPU or memory) if it's not defined in the container
2023-10-24 00:30:08 +02:00
Kubernetes Prow Robot
4fd8bd9975
Merge pull request #118568 from qiutongs/node-startup-latency
Create a node startup latency tracker
2023-09-15 13:00:12 -07:00
Qiutong Song
d3eb082568 Create a node startup latency tracker
Signed-off-by: Qiutong Song <songqt01@gmail.com>
2023-09-11 05:54:25 +00:00
Sohan Kunkerkar
d5690f12b6 pkg/kubelet: allow sandbox image pinning from CRI
As part of this change, the code responsible for managing the sandbox
image within the kubelet has been removed. Previously, the kubelet used
to prevent sandbox image from the garbage collection process. However,
with this update, the responsibility of managing the sandbox containers
has been shifted to the CRI implementation itself. By allowing sandbox
image pinning from CRI, we improve efficiency and simplify the kubelet's
interaction with the container runtime. As a result, the kubelet can now
rely on the container runtime's built-in mechanisms for sandbox container
lifecycle management.

Signed-off-by: Sohan Kunkerkar <sohank2602@gmail.com>
2023-08-29 15:34:51 -04:00
Shiming Zhang
e6bdd224c1 Add HostIPs for kubelet 2023-07-14 09:35:30 +08:00
cyclinder
8e4228a8c1 remove CSI-migration gate 2023-06-04 18:40:17 +08:00
aheng-ch
208cf1afab Fix: do not assign an empty value to the resource (CPU or memory) if it's not defined in the container 2023-05-24 15:04:22 +08:00
Clayton Coleman
1f16d71185
kubelet: Rename PodManager DeletePod to RemovePod
RemovePod is more consistent within the kubelet to be the opposite
of AddPod, and the pod is not being deleted just "removed" from
tracking.
2023-05-12 12:57:27 -04:00
Clayton Coleman
bb568844b6
kubelet: Separate the MirrorClient from the PodManager
The two are not coupled except accidentally. Separate them and
update callsites. This will reduce the scope of PodManager interface
to make exposing the pod worker cleaner.
2023-05-12 12:57:26 -04:00
Clayton Coleman
80b1aca580
kubelet: Remove dispatchWork and inline calls to UpdatePod
The HandlePod* methods are all structurally similar, but accrued
subtle differences. In general the only point for Handle is to
process admission and to update the pod worker with the desired
state of the kubelet's config (so that pod worker can make it
the actual state).

Add a new GetPodAndMirrorPod() method that handles when the config
pod is ambiguous (pod or mirror pod) and inline the structure.
Add comments on questionable additions in the config methods for
future improvement.

Move the metric observation of container count closer to where
pods are actually started (in the pod worker). A future change
can likely move it to syncPod.
2023-05-12 12:57:26 -04:00
Clayton Coleman
02960a8253
kubelet: Remove unused mirrorPodFunc in eviction
Not referenced
2023-05-12 12:57:25 -04:00
Todd Neal
453f81d1ca
kubelet: pass context to VolumeManager.WaitFor*
This allows us to return with a timeout error as soon as the
context is canceled.  Previously in cases where the mount will
never succeed pods can get stuck deleting for 2 minutes.

In the Sync*Pod methods that call VolumeManager.WaitFor*, we
must filter out wait.Interrupted errors from being logged as
they are part of control flow, not runtime problems. Any
early interruption should result in exiting the Sync*Pod method
as quickly as possible without logging intermediate errors.
2023-04-17 11:53:28 -05:00
vinay kulkarni
f66e8848ee Fix pod object update that may cause data race 2023-03-17 08:50:52 +00:00
Michal Wozniak
3d68f362c3 Give terminal phase correctly to all pods that will not be restarted 2023-03-16 21:25:29 +01:00
Kubernetes Prow Robot
c8f001d798
Merge pull request #114504 from vrutkovs/tracing-kubelet-toplevel
kubelet: create top-level traces for pod sync and GC
2023-03-14 03:12:16 -07:00
Kubernetes Prow Robot
3106a5c553
Merge pull request #116301 from andyzhangx/remove-azuredisk-code
Remove Azure disk in-tree storage plugin
2023-03-13 10:38:48 -07:00
Vadim Rutkovsky
556d774945 kubelet: create top-level traces for pod sync and GC
This starts new top level OpenTelemetry spans every time syncPod or image / container GC is invoked
2023-03-11 10:42:14 +01:00
vinay kulkarni
01b96e7704 Rename ContainerStatus.ResourcesAllocated to ContainerStatus.AllocatedResources 2023-03-10 14:49:26 +00:00
Kubernetes Prow Robot
e57d968323
Merge pull request #116015 from SataQiu/clean-kubelet-20230223
kubelet: remove the deprecated --master-service-namespace flag
2023-03-09 22:43:34 -08:00
Kubernetes Prow Robot
45b96eae98
Merge pull request #113145 from smarterclayton/zombie_terminating_pods
kubelet: Force deleted pods can fail to move out of terminating
2023-03-09 15:32:30 -08:00
andyzhangx
5d0a54dcb5 remove Azure Disk in-tree driver code
fix
2023-03-09 13:24:08 +00:00
Clayton Coleman
6b9a381185
kubelet: Force deleted pods can fail to move out of terminating
If a CRI error occurs during the terminating phase after a pod is
force deleted (API or static) then the housekeeping loop will not
deliver updates to the pod worker which prevents the pod's state
machine from progressing. The pod will remain in the terminating
phase but no further attempts to terminate or cleanup will occur
until the kubelet is restarted.

The pod worker now maintains a store of the pods state that it is
attempting to reconcile and uses that to resync unknown pods when
SyncKnownPods() is invoked, so that failures in sync methods for
unknown pods no longer hang forever.

The pod worker's store tracks desired updates and the last update
applied on podSyncStatuses. Each goroutine now synchronizes to
acquire the next work item, context, and whether the pod can start.
This synchronization moves the pending update to the stored last
update, which will ensure third parties accessing pod worker state
don't see updates before the pod worker begins synchronizing them.

As a consequence, the update channel becomes a simple notifier
(struct{}) so that SyncKnownPods can coordinate with the pod worker
to create a synthetic pending update for unknown pods (i.e. no one
besides the pod worker has data about those pods). Otherwise the
pending update info would be hidden inside the channel.

In order to properly track pending updates, we have to be very
careful not to mix RunningPods (which are calculated from the
container runtime and are missing all spec info) and config-
sourced pods. Update the pod worker to avoid using ToAPIPod()
and instead require the pod worker to directly use
update.Options.Pod or update.Options.RunningPod for the
correct methods. Add a new SyncTerminatingRuntimePod to prevent
accidental invocations of runtime only pod data.

Finally, fix SyncKnownPods to replay the last valid update for
undesired pods which drives the pod state machine towards
termination, and alter HandlePodCleanups to:

- terminate runtime pods that aren't known to the pod worker
- launch admitted pods that aren't known to the pod worker

Any started pods receive a replay until they reach the finished
state, and then are removed from the pod worker. When a desired
pod is detected as not being in the worker, the usual cause is
that the pod was deleted and recreated with the same UID (almost
always a static pod since API UID reuse is statistically
unlikely). This simplifies the previous restartable pod support.
We are careful to filter for active pods (those not already
terminal or those which have been previously rejected by
admission). We also force a refresh of the runtime cache to
ensure we don't see an older version of the state.

Future changes will allow other components that need to view the
pod worker's actual state (not the desired state the podManager
represents) to retrieve that info from the pod worker.

Several bugs in pod lifecycle have been undetectable at runtime
because the kubelet does not clearly describe the number of pods
in use. To better report, add the following metrics:

  kubelet_desired_pods: Pods the pod manager sees
  kubelet_active_pods: "Admitted" pods that gate new pods
  kubelet_mirror_pods: Mirror pods the kubelet is tracking
  kubelet_working_pods: Breakdown of pods from the last sync in
    each phase, orphaned state, and static or not
  kubelet_restarted_pods_total: A counter for pods that saw a
    CREATE before the previous pod with the same UID was finished
  kubelet_orphaned_runtime_pods_total: A counter for pods detected
    at runtime that were not known to the kubelet. Will be
    populated at Kubelet startup and should never be incremented
    after.

Add a metric check to our e2e tests that verifies the values are
captured correctly during a serial test, and then verify them in
detail in unit tests.

Adds 23 series to the kubelet /metrics endpoint.
2023-03-08 22:03:51 -06:00
torredil
6aebda9b1e Remove AWS legacy cloud provider + EBS in-tree storage plugin
Signed-off-by: torredil <torredil@amazon.com>
2023-03-06 14:01:15 +00:00
SataQiu
91089ce65b kubelet: remove the deprecated --master-service-namespace flag 2023-03-01 18:44:59 +08:00
Vinay Kulkarni
f2bd94a0de In-place Pod Vertical Scaling - core implementation
1. Core Kubelet changes to implement In-place Pod Vertical Scaling.
2. E2E tests for In-place Pod Vertical Scaling.
3. Refactor kubelet code and add missing tests (Derek's kubelet review)
4. Add a new hash over container fields without Resources field to allow feature gate toggling without restarting containers not using the feature.
5. Fix corner-case where resize A->B->A gets ignored
6. Add cgroup v2 support to pod resize E2E test.
KEP: /enhancements/keps/sig-node/1287-in-place-update-pod-resources

Co-authored-by: Chen Wang <Chen.Wang1@ibm.com>
2023-02-24 18:21:21 +00:00
arrowfeng
6a57404e28 kubelet: cleanup secretManager and configManager in podManager
Signed-off-by: arrowfeng <289716347@qq.com>
2022-11-14 23:05:32 +08:00
Kubernetes Prow Robot
70263d55b2
Merge pull request #113501 from pacoxu/fix-startReflector
kubelet: fix nil pointer in startReflector for standalone mode
2022-11-09 03:50:12 -08:00
Harshal Patil
86284d42f8
Add support for Evented PLEG
Signed-off-by: Harshal Patil <harpatil@redhat.com>
Co-authored-by: Swarup Ghosh <swghosh@redhat.com>
2022-11-08 20:06:16 +05:30
David Ashpole
64af1adace
Second attempt: Plumb context to Kubelet CRI calls (#113591)
* plumb context from CRI calls through kubelet

* clean up extra timeouts

* try fixing incorrectly cancelled context
2022-11-05 06:02:13 -07:00