# Application Example In this Demo, Application application-sample will be converted to appconfig and component The fields in the application spec come from the parametes defined in the definition template , so we must install Definition at first Step 1: Install Workload Definition & Trait Definition ``` kubectl apply -f template.yaml ``` Step 2: Create a sample application in the cluster ``` kubectl apply -f application-sample.yaml ``` Step 3: View the application status ``` kubectl get -f application-sample.yaml -oyaml // You can see the following apiVersion: core.oam.dev/v1alpha2 kind: Application metadata: annotations: kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"core.oam.dev/v1alpha2","kind":"Application","metadata":{"annotations":{},"name":"application-sample","namespace":"oam-test"},"spec":{"template":"services:\n myweb:\n type: worker\n image: \"busybox\"\n cmd:\n - sleep\n - \"1000\"\n scaler:\n replicas: 10"}} name: application-sample namespace: oam-test spec: components: - name: myweb type: worker settings: image: "busybox" cmd: - sleep - "1000" traits: - name: scaler properties: replicas: 10 - name: sidercar properties: name: "sidecar-test" image: "nginx" - name: kservice properties: http: server: 80 status: conditions: - lastTransitionTime: "2020-12-02T12:12:52Z" reason: Available status: "True" type: Parsed - lastTransitionTime: "2020-12-02T12:12:52Z" reason: Available status: "True" type: Built - lastTransitionTime: "2020-12-02T12:12:52Z" reason: Available status: "True" type: Applied status: running ``` Step 4: View the oam CR generated by application ``` kubectl get appconfig/application-sample -oyaml // appconfig is as follows apiVersion: core.oam.dev/v1alpha2 kind: ApplicationConfiguration metadata: labels: application.oam.dev: application-sample name: application-sample namespace: oam-test ownerReferences: - apiVersion: core.oam.dev/v1alpha2 controller: true kind: Application name: application-sample uid: dca7acc3-664c-422b-aa52-4fe012e37974 spec: components: - componentName: myweb traits: - trait: apiVersion: v1 kind: Service metadata: name: myweb spec: ports: - port: 80 targetPort: 80 selector: app: myweb kubectl get component/myweb -oyaml // component is as follows apiVersion: core.oam.dev/v1alpha2 kind: Component metadata: labels: application.oam.dev: application-sample name: myweb namespace: oam-test ownerReferences: - apiVersion: core.oam.dev/v1alpha2 controller: true kind: Application name: application-sample uid: dca7acc3-664c-422b-aa52-4fe012e37974 spec: workload: apiVersion: apps/v1 kind: Deployment spec: replicas: 10 selector: matchLabels: app.oam.dev/component: myweb template: metadata: labels: app: myweb app.oam.dev/component: myweb spec: containers: - command: - sleep - "1000" image: busybox name: myweb - command: - sleep - "1000" image: busybox name: test-sidecar ```