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

Add KubernetesProbesOptionsValidator to ensure different ports for probes #5400

Merged

Conversation

makazeu
Copy link
Contributor

@makazeu makazeu commented Sep 4, 2024

Add the KubernetesProbesOptionsValidator to check if the 3 Kubernetes probes (liveness, startup, readiness) use different ports.

Context

If we set same ports for Kubernetes probes, it will cause issue below:

        builder.Services.AddKubernetesProbes(options =>
        {
            options.LivenessProbe.TcpPort = 2305;
            options.StartupProbe.TcpPort = 2305;
            options.ReadinessProbe.TcpPort = 2305;
        });
fail: Microsoft.Extensions.Diagnostics.Probes.TcpEndpointProbesService[1466257416]
      Error updating health status through TCP endpoint
      System.Net.Sockets.SocketException (10048): Only one usage of each socket address (protocol/network address/port) is normally permitted.
         at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
         at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
         at System.Net.Sockets.Socket.Bind(EndPoint localEP)
         at System.Net.Sockets.TcpListener.Start(Int32 backlog)
         at Microsoft.Extensions.Diagnostics.Probes.TcpEndpointProbesService.UpdateHealthStatusAsync(CancellationToken cancellationToken)
Microsoft Reviewers: Open in CodeFlow

@RussKie RussKie requested a review from mobratil September 9, 2024 00:14
@RussKie
Copy link
Member

RussKie commented Sep 9, 2024

@mobratil please triage and review

@RussKie RussKie added waiting-author-feedback 📭 The author of this issue needs to respond in order for us to continue investigating this issue. and removed waiting-on-team 👋 labels Sep 12, 2024
@dotnet-policy-service dotnet-policy-service bot removed the waiting-author-feedback 📭 The author of this issue needs to respond in order for us to continue investigating this issue. label Sep 13, 2024
@makazeu makazeu changed the title Add KubernetesProbesOptionsValidator to enforce different ports for probes Add KubernetesProbesOptionsValidator to ensure different ports for probes Sep 15, 2024
@makazeu makazeu requested a review from mobratil September 18, 2024 09:49
@RussKie
Copy link
Member

RussKie commented Sep 25, 2024

Thank you

@RussKie RussKie merged commit c799d76 into dotnet:main Sep 25, 2024
6 checks passed
@makazeu makazeu deleted the u/makazeu/KubernetesProbesOptionsValidator branch October 8, 2024 06:39
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants