-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Can a pod discover its namespace? #9474
Comments
I filed #9433 yesterday related to pod and namespace and more discussion can be found at: #9356 (comment) |
@dchen1107: thanks for that link, although I don't know that it applies here. To be clear - I'm inside a container, and I would like to get the pod info that applies to me from the API. I don't know how to get my namespace, nor am I certain that my hostname was always my name. I did figure out that I could look at my IP, which is my podIP in the API. Sadly I don't think I'm allowed to use that as a fieldSelector ( |
@justinsb - you can get the namespace information from the downward API. see the example here: https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/downward_api.md Closing the issue, re-open if this did not address your concern. |
Thanks @derekwaynecarr - that is a good option that I wasn't aware of! I was hoping for something that didn't require the manifest writer to do anything, but maybe that's over-optimizing. (I'm thinking about packaged k8s apps that can just be deployed and will self-configure, but it'll probably involve a service & and an rc anyway so this would actually work great). Between this and the option of querying the k8s API I have some reasonable options! |
In #9473 I asked if there was an easy way to discover resource limits without querying the API. But maybe I should just be querying the API... It seems easy, except that I don't know how to find my namespace.
I think I can do this:
And then I get everything (labels, resources etc), which is great.
But:
The text was updated successfully, but these errors were encountered: