Debugging Application

KubeVela supports several CLI commands for debugging your applications, they can work on control plane and help you access resources across multi-clusters. Which also means you can play with your pods in managed clusters directly on the hub cluster, without switching KubeConfig context. If you have multiple clusters in on application, the CLI command will ask you to choose one interactively.

List all your applications.

  1. vela ls

expected output

``` APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME war war java-war running healthy Ready:1/1 2022-09-30 17:32:29 +0800 CST ck-instance ck-instance clickhouse running healthy 2022-09-30 17:38:13 +0800 CST kubecon-demo hello-world java-war gateway running healthy Ready:1/1 2022-10-08 11:32:47 +0800 CST ck-app my-ck clickhouse gateway running healthy Host not specified, visit the cluster or load balancer in 2022-10-08 17:55:20 +0800 CST front of the cluster with IP: 47.251.8.82 demo2 catalog java-war workflowSuspending healthy Ready:1/1 2022-10-08 16:22:11 +0800 CST ├─ customer java-war workflowSuspending healthy Ready:1/1 2022-10-08 16:22:11 +0800 CST └─ order-web java-war gateway workflowSuspending healthy Ready:1/1 2022-10-08 16:22:11 +0800 CST kubecon-demo2 hello-world2 java-war gateway workflowSuspending healthy Ready:1/1 2022-10-08 11:48:41 +0800 CST ```

  • vela status can give you an overview of your deployed multi-cluster application.
  1. vela up -f https://kubevela.net/example/applications/first-app.yaml
  2. vela status first-vela-app

expected output

  1. About:
  2. Name: first-vela-app
  3. Namespace: default
  4. Created at: 2022-10-09 12:10:30 +0800 CST
  5. Status: workflowSuspending
  6. Workflow:
  7. mode: StepByStep
  8. finished: false
  9. Suspend: true
  10. Terminated: false
  11. Steps
  12. - id: g1jtl5unra
  13. name: deploy2default
  14. type: deploy
  15. phase: succeeded
  16. message:
  17. - id: 6cq88ufzq5
  18. name: manual-approval
  19. type: suspend
  20. phase: running
  21. message:
  22. Services:
  23. - Name: express-server
  24. Cluster: local Namespace: default
  25. Type: webservice
  26. Healthy Ready:1/1
  27. Traits:
  28. scaler
  • vela status --pod can list the pod status of your application.
  1. vela status first-vela-app --pod

expected output

  1. CLUSTER COMPONENT POD NAME NAMESPACE PHASE CREATE TIME REVISION HOST
  2. local express-server express-server-b768d95b7-qnwb4 default Running 2022-10-09T04:10:31Z izrj9f9wodrsepwyb9mcetz
  • vela status --endpoint can list the access endpoints of your application.
  1. vela status first-vela-app --endpoint

expected output

  1. Please access first-vela-app from the following endpoints:
  2. +---------+----------------+--------------------------------+-----------------------------+-------+
  3. | CLUSTER | COMPONENT | REF(KIND/NAMESPACE/NAME) | ENDPOINT | INNER |
  4. +---------+----------------+--------------------------------+-----------------------------+-------+
  5. | local | express-server | Service/default/express-server | express-server.default:8000 | true |
  6. +---------+----------------+--------------------------------+-----------------------------+-------+
  • vela status --tree --detail can list resources of your application.
  1. vela status first-vela-app --tree --detail

expected output

  1. CLUSTER NAMESPACE RESOURCE STATUS APPLY_TIME DETAIL
  2. local ─── default ─┬─ Service/express-server updated 2022-10-09 12:10:30 Type: ClusterIP Cluster-IP: 10.43.212.235 External-IP: <none> Port(s): 8000/TCP Age: 6m44s
  3. └─ Deployment/express-server updated 2022-10-09 12:10:30 Ready: 1/1 Up-to-date: 1 Available: 1 Age: 6m44s
  • vela logs shows pod logs in managed clusters.
  1. vela logs first-vela-app

expected output

  1. + express-server-b768d95b7-qnwb4 express-server
  2. express-server 2022-10-09T12:10:33.785549770+08:00 httpd started
  • vela exec helps you execute commands in pods in managed clusters.
  1. vela exec first-vela-app -it -- ls

expected output

  1. bin dev etc home proc root sys tmp usr var www
  • vela port-forward can discover and forward ports of pods or services in managed clusters to your local endpoint.
  1. vela port-forward first-vela-app 8001:8000

You can curl this app by curl http://127.0.0.1:8001/.

Please refer to the CLI docs.

Last updated on 2023年8月4日 by Daniel Higuero