Skip to content

Latest commit

 

History

History
103 lines (76 loc) · 3.06 KB

03.deploy_complex_app.md

File metadata and controls

103 lines (76 loc) · 3.06 KB

Deploying a complex OAM application

The open application model specification supports any type of application, where multiple components are deployed together interacting among themselves. This step of the tutorial illustrates some concepts with a minimal application with two main components.

vela up -f scenarios/complex_app/wordpress.yml
curl http://localhost:80/

Use http://localhost:8090 if you installed the cluster with velad.

Checking logs

vela logs my-wordpress -n kubecon

Kubernetes view

$ kubectl -n kubecon get all -l app.oam.dev/name=my-wordpress
NAME                             READY   STATUS    RESTARTS        AGE
pod/mysql-77f7db94b7-j9s4n       1/1     Running   0               5m
pod/wordpress-7b4b47ff64-97rw9   1/1     Running   1 (3m39s ago)   5m

NAME                TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)    AGE
service/wordpress   ClusterIP   10.43.239.80   <none>        8080/TCP   5m
service/mysql       ClusterIP   10.43.61.129   <none>        3306/TCP   5m

NAME                        READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/mysql       1/1     1            1           5m
deployment.apps/wordpress   1/1     1            1           5m

NAME                                   DESIRED   CURRENT   READY   AGE
replicaset.apps/mysql-77f7db94b7       1         1         1       5m
replicaset.apps/wordpress-7b4b47ff64   1         1         1       5m

To remove it, use:

vela delete my-wordpress

Component dependency

One of the main issues we face when deploying multi-component applications is that some components will reboot periodically until all their dependencies are satisfied. As this can significantly increase the deployment time, the Application provides a way to specify component dependencies in such a way that the KubeVela orchestrator is informed and will create a basic deployment workflow where components will not be deployed until their dependencies are marked as healthy.

The previous application has been modified to include a dependency from wordpress to mysql. To test it out:

vela up -f scenarios/complex_app/wordpress_with_dependencies.yml

If you check the status mid-deployment you may observe the incremental deployment

$ vela status my-wordpress-dep -n kubecon
About:

  Name:      	my-wordpress-dep
  Namespace: 	kubecon
  Created at:	2023-04-11 17:11:35 +0200 CEST
  Status:    	runningWorkflow

Workflow:

  mode: DAG-DAG
  finished: false
  Suspend: false
  Terminated: false
  Steps
  - id: t4q413golw
    name: mysql
    type: apply-component
    phase: running
    message: wait healthy
  - id: m96p432m4f
    name: wordpress
    type: builtin-apply-component
    phase: pending
    message: Pending on DependsOn: mysql

Services:

  - Name: mysql
    Cluster: local  Namespace: kubecon
    Type: webservice
    Unhealthy Ready:0/1
    Traits:
      ✅ storage

After some seconds, mysql will be ready and the deployment will continue.

Next