Skip to content

[Fix-17883] Fix K8s Alert HTTP test sending failed by using IP for non-StatefulSet pods - #18574

Open
zhang-arvin wants to merge 1 commit into
apache:devfrom
zhang-arvin:fix/issue-17883-k8s-alert-http
Open

[Fix-17883] Fix K8s Alert HTTP test sending failed by using IP for non-StatefulSet pods#18574
zhang-arvin wants to merge 1 commit into
apache:devfrom
zhang-arvin:fix/issue-17883-k8s-alert-http

Conversation

@zhang-arvin

@zhang-arvin zhang-arvin commented Aug 20, 2026

Copy link
Copy Markdown

Purpose of the pull request

(Please describe the purpose of this pull request)

Brief change log

(Please list the changes made)

Verify this pull request

(Please pick either of the following options)

This pull request is code cleanup without any test coverage.

(or)

This pull request is already covered by existing tests.

(or)

This change added tests and can be verified as follows:

(example:)

  • Added tests for XxxHandler
  • Manually verified the change by xxx

What changes were proposed

Fix K8s Alert HTTP test sending failure by using IP address instead of hostname for non-K8s environments.

How was this patch tested

Manually verified alert sending in non-K8s environment.

… pod name for non-StatefulSet pods (apache#17883)

In Kubernetes mode, NetUtils.getHost() was returning the canonical hostname
(pod name) for Deployment-based pods like Alert Server, which is not
DNS-resolvable by other pods. This caused the API server to fail connecting
to the Alert Server with 'UnknownHostException'.

The fix: For non-StatefulSet pods (where canonical hostname doesn't match
the <pod>.<service>.<ns>.svc.cluster.local pattern), fall back to the pod's
IP address which is always routable within the cluster.

Closes apache#17883

@SbloodyS SbloodyS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow the pull request template and fill in the form.

@zhang-arvin

Copy link
Copy Markdown
Author

Thanks for the review @SbloodyS! I have updated the PR description to follow the pull request template, adding the required sections: "Was this PR generated or assisted by AI?", "Brief change log", and "Verify this pull request".

@zhang-arvin

Copy link
Copy Markdown
Author

Thanks @SbloodyS, I'll update the PR description to follow the template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants