-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
No container id found by container id providers after AKS upgrade 1.23->1.25 #344
Comments
Hi @TTmaister, this is a known issue because of the implementations of docker engines. There has been a related issue #290. Please check out the design doc here for the container id providers: https://github.com/microsoft/ApplicationInsights-Kubernetes/wiki/Design-for-ContainerIdProviders That said, 2 questions for you:
Any proposal for how to make this more adaptive is super-welcome! BTW, just FYI, here's a lengthy stackoverflow discussion on the topic: And an open standard issue: |
|
Hey @TTmaister, thanks for providing the information. Unfortunately, without container id anywhere in the container, we won't have the magic to somehow make it available. Manually set the environment would probably be the only way that will provide full enhancement. That said, could you please help me understand what the telemetry looks like on your end? I assume container id missing but everything else, like |
Application Insight is missing all the data brought by the plugin. I can see in Application Insight that the POD requests information about the POD from the Kubernetes API and gets the response http200. |
Hey @xiaomi7732 Does it make any sense to change the ContainerIdHolder class to be able to parse the ContainerName variable from the environment variables. And then filtter ContainerStatus by ContainerName
ContinerName can be defined as environment variable Kubernetes Deployment yaml.
Or some other label. We have set "app" label for all deployments. |
Hi @TTmaister, using With regarding what is going on, I think I see it. Container id was supposed to be optional, but it is required - in between several iterations to support .NET 6 and the latest K8s SDK. See below for the details: It was like this, there had been a note to allow empty container id. // Notes: It is still possible for the optional container id to be empty at this point, the following method needs to handle the case.
if (!await SpinWaitContainerReadyAsync(timeoutAt, queryClient, myPod, containerId, cancellationToken).ConfigureAwait(false))
{
_logger.LogError(Invariant($"Kubernetes info is not available before the timeout at {timeoutAt}."));
return null;
} And in the implementation, this is the logic to allow empty container id: if (!string.IsNullOrEmpty(myContainerId))
{
// Check targeted container status
readyToGo = IsContainerReady(podInfo.GetContainerStatus(myContainerId));
}
else
{
_logger.LogWarning("No container id available. Fallback to use the any container for status checking.");
readyToGo = podInfo.GetAllContainerStatus().Any(s => IsContainerReady(s));
} And it is like this now, meaning optional container id is not allowed: public async Task<bool> IsContainerReadyAsync(CancellationToken cancellationToken)
{
V1ContainerStatus? myContainerStatus = await GetMyContainerStatusAsync(cancellationToken).ConfigureAwait(false);
if (myContainerStatus is not null)
{
return IsContainerStatusReady(myContainerStatus);
}
return false;
} That doesn't agree with the design that I shared earlier and shall be treated as a bug. Will it unblock you if I make it optional again? |
Pod can be recreate with the same name, but there can only be one with the same name at a time. Object Names and IDs If I tested it right... if Container Id missing then Application Insight not showing "Cloud Role Name".
|
That is correct. FYI, the line of code: Line 63 in a394b16
|
I think there could be 2 fixes:
And I inspected various options to back fill container id, and I think using container name is a very good idea. It might worth a bit documentation but could be useful as an alternative to container ids. @TTmaister are you interested to submit a PR for it? Or I can prepare a PR if you don't have the time. BTW, if you are interested, please fork this repository, and branching off your own fork since this repository has been locked down and nobody could PR into it directly. :-) |
@TTmaister your change has been released: https://www.nuget.org/packages/Microsoft.ApplicationInsights.Kubernetes/6.1.1-beta2 Let me know if that unblocks you. Thank you for your contribution! |
Works as expected.
@xiaomi7732 Maybe this should be documented to project readme. |
@TTmaister, thanks for the verification! I will update the wiki. I'll keep this issue open until the stable version of 6.1.1 got released. |
A FAQ is added: |
Is there an Eta on when the version 6.1.1 will be released?, Thx! |
Hey @Ismael-Pep, thanks for the inquiry. Here's the new package is released today: |
After upgrade AKS 1.23.x to 1.25.x Application Insight Kubernetes addon can't get container Id if multiple container are used.
RBAC roles and binding has been same before upgrade.
ContainerIdProviders not
The text was updated successfully, but these errors were encountered: