Deploy First Application

    Welcome to KubeVela! In this guide, we’ll walk you through how to install KubeVela, and deploy your first simple application.

    Make sure you have finished and verified KubeVela installation following this guide.

    A simple deployment definition in KubeVela looks as below:

    Now deploy it to KubeVela:

    This command will deploy a web service component to target environment, which in our case is the Kubernetes cluster that KubeVela itself is installed.

    KubeVela allows you to deploy diverse components types. In above example, the Web Service component is actually a predefined module.

    You can also try:

    1. apiVersion: core.oam.dev/v1beta1
    2. kind: Application
    3. metadata:
    4. name: app-delivering-chart
    5. spec:
    6. components:
    7. - name: redis-comp
    8. type: helm
    9. properties:
    10. chart: redis-cluster
    11. version: 6.2.7
    12. url: https://charts.bitnami.com/bitnami
    13. repoType: helm
    1. apiVersion: core.oam.dev/v1beta1
    2. kind: Application
    3. metadata:
    4. name: git-app
    5. spec:
    6. components:
    7. - name: git-comp
    8. type: kustomize
    9. properties:
    10. repoType: git
    11. url: https://github.com/<path>/<to>/<repo>
    12. git:
    13. branch: master
    14. path: ./app/dev/

    … and many many more. Please check the Deploying Components section under User Manuals for all supported types, and even go ahead to add your own.

    KubeVela is not just about deploy. It allows you to attach predefined operational behaviors (named Traits) to your components in-place. For example, let’s assign a batch rollout strategy to our web service:

    Now whenever the image version is updated in above YAML file, the express-server component will rollout following strategy defined in rolloutBatches.

    Components and traits are just the beginning of your vela sail. KubeVela is by design a full functional Continuous Delivery (CD) platform with fine grained support for hybrid/multi-cloud/multi-cluster deployment.

    Let’s say:

    Oops, imagine how many add-hoc scripts and glue code are needed in your CI/CD pipeline to achieve automation and deployment success rate in above process.

    While with KubeVela, above process can be easily modeled as a declarative deployment plan as below:

    1. apiVersion: core.oam.dev/v1beta1
    2. kind: Application
    3. metadata:
    4. name: example-app
    5. namespace: default
    6. spec:
    7. components:
    8. - name: hello-world-server
    9. type: webservice
    10. properties:
    11. image: crccheck/hello-world
    12. port: 8000
    13. traits:
    14. - type: scaler
    15. properties:
    16. replicas: 1
    17. - name: data-worker
    18. type: worker
    19. properties:
    20. image: busybox
    21. cmd:
    22. - sleep
    23. - '1000000'
    24. policies:
    25. - name: example-multi-env-policy
    26. type: env-binding
    27. properties:
    28. envs:
    29. - name: staging
    30. placement: # selecting the cluster to deploy to
    31. clusterSelector:
    32. name: cluster-staging
    33. selector: # selecting which component to use
    34. components:
    35. - hello-world-server
    36. - name: prod
    37. placement:
    38. clusterSelector:
    39. name: cluster-prod
    40. patch: # overlay patch on above components
    41. components:
    42. - name: hello-world-server
    43. type: webservice
    44. traits:
    45. - type: scaler
    46. properties:
    47. replicas: 3
    48. - name: health-policy-demo
    49. type: health
    50. properties:
    51. probeInterval: 5
    52. probeTimeout: 10
    53. workflow:
    54. steps:
    55. # deploy to staging env
    56. - name: deploy-staging
    57. type: deploy2env
    58. properties:
    59. policy: example-multi-env-policy
    60. env: staging
    61. # manual check
    62. - name: manual-approval
    63. type: suspend
    64. # deploy to prod env
    65. - name: deploy-prod
    66. type: deploy2env
    67. properties:
    68. policy: example-multi-env-policy

    For using KubeVela with your own CI pipelines and other tools, please check Best Practices section in the sidebar for more real world examples.