InClusterConfig no more working on non-root workdir
This change (06380095b46bc20463cf39d59e15fd5f69850a51) changes the path.
In Linux it looks now like: "var/run/secrets/kubernetes.io/serviceaccount/" before it was: "/var/run/secrets/kubernetes.io/serviceaccount/" --> Notice the missing forwarding slash at begin.
If an application is not running in the root directory, IsInCluser and InClusterConfig won't work anymore.
In addition, the path on windows is converted to: "var\run\secrets\kubernetes.io\serviceaccount/" which also doesn't look very pretty (and has the same issue)...
Just tried to update my project to 1.6.8 and ran into this problem as well.
Made a PR: #342
+1 for this as an issue. I've reproduced this as well.
My app is running from /app and IsInCluster isn't behaving correctly.
I got the unable to load in-cluster configuration, KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT must be defined error and investigated what IsInCluster does. My app is able to print the environment variables of interest and can read the token/ca.crt given hardcoded paths.
I confirmed that this is generating a non-rooted path:
var path = Path.Combine(new string[] {
"var", "run", "secrets", "kubernetes.io", "serviceaccount/"
});
logger.LogInformation("Path: {PATH}", path); // logs Path: var/run/secrets/kubernetes.io/serviceaccount/
Downgrading to 1.6.6 resolves the issue.
Ran into problem as well. Seems like issue with InClusterConfig. Downgrading to 1.6.6 resolves the issue.
This fix was merged into release 1.6.9 can someone validate if that indeed fixes what they were seeing?
Thanks!
I updated to 1.6.10 and I am no longer seeing the error.
Great to hear, closing this issue.