Actually, my bad - I didn't read your question carefully enough. You wanted to access that annotation, but from inside a pod.

That can be done too. I've run scripts inside a pod that query the kubernetes api server for information like that. I don't have a code example for that handy, unfortunately, but it would be similar to my previous response, and look something like this:

curl https://<kubernetes api>:443/api/... | jq -r '.items[].metadata.annotations' | less

More details here: https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-api/#without-kubectl-proxy

HTH,

DR

On 05/01/2018 02:13 PM, David Rosenstrauch wrote:
kubectl get deployment myapp -o json

You could then run it through a json parser to strip out what you want. E.g.:

kubectl get deployment -o json | jq -r '.items[].metadata.annotations' | less

HTH,

DR

On 05/01/2018 01:14 PM, Kir Shatrov wrote:
Hi all,

I'm looking for some help with exposing annotations.

Each Deployment gets this annotation:

$ kubectl describe deployment/myapp
Name:                   myapp
Namespace:              default
CreationTimestamp:      Sat, 24 Mar 2018 23:27:42 +0100
Labels:                 app=myapp
Annotations:            deployment.kubernetes.io/revision=5

Is there a way to read that annotation (deployment.kubernetes.io/revision)
from a pod that belongs to the deployment?

I tried Downward API, but that only allows to expose annotations of the *pod
itself* (not of its deployment).



--
You received this message because you are subscribed to the Google Groups "Kubernetes 
user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.
  • [kubernetes-... Kir Shatrov
    • Re: [ku... David Rosenstrauch
      • Re:... David Rosenstrauch
        • ... Kir Shatrov
          • ... 'Ahmet Alp Balkan' via Kubernetes user discussion and Q&A

Reply via email to