Calico node return nothing for command "/bin/calico-node -felix-ready"

11/3/2020

I'm a beginner developer of k8s system.
I want to check the readiness of calico node, so I sent a command to the node like below.

$kubectl exec calico-node-d4tzk -n kube-system -- /bin/calico-node -felix-ready

But nothing returns. I checked the logs of the node but there is no logs about the command too.
I wonder returning nothing means that felix is ready.

-- Togomi
calico
kubernetes

1 Answer

11/5/2020

I found answer for myself, but I'm not sure whether it is correct or not.
In projectcaclico/node/cmd/calico-node/main.go Line 98, there are commands about checking liveness and readiness.

if *felixLive || *birdReady || *bird6Ready || *felixReady || *birdLive || *bird6Live {
		health.Run(*birdReady, *bird6Ready, *felixReady, *felixLive, *birdLive, *bird6Live, *thresholdTime)
		os.Exit(0)
	}

and then I looked into Run() function. In there, I found code about felixReady.

	if felixReady {
		g.Go(func() error {
			if err := checkFelixHealth(ctx, felixReadinessEp, "readiness"); err != nil {
				return fmt.Errorf("calico/node is not ready: felix is not ready: %+v", err)
			}
			return nil
		})
	}

As you can see, it returns nil when there is no problem. That's why I think that no returning means felix is ready.

-- Togomi
Source: StackOverflow