Version: v1.3

Debug in the environment

This feature is available in KubeVela v1.4.

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. polices:
  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 in the environment - 图1

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 in the environment - 图2

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 in the environment - 图3

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

Debug in the environment - 图4

Last updated on Nov 1, 2022 by Tianxin Dong