Skip to content

Commit

Permalink
Use nssm for log rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
jsturtevant committed Dec 14, 2021
1 parent 196c549 commit cb63449
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
win_service:
name: kubelet
dependencies: [ "{{ runtime_service }}" ]
start_mode: manual
start_mode: auto
vars:
dependencies:
containerd: containerd
Expand Down
7 changes: 6 additions & 1 deletion images/capi/ansible/windows/roles/kubernetes/tasks/nssm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
- name: Install kubelet via nssm
win_nssm:
name: kubelet
start_mode: manual
start_mode: auto
state: present
application: '%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe'
arguments: '-ExecutionPolicy Bypass -NoProfile {{ kubernetes_install_path }}\StartKubelet.ps1'
app_rotate_bytes: 10485760
stderr_file: '{{ systemdrive.stdout | trim }}\var\log\kubelet\kubelet.err.log'
stdout_file: '{{ systemdrive.stdout | trim }}\var\log\kubelet\kubelet.log'
app_rotate_online: 1
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ $args = "--cert-dir=$env:SYSTEMDRIVE/var/lib/kubelet/pki",
"--enforce-node-allocatable=`"`"",
"--network-plugin=cni",
"--resolv-conf=`"`"",
"--log-dir=$env:SYSTEMDRIVE/var/log/kubelet",
"--logtostderr=false",
"--image-pull-progress-deadline=20m"

$kubeletCommandLine = "{{ kubernetes_install_path }}\kubelet.exe " + ($args -join " ") + " $kubeAdmArgs"
Expand Down
4 changes: 4 additions & 0 deletions images/capi/packer/ami/packer-windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@
},
"version": "{{user `goss_version`}}"
},
{
"inline": ["rm -Force -Recurse C:\\var\\log\\kubelet\\*"],
"type": "powershell"
},
{
"elevated_password": "{{.WinRMPassword}}",
"elevated_user": "Administrator",
Expand Down
4 changes: 4 additions & 0 deletions images/capi/packer/azure/packer-windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@
},
"version": "{{user `goss_version`}}"
},
{
"inline": ["rm -Force -Recurse C:\\var\\log\\kubelet\\*"],
"type": "powershell"
},
{
"elevated_password": "{{.WinRMPassword}}",
"elevated_user": "packer",
Expand Down
3 changes: 1 addition & 2 deletions images/capi/packer/goss/goss-vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,7 @@ windows:
- Stopped
kubelet:
expected:
- Manual
- Stopped
- Automatic
- "/RequiredServices.+:.+(containerd|docker)/"
sshd:
expected:
Expand Down
4 changes: 4 additions & 0 deletions images/capi/packer/ova/packer-windows.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@
"runtime": "{{user `runtime`}}"
},
"version": "{{user `goss_version`}}"
},
{
"inline": ["rm -Force -Recurse C:\\var\\log\\kubelet\\*"],
"type": "powershell"
}
],
"variables": {
Expand Down

0 comments on commit cb63449

Please sign in to comment.