-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[windows] Improve kube-proxy logging and move calico logs to a better path #5248
Conversation
pkg/pebinaryexecutor/pebinary.go
Outdated
@@ -67,6 +67,8 @@ const ( | |||
CNICalico = "calico" | |||
CNICilium = "cilium" | |||
CNICanal = "canal" | |||
LogPath = "C:\\var\\log\\" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default kubelet log for linux is /var/lib/rancher/rke2/agent/logs/kubelet.log
, why do we use c:/var/log
for this instead of c:/var/lib/rancher/rke2/agent/logs
? Can we just put this in the same place as the kubelet log?
rke2/pkg/cli/defaults/defaults.go
Line 15 in 86dc12b
logsDir := filepath.Join(dataDir, "agent", "logs") |
rke2/pkg/cli/defaults/defaults.go
Line 39 in 86dc12b
"log-file=" + filepath.Join(logsDir, "kubelet.log"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AH! I missed that already existing path! Thanks Brad! I'm actually going to move calico logs to there as well, I think it makes much more sense
39995dc
to
c7798e1
Compare
pkg/pebinaryexecutor/pebinary.go
Outdated
@@ -220,11 +220,16 @@ func (p *PEBinaryConfig) KubeProxy(ctx context.Context, args []string) error { | |||
|
|||
logrus.Infof("Running RKE2 kube-proxy %s", args) | |||
go func() { | |||
outputFile, err := os.Create(filepath.Join(p.DataDir, "agent", "logs", "kube-proxy.log")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend reusing or at least duplicating the code that we use to capture kubelet logs using lumberjack, which handles rotating and pruning logs. Otherwise this one log file may get very large.
Lines 38 to 40 in f2396b6
// ExtractFromArgs extracts the legacy klog flags from an args list, and returns both the remaining args, | |
// and a similarly configured log writer configured using the klog flag values. | |
func ExtractFromArgs(args []string) ([]string, io.Writer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea! I was actually wondering if these logs could get too large. I was not aware of this lumberjack library
Signed-off-by: Manuel Buil <[email protected]>
c7798e1
to
5bfdfb4
Compare
Proposed Changes
Following on from what we do with Calico processes, use a file to dump the logs of kube-proxy in windows. The current Stdout and Stderr output is supposed to be piped to the Windows Logging System but it does not work. Using a file instead works.
This PR also moves Calico logs to the same place where kubelet logs are. That place is
C:\var\lib\rancher\rke2\agent\logs
which makes much more senseTypes of Changes
Bugfix
Verification
Check issue
Testing
Linked Issues
#5247
User-Facing Change
Further Comments