fleet: fleet-agent-register crashes maybe with missing leases

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

0.12.0 fleet-agent-0 Init:crashloopbackoff within fleet-agent-register

$ kubectl get pods -n cattle-fleet-local-system
NAME            READY   STATUS                  RESTARTS        AGE
fleet-agent-0   0/2     Init:CrashLoopBackOff   5 (2m29s ago)   5m33s

Expected Behavior

No response

Steps To Reproduce

Upgrade rancher 2.11.0 from 2.10.3

Environment

- Architecture: arm64
- Fleet Version: 0.12.0
- Cluster:
  - Provider: k3s
  - Options: Deployed by rancher-2.11.0
  - Kubernetes Version: v1.31.3+k3s1

Logs

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x2042b7c]
goroutine 1 [running]:
github.com/rancher/fleet/internal/cmd/agent.(*FleetAgent).Run(0x4000b2fa40, 0x4000b42008, {0x0?, 0x0?, 0x0?})
	/home/runner/_work/fleet/fleet/internal/cmd/agent/root.go:123 +0x33c
github.com/rancher/fleet/internal/cmd.Command.bind.func4(0x4000b42008, {0x40003c18b0, 0x1, 0x1})
	/home/runner/_work/fleet/fleet/internal/cmd/builder.go:272 +0xf8
github.com/spf13/cobra.(*Command).execute(0x4000b42008, {0x400004c0b0, 0x1, 0x1})
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1015 +0x82c
github.com/spf13/cobra.(*Command).ExecuteC(0x4000b42008)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1148 +0x350
github.com/spf13/cobra.(*Command).Execute(...)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1071
github.com/spf13/cobra.(*Command).ExecuteContext(0x4000078738?, {0x2d804e0?, 0x4000b2f9f0?})
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1064 +0x48
main.main()
	/home/runner/_work/fleet/fleet/cmd/fleetagent/main.go:16 +0x34

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 21 (4 by maintainers)

Most upvoted comments

We had a similar problem.

In our case, the gitjob container also didn’t start (or crashloop). The logs hinted us in the Direction, that some Gitrepo resources were faulty after the update.

In the Status of some there were

perClusterState: 
- {}

I’ve changed them all to

perClusterState: {}

important: to update the status, you need to use the --subresource=status flag.

After that, everything worked fine again for us. Might be a completely other Problem at your end, but maybe that helps.

worked for me as well. For those struggling how to fix: check for faulty resources:

for i in $(kubectl get GitRepo -n fleet-default | awk '{ print $1 }'); do kubectl get GitRepo -n fleet-default $i -o yaml | grep -A2 perClusterState && echo $i; done

if you see it as

perClusterState: 
 - {}

get the resource: kubectl get GitRepo -n fleet-default [resource] -o yaml > cr.yaml, edit status and:

  1. fix perClusterState to perClusterState: {}
  2. ADD perClusterState: {} to each other status resources.

apply it: kubectl replace --subresource status -f cr.yaml

We had a similar problem.

In our case, the gitjob container also didn’t start (or crashloop). The logs hinted us in the Direction, that some Gitrepo resources were faulty after the update.

In the Status of some there were

perClusterState: 
- {}

I’ve changed them all to

perClusterState: {}

important: to update the status, you need to use the --subresource=status flag.

After that, everything worked fine again for us. Might be a completely other Problem at your end, but maybe that helps.

I have the same after upgrading rancher from 2.10.3 to 2.11.0 with an amd64 v1.31.7+rke2r1

I can confirm 2.11.1 fixed my issues

The issues mentioned here which could be reproduced have been fixed. Closing.

I am not using --reuse-values in my helm upgrade command either. And I tried already force redeploying the agent. kubectl patch command returns no change (so it doesn’t fix).