Version: v1.0
Define Application Health Probe
In this documentation, we will show how to define health probe for application
1.Create health scope instance.
apiVersion: core.oam.dev/v1alpha2kind: HealthScopemetadata:name: health-checknamespace: defaultspec:probe-interval: 60workloadRefs:- apiVersion: apps/v1kind: Deploymentname: express-server
- Create an application with the health scope
apiVersion: core.oam.dev/v1beta1kind: Applicationmetadata:name: vela-appspec:components:- name: express-servertype: webserviceproperties:image: crccheck/hello-worldport: 8080 # change portcpu: 0.5 # add requests cpu unitsscopes:healthscopes.core.oam.dev: health-check
- Check app status, will see health scope in
status.service.scopes
$ kubectl get app vela-app -o yaml
apiVersion: core.oam.dev/v1beta1kind: Applicationmetadata:name: vela-app...status:...services:- healthy: truename: express-serverscopes:- apiVersion: core.oam.dev/v1alpha2kind: HealthScopename: health-check
4.Check health scope status
$ kubectl get healthscope health-check -o yaml
apiVersion: core.oam.dev/v1alpha2kind: HealthScopemetadata:name: health-check...spec:probe-interval: 60workloadRefs:- apiVersion: apps/v1kind: Deploymentname: express-serverstatus:healthConditions:- componentName: express-serverdiagnosis: 'Ready:1/1 'healthStatus: HEALTHYtargetWorkload:apiVersion: apps/v1kind: Deploymentname: express-serverscopeHealthCondition:healthStatus: HEALTHYhealthyWorkloads: 1total: 1