Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
2c415cc5
Commit
2c415cc5
authored
Sep 13, 2017
by
Yu-Ju Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kubelet: enable CRI container metrics
parent
cd343fd8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
6 deletions
+28
-6
helpers_linux.go
pkg/kubelet/cadvisor/helpers_linux.go
+3
-0
kubelet.go
pkg/kubelet/kubelet.go
+25
-6
No files found.
pkg/kubelet/cadvisor/helpers_linux.go
View file @
2c415cc5
...
@@ -40,6 +40,9 @@ func (i *imageFsInfoProvider) ImageFsInfoLabel() (string, error) {
...
@@ -40,6 +40,9 @@ func (i *imageFsInfoProvider) ImageFsInfoLabel() (string, error) {
case
"rkt"
:
case
"rkt"
:
return
cadvisorfs
.
LabelRktImages
,
nil
return
cadvisorfs
.
LabelRktImages
,
nil
case
"remote"
:
case
"remote"
:
// This is a temporary workaround to get stats for cri-o from cadvisor
// and should be removed.
// Related to https://github.com/kubernetes/kubernetes/issues/51798
if
i
.
runtimeEndpoint
==
"/var/run/crio.sock"
{
if
i
.
runtimeEndpoint
==
"/var/run/crio.sock"
{
return
cadvisorfs
.
LabelCrioImages
,
nil
return
cadvisorfs
.
LabelCrioImages
,
nil
}
}
...
...
pkg/kubelet/kubelet.go
View file @
2c415cc5
...
@@ -26,6 +26,7 @@ import (
...
@@ -26,6 +26,7 @@ import (
"os"
"os"
"path"
"path"
"path/filepath"
"path/filepath"
goruntime
"runtime"
"sort"
"sort"
"strings"
"strings"
"sync"
"sync"
...
@@ -649,12 +650,30 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
...
@@ -649,12 +650,30 @@ func NewMainKubelet(kubeCfg *kubeletconfiginternal.KubeletConfiguration,
}
}
klet
.
containerRuntime
=
runtime
klet
.
containerRuntime
=
runtime
klet
.
runner
=
runtime
klet
.
runner
=
runtime
klet
.
StatsProvider
=
stats
.
NewCadvisorStatsProvider
(
klet
.
cadvisor
,
// CRI integrations should get container metrics via CRI. Docker
klet
.
resourceAnalyzer
,
// uses the built-in cadvisor to gather such metrics on Linux for
klet
.
podManager
,
// historical reasons.
klet
.
runtimeCache
,
// cri-o relies on cadvisor as a temporary workaround. The code should
klet
.
containerRuntime
)
// be removed. Related issue:
// https://github.com/kubernetes/kubernetes/issues/51798
if
(
kubeCfg
.
ContainerRuntime
==
kubetypes
.
DockerContainerRuntime
&&
goruntime
.
GOOS
==
"linux"
)
||
kubeCfg
.
RemoteRuntimeEndpoint
==
"/var/run/crio.sock"
{
klet
.
StatsProvider
=
stats
.
NewCadvisorStatsProvider
(
klet
.
cadvisor
,
klet
.
resourceAnalyzer
,
klet
.
podManager
,
klet
.
runtimeCache
,
klet
.
containerRuntime
)
}
else
{
klet
.
StatsProvider
=
stats
.
NewCRIStatsProvider
(
klet
.
cadvisor
,
klet
.
resourceAnalyzer
,
klet
.
podManager
,
klet
.
runtimeCache
,
runtimeService
,
imageService
)
}
}
else
{
}
else
{
// rkt uses the legacy, non-CRI, integration. Configure it the old way.
// rkt uses the legacy, non-CRI, integration. Configure it the old way.
// TODO: Include hairpin mode settings in rkt?
// TODO: Include hairpin mode settings in rkt?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment