Multi-Cluster App Delivery

    This section will introduce how to use KubeVela for multi-cluster application delivery and why.

    There are more and more situations come out that organizations need multi-cluster technology for application delivery:

    • For scalability, a single Kubernetes cluster has its limit around 5K nodes or less, it is unable to handle the large scale application load.
    • For stability/availability, application can deploy in multi-cluster for backup which provides more stability and availability.
    • For security, you may need to deploy in different zones/areas as government policy requires.

    The following guide will the multi-cluster that helps you easily deploy an application to different environments.

    You can simply join an existing cluster into KubeVela by specify its KubeConfig like below.

    It will use field in KubeConfig as the cluster name automatically, you can also specify the name by --name parameter. For example:

    1. vela cluster join stage-cluster.kubeconfig --name cluster-staging
    2. vela cluster join prod-cluster.kubeconfig --name cluster-prod

    After clusters joined, you could list all clusters managed by KubeVela currently.

    1. $ vela cluster list
    2. CLUSTER TYPE ENDPOINT
    3. cluster-prod tls https://47.88.4.97:6443
    4. cluster-staging tls https://47.88.7.230:6443

    You can also detach a cluster if you’re not using it any more.

    1. $ vela cluster detach cluster-prod

    KubeVela regards a Kubernetes cluster as an environment, so you can deploy an application into one or more environments.

    Below is an example, deploy to a staging environment first, check the application running well, and finally promote to production environment.

    For different environments, the deployment configuration can also have some nuance. In the staging environment, we only need one replica for the webservice and do not need the worker. In the production environment, we setup 3 replicas for the webservice and enable the worker.

    After the application deployed, it will run as the workflow steps.

    It will deploy application to staging environment first, you can check the Application status by:

    1. > kubectl get application example-app
    2. NAME COMPONENT TYPE PHASE HEALTHY STATUS AGE
    3. example-app hello-world-server webservice workflowSuspending true Ready:1/1 10s

    We can see that the workflow is suspended at manual-approval:

    1. ...
    2. status:
    3. workflow:
    4. appRevision: example-app-v1:44a6447e3653bcc2
    5. contextBackend:
    6. apiVersion: v1
    7. kind: ConfigMap
    8. name: workflow-example-app-context
    9. uid: 56ddcde6-8a83-4ac3-bf94-d19f8f55eb3d
    10. mode: StepByStep
    11. steps:
    12. - id: wek2b31nai
    13. name: deploy-staging
    14. phase: succeeded
    15. type: deploy2env
    16. - id: 7j5eb764mk
    17. name: manual-approval
    18. phase: succeeded
    19. type: suspend
    20. suspend: true
    21. terminated: false
    22. waitCount: 0
    1. ...
    2. status:
    3. services:
    4. - env: staging
    5. healthy: true
    6. message: 'Ready:1/1 '
    7. name: hello-world-server
    8. scopes:
    9. - apiVersion: core.oam.dev/v1alpha2
    10. kind: HealthScope
    11. namespace: test
    12. uid: 6e6230a3-93f3-4dba-ba09-dd863b6c4a88
    13. traits:
    14. - healthy: true
    15. type: scaler
    16. workloadDefinition:
    17. apiVersion: apps/v1
    18. kind: Deployment

    You can use resume command after everything verified in statging cluster:

    Recheck the Application status:

    1. > kubectl get application example-app
    2. NAME COMPONENT TYPE PHASE HEALTHY STATUS AGE
    3. example-app hello-world-server webservice running true Ready:1/1 62s
    1. status:
    2. services:
    3. - env: staging
    4. healthy: true
    5. message: 'Ready:1/1 '
    6. name: hello-world-server
    7. scopes:
    8. - apiVersion: core.oam.dev/v1alpha2
    9. kind: HealthScope
    10. name: health-policy-demo
    11. namespace: default
    12. uid: 9174ac61-d262-444b-bb6c-e5f0caee706a
    13. traits:
    14. - healthy: true
    15. type: scaler
    16. workloadDefinition:
    17. apiVersion: apps/v1
    18. kind: Deployment
    19. - env: prod
    20. healthy: true
    21. message: 'Ready:3/3 '
    22. name: hello-world-server
    23. scopes:
    24. - apiVersion: core.oam.dev/v1alpha2
    25. kind: HealthScope
    26. name: health-policy-demo
    27. namespace: default
    28. uid: 9174ac61-d262-444b-bb6c-e5f0caee706a
    29. traits:
    30. - healthy: true
    31. workloadDefinition:
    32. apiVersion: apps/v1
    33. kind: Deployment
    34. - env: prod
    35. healthy: true
    36. message: 'Ready:1/1 '
    37. name: data-worker
    38. scopes:
    39. - apiVersion: core.oam.dev/v1alpha2
    40. kind: HealthScope
    41. name: health-policy-demo
    42. namespace: default
    43. uid: 9174ac61-d262-444b-bb6c-e5f0caee706a
    44. workloadDefinition:
    45. apiVersion: apps/v1
    46. kind: Deployment

    All the step status in workflow is succeeded:

    1. ...
    2. status:
    3. workflow:
    4. appRevision: example-app-v1:44a6447e3653bcc2
    5. contextBackend:
    6. apiVersion: v1
    7. kind: ConfigMap
    8. name: workflow-example-app-context
    9. uid: e1e7bd2d-8743-4239-9de7-55a0dd76e5d3
    10. mode: StepByStep
    11. steps:
    12. - id: q8yx7pr8wb
    13. name: deploy-staging
    14. phase: succeeded
    15. type: deploy2env
    16. - id: 6oxrtvki9o
    17. name: manual-approval
    18. phase: succeeded
    19. type: suspend
    20. - id: uk287p8c31
    21. name: deploy-prod
    22. phase: succeeded
    23. type: deploy2env
    24. suspend: false
    25. terminated: false

    KubeVela can provide many strategies to deploy an application to multiple clusters by composing env-binding policy and workflow steps.

    You can have a glimpse of how does it work as below:

    More use cases about the multi cluster application deployment are coming soon.