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
aa11d0ed
Unverified
Commit
aa11d0ed
authored
Apr 22, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Apr 22, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #76850 from yujuhong/sd-agent
GCE/Windows: enable stackdriver logging agent
parents
b57387b3
4cd26257
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
8 deletions
+45
-8
configure.ps1
cluster/gce/windows/configure.ps1
+1
-2
k8s-node-setup.psm1
cluster/gce/windows/k8s-node-setup.psm1
+43
-6
node-helper.sh
cluster/gce/windows/node-helper.sh
+1
-0
No files found.
cluster/gce/windows/configure.ps1
View file @
aa11d0ed
...
...
@@ -112,8 +112,7 @@ try {
Set
-EnvironmentVars
Create-Directories
Download-HelperScripts
# Disable Stackdrver logging until issue is fixed.
# InstallAndStart-LoggingAgent
InstallAndStart-LoggingAgent
Create-DockerRegistryKey
DownloadAndInstall-KubernetesBinaries
...
...
cluster/gce/windows/k8s-node-setup.psm1
View file @
aa11d0ed
...
...
@@ -270,11 +270,13 @@ function Disable-WindowsDefender {
# Creates directories where other functions in this module will read and write
# data.
# Note: C:\tmp is required for running certain kubernetes tests.
# C:\var\log is used by kubelet to stored container logs and also
# hard-coded in the fluentd/stackdriver config for log collection.
function
Create-Directories
{
Log-Output
"Creating
${
env
:K8S_DIR
}
and its subdirectories."
ForEach
(
$dir
in
(
"
${
env
:K8S_DIR
}
"
,
"
${
env
:NODE_DIR
}
"
,
"
${
env
:LOGS_DIR
}
"
,
"
${
env
:CNI_DIR
}
"
,
"
${
env
:CNI_CONFIG_DIR
}
"
,
"
${
env
:MANIFESTS_DIR
}
"
,
"
${
env
:PKI_DIR
}
"
)
,
"C:\tmp"
)
{
"
${
env
:PKI_DIR
}
"
)
,
"C:\tmp"
,
"C:\var\log"
)
{
mkdir
-Force
$dir
}
}
...
...
@@ -1059,7 +1061,7 @@ function Create-DockerRegistryKey {
# TODO(pjh): move the Stackdriver logging agent code below into a separate
# module; it was put here temporarily to avoid disrupting the file layout in
# the K8s release machinery.
$STACKDRIVER_VERSION
=
'v1-
8
'
$STACKDRIVER_VERSION
=
'v1-
9
'
$STACKDRIVER_ROOT
=
'C:\Program Files (x86)\Stackdriver'
# Install and start the Stackdriver logging agent according to
...
...
@@ -1123,9 +1125,6 @@ function InstallAndStart-LoggingAgent {
Remove-Item
-Force -Recurse
$tmp_dir
}
# TODO(yujuhong):
# - Collect kubelet/kube-proxy logs.
# - Add tag for kubernetes node name.
$FLUENTD_CONFIG
=
@
'
# This configuration file for Fluentd is used to watch changes to kubernetes
# container logs in the directory /var/lib/docker/containers/ and submit the
...
...
@@ -1184,6 +1183,34 @@ $FLUENTD_CONFIG = @'
read_from_head
true
</source>
# Example:
# I0204 07:32:30.020537 3368 server.go:1048] POST /stats/container/: (13.972191ms) 200 [[Go-http-client/1.1] 10.244.1.3:40537]
<
source
>
@type
tail
format multiline
multiline_flush_interval 5s
format_firstline /^\w\d
{
4
}
/
format1 /^
(
?<severity>\w
)(
?<
time
>
\d
{
4
}
[
^\s]
*
)
\s+
(
?<pid>\d+
)
\s+
(
?<
source
>[
^ \]]+
)
\]
(
?<message>.
*
)
/
time_format %m%d %H:%M:%S.%N
path /etc/kubernetes/logs/kubelet.log
pos_file /etc/kubernetes/logs/gcp-kubelet.log.pos
tag kubelet
</source>
# Example:
# I1118 21:26:53.975789 6 proxier.go:1096] Port "nodePort for kube-system/default-http-backend:http" (:31429/tcp) was open before and is still needed
<
source
>
@type
tail
format multiline
multiline_flush_interval 5s
format_firstline /^\w\d
{
4
}
/
format1 /^
(
?<severity>\w
)(
?<
time
>
\d
{
4
}
[
^\s]
*
)
\s+
(
?<pid>\d+
)
\s+
(
?<
source
>[
^ \]]+
)
\]
(
?<message>.
*
)
/
time_format %m%d %H:%M:%S.%N
path /etc/kubernetes/logs/kube-proxy.log
pos_file /etc/kubernetes/logs/gcp-kube-proxy.log.pos
tag kube-proxy
</source>
<match reform.
**
>
@type record_reformer
enable_ruby
true
...
...
@@ -1203,7 +1230,17 @@ $FLUENTD_CONFIG = @'
tag
${
if
record[
'stream'
] ==
'stderr'
then
'raw.stderr'
else
'raw.stdout'
end
}
remove_keys stream,log
</match>
'@
# Attach local_resource_id for 'k8s_node' monitored resource.
<
filter
**
>
@type record_transformer
enable_ruby
true
<record>
"logging.googleapis.com/local_resource_id"
${
"k8s_node.NODE_NAME"
}
</record>
</filter>
'@.replace('
NODE_NAME
', (hostname))
# Export all public functions:
Export-ModuleMember -Function *-*
cluster/gce/windows/node-helper.sh
View file @
aa11d0ed
...
...
@@ -19,6 +19,7 @@
function
get-windows-node-instance-metadata-from-file
{
local
metadata
=
""
metadata+
=
"cluster-name=
${
KUBE_TEMP
}
/cluster-name.txt,"
metadata+
=
"cluster-location=
${
KUBE_TEMP
}
/cluster-location.txt,"
metadata+
=
"kube-env=
${
KUBE_TEMP
}
/windows-node-kube-env.yaml,"
metadata+
=
"kubelet-config=
${
KUBE_TEMP
}
/windows-node-kubelet-config.yaml,"
# To get startup script output run "gcloud compute instances
...
...
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