Open doggy8088 opened 3 years ago
I tried to run a wrong command:
func logs --platform kubernetes --name a/b
I can see errors finally with some meaningful message:
Function logs:
Error from server (BadRequest): Unable to find "/v1, Resource=pods" that match label selector "app=a/b-deployment", field selector "": unable to parse requirement: values[0][app]: Invalid value: "a/b-deployment": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue', or 'my_value', or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
Error running kubectl logs -l app=a/b-deployment -n azure-functions.
output: Error from server (BadRequest): Unable to find "/v1, Resource=pods" that match label selector "app=a/b-deployment", field selector "": unable to parse requirement: values[0][app]: Invalid value: "a/b-deployment": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue', or 'my_value', or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')
So this is the actual command behind the scene:
kubectl logs -l app=FUNCTIONNAME-deployment -n azure-functions
It's obvious that the label of the deployment is wrong. My actual label is app=funapp1-http
. So func logs --platform kubernetes --name funapp1
is actually query for app=funapp1-deployment
which is wrong.
I'm using Azure Functions Core Tools
v3
.I deploy my function app to my local kubernetes.
I can deploy my function app to my local kubernetes successfully.
I tried to show logs for my function
It's always show
No resources found in azure-functions namespace
.I actually can retrieve logs using
kubectl
command.I can show logs using the following command too.
I have no clue how to use
func logs
command. Is it a bug? Or what should I do? I never have a chance to see logs usingfunc logs
command.Here is my current info: