What if the service deployed in Knative is abnormal? Don't worry. This article teaches you to step by step in Knative.
View command line output
Check whether the command output to execute the deployment is successful or not. If the command deployment is interrupted, you can see the reason for the deployment failure in the output information. Generally, such errors are caused by configuration file configuration problems. For example, the following error message is due to the fact that the flow ratio of the configuration is not equal to 100.
Error from server (InternalError): error when applying patch: {"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"serving.knative.dev/v1alpha1\",\"kind\":\"Route\",\"metadata\":{\"annotations\":{},\"name\":\"route-example\",\"namespace\":\"default\"},\"spec\":{\"traffic\":[{\"configurationName\":\"configuration-example\",\"percent\":50}]}}\n"}},"spec":{"traffic":[{"configurationName":"configuration-example","percent":50}]}} to: &{0xc421d98240 0xc421e77490 default route-example STDIN 0xc421db0488 264682 false} for: "STDIN": Internal error occurred: admission webhook "webhook.knative.dev" denied the request: mutation failed: The route must have traffic percent sum equal to 100. ERROR: Non-zero return code '1' from command: Process exited with status 1
View Application Log
In general, service exceptions allow you to view the current application Pod log information directly. It is recommended to use log service to collect logs. This allows you to view the current application exception information directly in the log service.
View the log information of the user-container container in the current application Pod:
kubectl logs <pod-name> user-container
Check routing status
Route's status information can be viewed by following commands:
kubectl get route <route-name> --output yaml
Through status judgment, you can see reason ing information in exceptional cases
Check Ingress routing
View IP address information of Istio Gateway
kubectl get svc -n istio-system istio-ingressgateway
Check whether there is EXTERNAL-IP ip. If not, it is usually due to insufficient quotas.
Check the Revision status
View the Revision information and execute the following commands:
kubectl get revision <revision-name> --output yaml
If the service is normal, the following information should be provided:
conditions: - lastTransitionTime: 2019-08-20T07:52:59Z status: "True" type: Ready
Check Pod status
Execute orders:
$ kubectl get pods NAME READY STATUS RESTARTS AGE configuration-example-00001-deployment-659747ff99-9bvr4 2/2 Running 0 3h configuration-example-00002-deployment-5f475b7849-gxcht 1/2 CrashLoopBackOff 2 36s
Continue to see the status of Pod:
kubectl get pod <pod-name> --output yaml
If a user-container exception is found in containerStatuses, it can be analyzed by looking at the application log above.
Check the Controller component
Check if the current Controller component is working
$kubectl -n knative-serving get pod NAME READY STATUS RESTARTS AGE activator-75b69857b7-6rnln 2/2 Running 2 21d autoscaler-674d79f79c-2zlmh 2/2 Running 1 21d autoscaler-hpa-679868bd9-zlk6t 1/1 Running 0 21d controller-5855f47556-qrfgd 1/1 Running 0 21d networking-istio-6c8d6774f8-944b7 1/1 Running 0 21d webhook-65f55b444f-stq28 1/1 Running 0 21d
See if there is any exception information output in the controller
kubectl -n knative-serving logs --tail=1000 controller-5855f47556-qrfgd
Summary
You may encounter various problems in deploying Knative services. I hope to help you with the survey methods described above.
This article is the original content of Yunqi Community, which can not be reproduced without permission.