Skip to content
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

Not possible to read calico/felix logs in rke2/windows #4411

Closed
manuelbuil opened this issue Jul 5, 2023 · 1 comment
Closed

Not possible to read calico/felix logs in rke2/windows #4411

manuelbuil opened this issue Jul 5, 2023 · 1 comment
Assignees

Comments

@manuelbuil
Copy link
Contributor

Environmental Info:
RKE2 Version:

Node(s) CPU architecture, OS, and Version:

OS: Windows

Cluster Configuration:

Any server Linux and at least one windows agent

Describe the bug:

The current code is not providing a meaningful way of checking the output of the calico or felix executing when doing rke2-windows with calico cni plugin. The code uses:

	cmd.Stdout = os.Stdout
	cmd.Stderr = os.Stderr

however, that does not work and in the rke2 service logs, we see nothing. In any case, that would be a non-ideal solution because those logs can be verbose. It is best if we had them in one file. According to calico, that should happen by default or can be configured with env vars (e.g. FELIX_LOGFILEPATH). However, it is not working in Windows

Steps To Reproduce:

  • Installed RKE2:

Deploy a windows node and try to find felix.log, it does not exist. Also check the logs of the rke2 service and there is nothing related to calico or felix

Expected behavior:

Be able to read logs in order to debug in case problems arise

Actual behavior:

Impossible to know what is going on

Additional context / logs:

@ShylajaDevadiga
Copy link
Contributor

Validated on master branch using commit id 33caf61

Environment Details

Infrastructure
Cloud EC2 instance

Node(s) CPU architecture, OS, and Version:
Ubuntu 22.04
Windows Server 2019

Cluster Configuration:
One linux server, one windows agent node

Config.yaml:

$ cat /etc/rancher/rke2/config.yaml 
write-kubeconfig-mode: 644
cni: calico
node-external-ip: <IP>
token: <TOKEN>

Validation steps

  1. Copy config.yaml
  2. Install rke2 server on linux node and agent on windows node
  3. Check felix.log under c:\var\log dir

Validation results:

Ubuntu node

$ curl -sfL https://get.rke2.io | sudo INSTALL_RKE2_COMMIT=33caf61cf1fc71cca522eaeac1d3541b5f3c417c sh -

$ sudo systemctl enable rke2-server
$ sudo systemctl start rke2-server

Windows node

Enable-WindowsOptionalFeature -Online -FeatureName containers –All
Invoke-WebRequest -Uri https://raw.githubusercontent.com/rancher/rke2/master/install.ps1 -Outfile install.ps1
New-Item -Type Directory c:/etc/rancher/rke2 -Force
Set-Content -Path c:/etc/rancher/rke2/config.yaml -Value @"
server: https://<SERVER IP>:9345
token: <TOKEN>

"@
$env:PATH+=";c:\var\lib\rancher\rke2\bin;c:\usr\local\bin"

[Environment]::SetEnvironmentVariable(
    "Path",
    [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine) + ";c:\var\lib\rancher\rke2\bin;c:\usr\local\bin",
    [EnvironmentVariableTarget]::Machine)

./install.ps1 -Commit 33caf61cf1fc71cca522eaeac1d3541b5f3c417c
rke2.exe agent service --add
Get-Service rke2
Start-Service rke2
$ kubectl get nodes 
NAME              STATUS   ROLES                       AGE   VERSION
ip-172-31-28-76   Ready    control-plane,etcd,master   25m   v1.27.3+rke2r1
ip-ac1f1030       Ready    <none>                      9s    v1.27.3

ssh to windows node or login using RDP client and check for logs on the windows node

administrator@IP-AC1F1030 C:\>dir c:\var\log\                                                                                                                                     
 Volume in drive C has no label.                                                                                                                                                  
 Volume Serial Number is 18D6-3571                                                                                                                                                
                                                                                                                                                                                  
 Directory of c:\var\log                                                                                                                                                          
                                                                                                                                                                                  
07/19/2023  03:16 AM    <DIR>          .                                                                                                                                          
07/19/2023  03:16 AM    <DIR>          ..                                                                                                                                         
07/19/2023  03:16 AM             8,325 calico-node.log                                                                                                                            
07/19/2023  03:16 AM    <DIR>          containers                                                                                                                                 
07/19/2023  03:21 AM            81,875 felix.log                                                                                                                                  
07/19/2023  03:16 AM    <DIR>          pods                                                                                                                                       
               2 File(s)         90,200 bytes                                                                                                                                     
               4 Dir(s)  32,674,553,856 bytes free  
administrator@IP-AC1F1030 C:\>more c:\var\log\felix.log
2023-07-19 03:16:15.843 [INFO][5556] felix/daemon.go 396: Successfully loaded configuration. GOMAXPROCS=4 builddate="2023-06-17T00:47:38+0000" config=&config.Config{UseInternalDataplaneDriver:true, DataplaneDriver:"calico-iptables-plugin", DataplaneWatchdogTimeout:90000000000, WireguardEnabled:false, WireguardEnabledV6:false, WireguardListeningPort:51820, WireguardListeningPortV6:51821, WireguardRoutingRulePriority:99, WireguardInterfaceName:"wireguard.cali", WireguardInterfaceNameV6:"wg-v6.cali", WireguardMTU:0, WireguardMTUV6:0, WireguardHostEncryptionEnabled:false, WireguardPersistentKeepAlive:0, BPFEnabled:false, BPFDisableUnprivileged:true, BPFLogLevel:"off", BPFDataIfacePattern:(*regexp.Regexp)(0xc000564280), BPFL3IfacePattern:(*regexp.Regexp)(nil), BPFConnectTimeLoadBalancingEnabled:true, BPFExternalServiceMode:"tunnel", BPFDSROptoutCIDRs:[]string(nil), BPFKubeProxyIptablesCleanupEnabled:true, BPFKubeProxyMinSyncPeriod:1000000000, BPFKubeProxyEndpointSlicesEnabled:true, BPFExtToServiceConnmark:0, BPFPSNATPorts:numorstring.Port{MinPort:0x4e20, MaxPort:0x752f, PortName:""}, BPFMapSizeNATFrontend:65536, 
...
...

Validated log file is removed after uninstall

administrator@IP-AC1F1030 C:\> c:/usr/local/bin/rke2-uninstall.ps1
administrator@IP-AC1F1030 C:\>dir c:\var\log\                                                                                                                                     
 Volume in drive C has no label.                                                                                                                                                  
 Volume Serial Number is 18D6-3571                                                                                                                                                
                                                                                                                                                                                  
 Directory of c:\var\log                                                                                                                                                          
                                                                                                                                                                                  
07/19/2023  03:48 AM    <DIR>          .                                                                                                                                          
07/19/2023  03:48 AM    <DIR>          ..                                                                                                                                         
               0 File(s)              0 bytes                                                                                                                                     
               2 Dir(s)  33,890,140,160 bytes free                                                                                                                                
                                                                                                                                                                                  
administrator@IP-AC1F1030 C:\>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants