When retrieving the logs using kubectl logs -l
, it returns the logs for some of the labels, but it does not return anything for some other labels.
For example:
~/ $ kubectl logs -n test -lapp=testapp
~/ $ kubectl logs -n test -lapp.kubernetes.io/instance=test
2019-07-30 15:28:39.913 INFO 1 ---
The labels of the deployment
:
~/ $ kubectl get deployments.apps -n test --show-labels
NAME READY UP-TO-DATE AVAILABLE AGE LABELS
testapp 1/1 1 1 55m app.kubernetes.io/instance=test,app=testapp
Thanks
Make sure both the deployment and template labels are properly set.
"template": {
"metadata": {
"labels": {
"app": "testapp",
"app.kubernetes.io/instance": "test"
}
},
You can use:
Hope this helps