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

Fix error log when agent fails to connect to K8s API #5353

Merged
merged 1 commit into from
Aug 4, 2023

Conversation

tnqn
Copy link
Member

@tnqn tnqn commented Aug 3, 2023

When agent fails to connect to K8s API, the previous error logs about empty PodCIDR has no basis, and it shouldn't suggest users to check kube-controller-manager configuration.

E0803 11:57:06.000640 1 agent.go:926] "Spec.PodCIDR is empty for Node. Please make sure --allocate-node-cidrs is enabled for kube-controller-manager and --cluster-cidr specifies a sufficient CIDR range" err="failed to get Node with name kind-worker from K8s: Get "https://1.1.1.1/api/v1/nodes/kind-worker\": dial tcp 1.1.1.1:443: i/o timeout" nodeName="kind-worker"
F0803 11:57:06.001470 1 main.go:53] Error running agent: error initializing agent: CIDR string is empty for Node kind-worker

This patch fixes the error logs by differentiating ErrWaitTimeout from other errors. Only the former means the PodCIDR is empty.

When the PodCIDR is empty:

I0803 12:23:33.380739 1 agent.go:921] "Waiting for Node PodCIDR configuration to complete" nodeName="kind-worker2"
I0803 12:23:38.388378 1 agent.go:921] "Waiting for Node PodCIDR configuration to complete" nodeName="kind-worker2"
I0803 12:23:43.387476 1 agent.go:921] "Waiting for Node PodCIDR configuration to complete" nodeName="kind-worker2"
I0803 12:23:48.388400 1 agent.go:921] "Waiting for Node PodCIDR configuration to complete" nodeName="kind-worker2"
I0803 12:23:53.388225 1 agent.go:921] "Waiting for Node PodCIDR configuration to complete" nodeName="kind-worker2"
I0803 12:23:58.387538 1 agent.go:921] "Waiting for Node PodCIDR configuration to complete" nodeName="kind-worker2"
I0803 12:24:03.387824 1 agent.go:921] "Waiting for Node PodCIDR configuration to complete" nodeName="kind-worker2"
I0803 12:24:03.393946 1 agent.go:921] "Waiting for Node PodCIDR configuration to complete" nodeName="kind-worker2"
E0803 12:24:03.394044 1 agent.go:928] "Spec.PodCIDR is empty for Node. Please make sure --allocate-node-cidrs is enabled for kube-controller-manager and --cluster-cidr specifies a sufficient CIDR range, or nodeIPAM is enabled for antrea-controller" err="timed out waiting for the condition" nodeName="kind-worker2"
F0803 12:24:03.396010 1 main.go:53] Error running agent: error initializing agent: Spec.PodCIDR is empty for Node kind-worker2

When connection fails:

F0803 12:17:02.228931 1 main.go:53] Error running agent: error initializing agent: failed to get Node with name kind-worker from K8s: Get "https://1.1.1.1/api/v1/nodes/kind-worker": dial tcp 1.1.1.1:443: i/o timeout

When agent fails to connect to K8s API, the previous error logs about
empty PodCIDR has no basis, and it shouldn't suggest users to check
kube-controller-manager configuration.

This patch fixes the error logs by differentiating ErrWaitTimeout from
other errors. Only the former means the PodCIDR is empty.

Signed-off-by: Quan Tian <[email protected]>
@tnqn tnqn added the action/release-note Indicates a PR that should be included in release notes. label Aug 3, 2023
@tnqn tnqn requested a review from antoninbas August 3, 2023 12:27
@tnqn
Copy link
Member Author

tnqn commented Aug 3, 2023

/test-all

@tnqn tnqn merged commit 4746217 into antrea-io:main Aug 4, 2023
@tnqn tnqn deleted the fix-log branch August 4, 2023 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/release-note Indicates a PR that should be included in release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants