Version: v1.1

The Application Model

KubeVela introduces Open Application Model (OAM) to capture a full deployment of micro-services application across hybrid environments.

Application

With this model, a typical deployment plan in KubeVela looks as below:

  1. # sample.yaml
  2. apiVersion: core.oam.dev/v1beta1
  3. kind: Application
  4. metadata:
  5. name: website
  6. spec:
  7. components:
  8. - name: frontend # e.g. we want to deploy a frontend component and serves as web service
  9. type: webservice
  10. properties:
  11. image: nginx
  12. traits:
  13. - type: cpuscaler # e.g. we add a CPU based auto scaler to this component
  14. properties:
  15. min: 1
  16. max: 10
  17. cpuPercent: 60
  18. - type: sidecar # add a sidecar container into this component
  19. properties:
  20. name: "sidecar-test"
  21. image: "fluentd"
  22. - name: backend
  23. type: worker
  24. properties:
  25. image: busybox
  26. cmd:
  27. - sleep
  28. - '1000'
  29. policies:
  30. - name: demo-policy
  31. type: env-binding
  32. properties:
  33. envs:
  34. - name: test
  35. placement:
  36. clusterSelector:
  37. name: cluster-test
  38. - name: prod
  39. placement:
  40. clusterSelector:
  41. name: cluster-prod
  42. workflow:
  43. steps:
  44. #workflow step name
  45. - name: deploy-test-env
  46. type: deploy2env
  47. properties:
  48. # Specify the policy name
  49. policy: demo-policy
  50. # Specify the env name in the policy
  51. env: test
  52. - name: manual-approval
  53. # use suspend can stop workflow and wait here until condition changed
  54. type: suspend
  55. - name: deploy-prod-env
  56. type: deploy2env
  57. properties:
  58. # Specify the policy name
  59. policy: demo-policy
  60. # Specify the env name in the policy
  61. env: prod

Components

An application could be composed by multiple components. KubeVela already built-in with several widely used components definitions to help you model an application deployment, you can list them by using KubeVela CLI:

  1. vela components

The output shows:

  1. NAME NAMESPACE WORKLOAD DESCRIPTION
  2. helm vela-system autodetects.core.oam.dev helm release is a group of K8s resources from either git
  3. repository or helm repo
  4. kustomize vela-system autodetects.core.oam.dev kustomize can fetching, building, updating and applying
  5. Kustomize manifests from git repo.
  6. task vela-system jobs.batch Describes jobs that run code or a script to completion.
  7. webservice vela-system deployments.apps Describes long-running, scalable, containerized services
  8. that have a stable network endpoint to receive external
  9. network traffic from customers.
  10. worker vela-system deployments.apps Describes long-running, scalable, containerized services
  11. that running at backend. They do NOT have network endpoint
  12. to receive external network traffic.
  13. alibaba-ack vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud ACK cluster
  14. alibaba-oss vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud OSS object
  15. alibaba-rds vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud RDS object

Traits

Traits are operational behaviors that you can attach to component. KubeVela also has built-in traits installed, search them by using KubeVela CLI:

  1. vela traits

The result can be:

  1. NAME NAMESPACE APPLIES-TO CONFLICTS-WITH POD-DISRUPTIVE DESCRIPTION
  2. annotations vela-system deployments.apps true Add annotations for your Workload.
  3. cpuscaler vela-system webservice,worker false Automatically scale the component based on CPU usage.
  4. ingress vela-system webservice,worker false Enable public web traffic for the component.
  5. labels vela-system deployments.apps true Add labels for your Workload.
  6. scaler vela-system webservice,worker false Manually scale the component.
  7. sidecar vela-system deployments.apps true Inject a sidecar container to the component.

Policy

Policy enforces deployment process of the application, such as quality gates, security groups, placement strategy, fire walls, SLO targets and so on.

Workflow

Workflow allows you to assemble components, operation and task steps into a DAG, and it is process-oriented. Typical workflow steps includes pause, manual verification, waiting state, data flow transmission, multi-environment rollout, and A/B testing, etc.

Each workflow step is a independent capability entity that is fully plugable, KubeVela allows you to create your own step through CUE.

What’s Next

Here are some recommended next steps: