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
e35b1c21
Commit
e35b1c21
authored
May 16, 2017
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose /metrics and /debug/pprof from kube-proxy
parent
26f00c66
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
5 deletions
+23
-5
server.go
cmd/kube-proxy/app/server.go
+15
-5
types.go
pkg/apis/componentconfig/types.go
+3
-0
types.go
pkg/apis/componentconfig/v1alpha1/types.go
+3
-0
zz_generated.conversion.go
pkg/apis/componentconfig/v1alpha1/zz_generated.conversion.go
+2
-0
No files found.
cmd/kube-proxy/app/server.go
View file @
e35b1c21
...
...
@@ -24,7 +24,7 @@ import (
"io/ioutil"
"net"
"net/http"
_
"net/http/pprof"
"net/http/pprof"
"runtime"
"strings"
"time"
...
...
@@ -146,6 +146,7 @@ func AddFlags(options *Options, fs *pflag.FlagSet) {
&
options
.
config
.
Conntrack
.
TCPCloseWaitTimeout
.
Duration
,
"conntrack-tcp-timeout-close-wait"
,
options
.
config
.
Conntrack
.
TCPCloseWaitTimeout
.
Duration
,
"NAT timeout for TCP connections in the CLOSE_WAIT state"
)
fs
.
BoolVar
(
&
options
.
config
.
EnableProfiling
,
"profiling"
,
options
.
config
.
EnableProfiling
,
"If true enables profiling via web interface on /debug/pprof handler."
)
utilfeature
.
DefaultFeatureGate
.
AddFlag
(
fs
)
}
...
...
@@ -298,6 +299,7 @@ type ProxyServer struct {
NodeRef
*
clientv1
.
ObjectReference
CleanupAndExit
bool
MetricsBindAddress
string
EnableProfiling
bool
OOMScoreAdj
*
int32
ResourceContainer
string
ConfigSyncPeriod
time
.
Duration
...
...
@@ -507,6 +509,7 @@ func NewProxyServer(config *componentconfig.KubeProxyConfiguration, cleanupAndEx
ProxyMode
:
proxyMode
,
NodeRef
:
nodeRef
,
MetricsBindAddress
:
config
.
MetricsBindAddress
,
EnableProfiling
:
config
.
EnableProfiling
,
OOMScoreAdj
:
config
.
OOMScoreAdj
,
ResourceContainer
:
config
.
ResourceContainer
,
ConfigSyncPeriod
:
config
.
ConfigSyncPeriod
.
Duration
,
...
...
@@ -555,13 +558,20 @@ func (s *ProxyServer) Run() error {
// Start up a metrics server if requested
if
len
(
s
.
MetricsBindAddress
)
>
0
{
http
.
HandleFunc
(
"/proxyMode"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
mux
:=
http
.
NewServeMux
()
mux
.
HandleFunc
(
"/proxyMode"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
fmt
.
Fprintf
(
w
,
"%s"
,
s
.
ProxyMode
)
})
http
.
Handle
(
"/metrics"
,
prometheus
.
Handler
())
configz
.
InstallHandler
(
http
.
DefaultServeMux
)
mux
.
Handle
(
"/metrics"
,
prometheus
.
Handler
())
if
s
.
EnableProfiling
{
mux
.
HandleFunc
(
"/debug/pprof/"
,
pprof
.
Index
)
mux
.
HandleFunc
(
"/debug/pprof/profile"
,
pprof
.
Profile
)
mux
.
HandleFunc
(
"/debug/pprof/symbol"
,
pprof
.
Symbol
)
mux
.
HandleFunc
(
"/debug/pprof/trace"
,
pprof
.
Trace
)
}
configz
.
InstallHandler
(
mux
)
go
wait
.
Until
(
func
()
{
err
:=
http
.
ListenAndServe
(
s
.
MetricsBindAddress
,
nil
)
err
:=
http
.
ListenAndServe
(
s
.
MetricsBindAddress
,
mux
)
if
err
!=
nil
{
utilruntime
.
HandleError
(
fmt
.
Errorf
(
"starting metrics server failed: %v"
,
err
))
}
...
...
pkg/apis/componentconfig/types.go
View file @
e35b1c21
...
...
@@ -101,6 +101,9 @@ type KubeProxyConfiguration struct {
// metricsBindAddress is the IP address and port for the metrics server to serve on,
// defaulting to 127.0.0.1:10249 (set to 0.0.0.0 for all interfaces)
MetricsBindAddress
string
// enableProfiling enables profiling via web interface on /debug/pprof handler.
// Profiling handlers will be handled by metrics server.
EnableProfiling
bool
// clusterCIDR is the CIDR range of the pods in the cluster. It is used to
// bridge traffic coming from outside of the cluster. If not provided,
// no off-cluster bridging will be performed.
...
...
pkg/apis/componentconfig/v1alpha1/types.go
View file @
e35b1c21
...
...
@@ -97,6 +97,9 @@ type KubeProxyConfiguration struct {
// metricsBindAddress is the IP address and port for the metrics server to serve on,
// defaulting to 127.0.0.1:10249 (set to 0.0.0.0 for all interfaces)
MetricsBindAddress
string
`json:"metricsBindAddress"`
// enableProfiling enables profiling via web interface on /debug/pprof handler.
// Profiling handlers will be handled by metrics server.
EnableProfiling
bool
`json:"enableProfiling"`
// clusterCIDR is the CIDR range of the pods in the cluster. It is used to
// bridge traffic coming from outside of the cluster. If not provided,
// no off-cluster bridging will be performed.
...
...
pkg/apis/componentconfig/v1alpha1/zz_generated.conversion.go
View file @
e35b1c21
...
...
@@ -100,6 +100,7 @@ func autoConvert_v1alpha1_KubeProxyConfiguration_To_componentconfig_KubeProxyCon
out
.
BindAddress
=
in
.
BindAddress
out
.
HealthzBindAddress
=
in
.
HealthzBindAddress
out
.
MetricsBindAddress
=
in
.
MetricsBindAddress
out
.
EnableProfiling
=
in
.
EnableProfiling
out
.
ClusterCIDR
=
in
.
ClusterCIDR
out
.
HostnameOverride
=
in
.
HostnameOverride
if
err
:=
Convert_v1alpha1_ClientConnectionConfiguration_To_componentconfig_ClientConnectionConfiguration
(
&
in
.
ClientConnection
,
&
out
.
ClientConnection
,
s
);
err
!=
nil
{
...
...
@@ -130,6 +131,7 @@ func autoConvert_componentconfig_KubeProxyConfiguration_To_v1alpha1_KubeProxyCon
out
.
BindAddress
=
in
.
BindAddress
out
.
HealthzBindAddress
=
in
.
HealthzBindAddress
out
.
MetricsBindAddress
=
in
.
MetricsBindAddress
out
.
EnableProfiling
=
in
.
EnableProfiling
out
.
ClusterCIDR
=
in
.
ClusterCIDR
out
.
HostnameOverride
=
in
.
HostnameOverride
if
err
:=
Convert_componentconfig_ClientConnectionConfiguration_To_v1alpha1_ClientConnectionConfiguration
(
&
in
.
ClientConnection
,
&
out
.
ClientConnection
,
s
);
err
!=
nil
{
...
...
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