GCE/Windows: Configure Docker to rotate container logs

k3s-v1.15.3
Yu-Ju Hong 2019-04-23 11:53:16 -07:00
parent bd12b01387
commit 6e12de0744
2 changed files with 16 additions and 0 deletions

View File

@ -115,6 +115,7 @@ try {
InstallAndStart-LoggingAgent
Create-DockerRegistryKey
Configure-Dockerd
DownloadAndInstall-KubernetesBinaries
Create-NodePki
Create-KubeletKubeconfig

View File

@ -1058,6 +1058,21 @@ function Create-DockerRegistryKey {
Remove-Item -Force -Recurse ${tmp_dir}
}
# Configure Docker daemon and restart the service.
function Configure-Dockerd {
Set-Content "C:\ProgramData\docker\config\daemon.json" @'
{
"log-driver": "json-file",
"log-opts": {
"max-size": "1m",
"max-file": "5"
}
}
'@
Restart-Service Docker
}
# 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.