Version: v1.8

Debug Workflow

Debug Workflow - 图1caution

Debug workflow will run workflow in the real environment, make sure you’re debugging in the test environment.

The debugging process also requires the knowledge of the Kubernetes infrastructure, you may need the help of the platform team if you’re the app developer.

When you deploy your application in a test environment and find problems with the application, you may want to debug the application in the environment. KubeVela provides the vela debug command to help you debug your application in the environment.

If your application uses workflow, make sure your app has the debug policy before using the vela debug command:

  1. policies:
  2. - name: debug
  3. type: debug

You can also use vela up -f <application yaml> --debug to automatically add debug policy to your application.

For applications that use workflows, vela debug will first list all the steps in the workflow, and you can select the specified steps to debug. After selecting a step, you can view the contents of all CUE variables in that step individually. Among them: do and provider marked in yellow are the CUE actions used this time, and the error content will be marked in red.

Debug Workflow - 图2

You can also use vela debug <application-name> -s <step-name> -f <variable> to view the contents of specified variables in a single step.

Debug Workflow - 图3

If your application only uses components, not workflows, then, you can use the vela debug <application-name> command directly to debug your application.

Deploy the following application. The first component will use k8s-objects to create a Namespace, and the second component will use the webservice with gateway trait to create a Deployment and its corresponding Service and Ingress.

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: gateway-app
  5. spec:
  6. components:
  7. - name: comp-namespace
  8. type: k8s-objects
  9. properties:
  10. objects:
  11. - apiVersion: v1
  12. kind: Namespace
  13. metadata:
  14. name: test-ns1
  15. - name: express-server
  16. type: webservice
  17. properties:
  18. image: oamdev/hello-world
  19. ports:
  20. - port: 8000
  21. traits:
  22. - type: gateway
  23. properties:
  24. domain: testsvc.example.com
  25. http:
  26. "/": 8000

After the application is deployed, you can use the vela debug <application-name> command to view all the resources rendered by the application.

Debug Workflow - 图4

You can also use vela debug <application-name> -s <component-name> to see all resources rendered in a single component.

Debug Workflow - 图5

Last updated on May 6, 2023 by Tianxin Dong