Merge pull request #656 from wonderflow/fix2

Fix: refine the first application
This commit is contained in:
barnettZQG 2022-05-16 21:52:36 +08:00 committed by GitHub
commit 115e59c129
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 377 additions and 249 deletions

View File

@ -47,7 +47,7 @@ spec:
- name: hello-world-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: scaler

View File

@ -88,7 +88,7 @@ name: testapp
services:
testsvc:
type: clonesetservice
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
EOF
```

View File

@ -30,7 +30,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8080 # change port
cpu: 0.5 # add requests cpu units
scopes:

View File

@ -17,7 +17,7 @@ spec:
- name: hello-world
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: scaler
properties:

View File

@ -21,7 +21,7 @@ spec:
- name: hello-world-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: scaler

View File

@ -21,7 +21,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -61,7 +61,7 @@ spec:
- name: express-server-1
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -143,7 +143,7 @@ spec:
- name: hello-world
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: expose
properties:
@ -182,7 +182,7 @@ spec:
- name: hello-world-new
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: expose
properties:

View File

@ -28,7 +28,7 @@ spec:
- name: hello-world
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: scaler
properties:
@ -80,7 +80,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -105,7 +105,7 @@ spec:
- name: hello-world-new
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: expose
properties:

View File

@ -22,7 +22,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: gateway

View File

@ -19,7 +19,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: gateway

View File

@ -34,7 +34,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: gateway
@ -270,7 +270,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
ports:
- port: 8000
traits:
@ -345,7 +345,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: labels
@ -391,7 +391,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: annotations
@ -651,7 +651,7 @@ spec:
- name: my-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: service-binding

View File

@ -86,7 +86,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -155,7 +155,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress
@ -240,7 +240,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -276,7 +276,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress
@ -330,7 +330,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress
@ -373,7 +373,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
volumes:
- name: "my-pvc"
@ -437,7 +437,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -491,7 +491,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -540,7 +540,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:

View File

@ -21,7 +21,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress

View File

@ -305,7 +305,7 @@ Addon: velaux enabled Successfully.
By default, velaux didn't have any exposed port, you can view it by:
```
vela port-forward addon-velaux -n vela-system
vela port-forward addon-velaux -n vela-system 8080:80
```
Choose `> Cluster: local | Namespace: vela-system | Component: velaux | Kind: Service` for visit.

View File

@ -211,7 +211,7 @@ The `ComponentDefinition` can be instantiated in `Application` abstraction as be
- name: hello
type: stateless
properties:
image: crccheck/hello-world
image: oamdev/hello-world
name: mysvc
- name: countdown
type: task
@ -239,7 +239,7 @@ spec:
spec:
containers:
- name: mysvc
image: crccheck/hello-world
image: oamdev/hello-world
metadata:
labels:
app.oam.dev/component: mysvc
@ -448,7 +448,7 @@ spec:
- name: hello-world
type: webserver
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
env:
- name: "foo"

View File

@ -50,7 +50,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
ports:
- port: 8000
traits:

View File

@ -19,7 +19,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress
@ -53,7 +53,7 @@ spec:
app.oam.dev/component: express-server
spec:
containers:
- image: crccheck/hello-world
- image: oamdev/hello-world
name: express-server
ports:
- containerPort: 8000

View File

@ -6,7 +6,7 @@ title: Deploy First Application
Welcome to KubeVela! This section will guide you to deliver your first app.
## Deploy a classic application via CLI
## Deploy a classic application
Below is a classic KubeVela application which contains one component with one operational trait, basically, it means to deploy a container image as webservice with one replica. Additionally, there are three policies and workflow steps, it means to deploy the application into two different environments with a bit different configurations.
@ -20,7 +20,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
ports:
- port: 8000
expose: true
@ -64,84 +64,146 @@ spec:
policies: ["target-prod", "deploy-ha"]
```
* Starting deploy the application
* Create an environment for your first app.
```bash
# This command for creating a namespace in the local cluster
# This command will create a namespace in the local cluster
$ vela env init prod --namespace prod
environment prod with namespace prod created
```
* Starting deploy the application
```
$ vela up -f https://kubevela.net/example/applications/first-app.yaml
Applying an application in vela K8s object format...
I0516 15:45:18.123356 27156 apply.go:107] "creating object" name="first-vela-app" resource="core.oam.dev/v1beta1, Kind=Application"
✅ App has been deployed 🚀🚀🚀
Port forward: vela port-forward first-vela-app
SSH: vela exec first-vela-app
Logging: vela logs first-vela-app
App status: vela status first-vela-app
Endpoint: vela status first-vela-app --endpoint
Application prod/first-vela-app applied.
```
* View the process and status of the application deploy
```bash
$ vela status first-vela-app
About:
Name: first-vela-app
Namespace: prod
Created at: 2022-05-16 15:45:18 +0800 CST
Status: workflowSuspending
Workflow:
...
Services:
- Name: express-server
Cluster: local Namespace: default
Type: webservice
Healthy Ready:1/1
Traits:
✅ scaler
```
The application will become a `workflowSuspend` status if the first step is successfully run.
* Resume the workflow
```bash
$ vela workflow resume first-vela-app
```
The application will become a `workflowSuspending` status, it means the workflow has finished the first two steps and waiting for manuel approval as the step specified.
* Access the application
We can check the application by:
```bash
$ vela port-forward first-vela-app 8000:8000
<xmp>
Hello World
## .
## ## ## ==
## ## ## ## ## ===
/""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
\______ o _,/
\ \ _,'
`'--.._\..--''
</xmp>
vela port-forward first-vela-app 8000:8000
```
Great! You have finished deploying your first KubeVela application, the simplest component can only have one component, the rest fields are all optional including trait, policies and workflow.
It will invoke your browser and your can see the website:
> Currently, The application created by CLI will be synced to UI, but it will be readonly.
```
<xmp>
Hello KubeVela! Make shipping applications more enjoyable.
## Deploy a simple application via UI
...snip...
```
After logging into the UI, the first page you enter is for managing the applications:
* Resume the workflow
Then click the button of `New Application` on the upper-right, type in these things:
After we finshed check the application, we can approve the workflow to continue:
1. Name and other basic Infos.
2. Choose the Project. We've created a default Project for you to use or you can click `New` to create your own.
3. Choose the main component type. In this case, we use `webservice` to deploy Stateless Application.
4. Choose your environment. We select the `Default` Environment based on the `Default` Target.
```bash
$ vela workflow resume first-vela-app
Successfully resume workflow: first-vela-app
```
### Setting up properties
Then the rest part will be delivered in `prod` namespace:
Next step, we see the page of properties. Configure following:
```
$ vela status first-vela-app
About:
- Image address `crccheck/hello-world`
Name: first-vela-app
Namespace: prod
Created at: 2022-05-16 15:45:18 +0800 CST
Status: running
![create hello world app](https://static.kubevela.net/images/1.3/create-helloworld.jpg)
Workflow:
Confirmed. Notice that this application is only created but not deployed yet. VelaUX default generates [Workflow](./getting-started/core-concept#workflow) and a scaler [Trait](./getting-started/core-concept#trait).
...snipt...
### Executing Workflow to deploy
Services:
Click the deploy button on the upper-right. When the workflow is finished, you'll get to see the list of status lying within.
- Name: express-server
Cluster: local Namespace: prod
Type: webservice
Healthy Ready:2/2
Traits:
✅ scaler
- Name: express-server
Cluster: local Namespace: default
Type: webservice
Healthy Ready:1/1
Traits:
✅ scaler
```
Great! You have finished deploying your first KubeVela application, you can also view and manage it in UI.
## View and Manage the application from UI
> Currently, the application created by CLI is readonly in your dashboard.
After finished [the installation of VelaUX](./install#4-install-velaux), you can view and manage the application created.
* Port forward the UI if you don't have endpoint for access:
```
vela port-forward addon-velaux -n vela-system 8080:80
```
* Check the password by:
```
vela logs -n vela-system --name apiserver addon-velaux | grep "initialized admin username"
```
### View resources deployed
Click the application card, then you can view the details of the application.
![](./resources/succeed-first-vela-app.jpg)
## Deleting Application
If you want to delete the application when it's no longer used, simply:
1. Enter the page of environment, click `Recycle` to reclaim the resources that this environment used.
2. Go back to the list of applications and click the drop-down menu to remove it.
```
$ vela delete first-vela-app
Deleting Application "first-vela-app"
app "first-vela-app" deleted from namespace "prod"
```
That's it! You succeed at the first application delivery. Congratulation!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 602 KiB

After

Width:  |  Height:  |  Size: 260 KiB

View File

@ -420,7 +420,7 @@ name: my-extend-app
services:
mysvc:
type: mydeploy
image: crccheck/hello-world
image: oamdev/hello-world
name: mysvc
```
@ -513,7 +513,7 @@ name: my-extend-app
services:
mysvc:
type: mydeploy
image: crccheck/hello-world
image: oamdev/hello-world
name: mysvc
config:
- name: a
@ -554,7 +554,7 @@ name: my-extend-app
services:
mysvc:
type: mydeploy
image: crccheck/hello-world
image: oamdev/hello-world
name: mysvc
useENV: true
```

View File

@ -83,7 +83,7 @@ name: testapp
services:
testsvc:
type: clonesetservice
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
EOF
```

View File

@ -29,7 +29,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8080 # change port
cpu: 0.5 # add requests cpu units
scopes:

View File

@ -17,7 +17,7 @@ spec:
- name: hello-world
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: scaler
properties:

View File

@ -21,7 +21,7 @@ spec:
- name: hello-world-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: scaler

View File

@ -21,7 +21,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -61,7 +61,7 @@ spec:
- name: express-server-1
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -144,7 +144,7 @@ spec:
- name: hello-world
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: expose
properties:
@ -182,7 +182,7 @@ spec:
- name: hello-world-new
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: expose
properties:

View File

@ -28,7 +28,7 @@ spec:
- name: hello-world
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: scaler
properties:
@ -80,7 +80,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -105,7 +105,7 @@ spec:
- name: hello-world-new
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: expose
properties:

View File

@ -20,7 +20,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -36,7 +36,7 @@ spec:
vela up -f https://raw.githubusercontent.com/kubevela/kubevela/master/docs/examples/vela-app.yaml
```
上述命令一旦执行KubeVela 就会帮助你在目标集群中交付一个 `Web 服务`类型的组件,且该组件的容器镜像是`crccheck/hello-world`。在本示例中,我们并没有特别指明目标集群是哪个,所以 KubeVela 会默认把应用部署在它所在的集群也就是控制平面集群当中。
上述命令一旦执行KubeVela 就会帮助你在目标集群中交付一个 `Web 服务`类型的组件,且该组件的容器镜像是`oamdev/hello-world`。在本示例中,我们并没有特别指明目标集群是哪个,所以 KubeVela 会默认把应用部署在它所在的集群也就是控制平面集群当中。
而由于我们已经在上述 YAML 文件中为这个组件绑定了一个 `ingress` 类型的运维特征KubeVela 就会指导 Kubernetes 自动为这个组件背后的工作负载配置 Service、端口映射和 HTTP 路由规则。所以只要目标集群具备 [Ingress 能力](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/),上述 YAML 一部署成功,你就可以立刻通过外域名来问这个应用了。

View File

@ -11,7 +11,7 @@ description: 本页面介绍通过为应用分配网关策略,或设置应用
## 如何使用
我们以给一个 Web Service 组件配置网关,来进行示例讲解。这个组件从 `crccheck/hello-world` 镜像中拉取过来,设置网关后,对外通过 `testsvc.example.com` 加上端口 8000 提供访问。
我们以给一个 Web Service 组件配置网关,来进行示例讲解。这个组件从 `oamdev/hello-world` 镜像中拉取过来,设置网关后,对外通过 `testsvc.example.com` 加上端口 8000 提供访问。
为了便于你快速学习,请直接复制下面的 Shell 执行,会部署到集群中:
@ -29,7 +29,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: gateway

View File

@ -33,7 +33,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: gateway
@ -279,7 +279,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
ports:
- port: 8000
traits:
@ -354,7 +354,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: labels
@ -400,7 +400,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: annotations
@ -660,7 +660,7 @@ spec:
- name: my-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: service-binding

View File

@ -87,7 +87,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -157,7 +157,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -213,7 +213,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -251,7 +251,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -337,7 +337,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -376,7 +376,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
volumes:
- name: "my-pvc"
@ -442,7 +442,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -498,7 +498,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -549,7 +549,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:

View File

@ -21,7 +21,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress

View File

@ -211,7 +211,7 @@ ComponentDefinition task created in namespace vela-system.
- name: hello
type: stateless
properties:
image: crccheck/hello-world
image: oamdev/hello-world
name: mysvc
- name: countdown
type: task
@ -239,7 +239,7 @@ spec:
spec:
containers:
- name: mysvc
image: crccheck/hello-world
image: oamdev/hello-world
metadata:
labels:
app.oam.dev/component: mysvc
@ -414,7 +414,7 @@ spec:
- name: hello-world
type: webserver
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
env:
- name: "foo"

View File

@ -50,7 +50,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
ports:
- port: 8000
traits:

View File

@ -23,7 +23,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress
@ -33,7 +33,7 @@ spec:
"/": 8000
```
可以看到,我们的期望是交付一个 Web Service 的组件,使用来自 `crccheck/hello-world` 的镜像,并最终提供一个可供对外访问的网关,地址域名为 `testsvc.example.com`,端口号 8000。
可以看到,我们的期望是交付一个 Web Service 的组件,使用来自 `oamdev/hello-world` 的镜像,并最终提供一个可供对外访问的网关,地址域名为 `testsvc.example.com`,端口号 8000。
然后打开本地试运行模式,使用如下命令:
@ -63,7 +63,7 @@ spec:
app.oam.dev/component: express-server
spec:
containers:
- image: crccheck/hello-world
- image: oamdev/hello-world
name: express-server
ports:
- containerPort: 8000

View File

@ -26,7 +26,7 @@ spec:
- name: foo
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress

View File

@ -20,7 +20,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
ports:
- port: 8000
expose: true
@ -72,7 +72,7 @@ $ vela env init prod --namespace prod
$ vela up -f https://kubevela.net/example/applications/first-app.yaml
```
> 需要注意的是需要你的部署环境可以正常获取 `crccheck/hello-world` 镜像
> 需要注意的是需要你的部署环境可以正常获取 `oamdev/hello-world` 镜像
* 查看部署状态
@ -124,7 +124,7 @@ Hello World
设置完应用基础信息后进入第二步,设置主组件的部署参数,我们需要设置的参数包括:
- 镜像地址: `crccheck/hello-world`
- 镜像地址: `oamdev/hello-world`
- 端口信息:将默认的 80 端口变更为 8080 端口。
![create hello world app](https://static.kubevela.net/images/1.3/create-helloworld.jpg)

View File

@ -83,7 +83,7 @@ name: testapp
services:
testsvc:
type: clonesetservice
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
EOF
```

View File

@ -29,7 +29,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8080 # change port
cpu: 0.5 # add requests cpu units
scopes:

View File

@ -17,7 +17,7 @@ spec:
- name: hello-world
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: scaler
properties:

View File

@ -21,7 +21,7 @@ spec:
- name: hello-world-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: scaler

View File

@ -21,7 +21,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -61,7 +61,7 @@ spec:
- name: express-server-1
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -144,7 +144,7 @@ spec:
- name: hello-world
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: expose
properties:
@ -182,7 +182,7 @@ spec:
- name: hello-world-new
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: expose
properties:

View File

@ -28,7 +28,7 @@ spec:
- name: hello-world
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: scaler
properties:
@ -80,7 +80,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -105,7 +105,7 @@ spec:
- name: hello-world-new
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: expose
properties:

View File

@ -20,7 +20,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -36,7 +36,7 @@ spec:
vela up -f https://raw.githubusercontent.com/kubevela/kubevela/master/docs/examples/vela-app.yaml
```
上述命令一旦执行KubeVela 就会帮助你在目标集群中交付一个 `Web 服务`类型的组件,且该组件的容器镜像是`crccheck/hello-world`。在本示例中,我们并没有特别指明目标集群是哪个,所以 KubeVela 会默认把应用部署在它所在的集群也就是控制平面集群当中。
上述命令一旦执行KubeVela 就会帮助你在目标集群中交付一个 `Web 服务`类型的组件,且该组件的容器镜像是`oamdev/hello-world`。在本示例中,我们并没有特别指明目标集群是哪个,所以 KubeVela 会默认把应用部署在它所在的集群也就是控制平面集群当中。
而由于我们已经在上述 YAML 文件中为这个组件绑定了一个 `ingress` 类型的运维特征KubeVela 就会指导 Kubernetes 自动为这个组件背后的工作负载配置 Service、端口映射和 HTTP 路由规则。所以只要目标集群具备 [Ingress 能力](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/),上述 YAML 一部署成功,你就可以立刻通过外域名来问这个应用了。

View File

@ -11,7 +11,7 @@ description: 本页面介绍通过为应用分配网关策略,或设置应用
## 如何使用
我们以给一个 Web Service 组件配置网关,来进行示例讲解。这个组件从 `crccheck/hello-world` 镜像中拉取过来,设置网关后,对外通过 `testsvc.example.com` 加上端口 8000 提供访问。
我们以给一个 Web Service 组件配置网关,来进行示例讲解。这个组件从 `oamdev/hello-world` 镜像中拉取过来,设置网关后,对外通过 `testsvc.example.com` 加上端口 8000 提供访问。
为了便于你快速学习,请直接复制下面的 Shell 执行,会部署到集群中:
@ -29,7 +29,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: gateway

View File

@ -33,7 +33,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: gateway
@ -279,7 +279,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
ports:
- port: 8000
traits:
@ -354,7 +354,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: labels
@ -400,7 +400,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: annotations
@ -660,7 +660,7 @@ spec:
- name: my-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: service-binding

View File

@ -87,7 +87,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -157,7 +157,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -213,7 +213,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -251,7 +251,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -337,7 +337,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -376,7 +376,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
volumes:
- name: "my-pvc"
@ -442,7 +442,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -498,7 +498,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -549,7 +549,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:

View File

@ -21,7 +21,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress

View File

@ -211,7 +211,7 @@ ComponentDefinition task created in namespace vela-system.
- name: hello
type: stateless
properties:
image: crccheck/hello-world
image: oamdev/hello-world
name: mysvc
- name: countdown
type: task
@ -239,7 +239,7 @@ spec:
spec:
containers:
- name: mysvc
image: crccheck/hello-world
image: oamdev/hello-world
metadata:
labels:
app.oam.dev/component: mysvc
@ -414,7 +414,7 @@ spec:
- name: hello-world
type: webserver
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
env:
- name: "foo"

View File

@ -50,7 +50,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
ports:
- port: 8000
traits:

View File

@ -23,7 +23,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress
@ -33,7 +33,7 @@ spec:
"/": 8000
```
可以看到,我们的期望是交付一个 Web Service 的组件,使用来自 `crccheck/hello-world` 的镜像,并最终提供一个可供对外访问的网关,地址域名为 `testsvc.example.com`,端口号 8000。
可以看到,我们的期望是交付一个 Web Service 的组件,使用来自 `oamdev/hello-world` 的镜像,并最终提供一个可供对外访问的网关,地址域名为 `testsvc.example.com`,端口号 8000。
然后打开本地试运行模式,使用如下命令:
@ -63,7 +63,7 @@ spec:
app.oam.dev/component: express-server
spec:
containers:
- image: crccheck/hello-world
- image: oamdev/hello-world
name: express-server
ports:
- containerPort: 8000

View File

@ -26,7 +26,7 @@ spec:
- name: foo
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress

View File

@ -20,7 +20,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
ports:
- port: 8000
expose: true
@ -72,7 +72,7 @@ $ vela env init prod --namespace prod
$ vela up -f https://kubevela.net/example/applications/first-app.yaml
```
> 需要注意的是需要你的部署环境可以正常获取 `crccheck/hello-world` 镜像
> 需要注意的是需要你的部署环境可以正常获取 `oamdev/hello-world` 镜像
* 查看部署状态
@ -124,7 +124,7 @@ Hello World
设置完应用基础信息后进入第二步,设置主组件的部署参数,我们需要设置的参数包括:
- 镜像地址: `crccheck/hello-world`
- 镜像地址: `oamdev/hello-world`
- 端口信息:将默认的 80 端口变更为 8080 端口。
![create hello world app](https://static.kubevela.net/images/1.3/create-helloworld.jpg)

View File

@ -7,7 +7,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
ports:
- port: 8000
expose: true

View File

@ -88,7 +88,7 @@ name: testapp
services:
testsvc:
type: clonesetservice
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
EOF
```

View File

@ -30,7 +30,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8080 # change port
cpu: 0.5 # add requests cpu units
scopes:

View File

@ -17,7 +17,7 @@ spec:
- name: hello-world
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: scaler
properties:

View File

@ -21,7 +21,7 @@ spec:
- name: hello-world-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: scaler

View File

@ -21,7 +21,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -61,7 +61,7 @@ spec:
- name: express-server-1
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -143,7 +143,7 @@ spec:
- name: hello-world
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: expose
properties:
@ -182,7 +182,7 @@ spec:
- name: hello-world-new
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: expose
properties:

View File

@ -28,7 +28,7 @@ spec:
- name: hello-world
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: scaler
properties:
@ -80,7 +80,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress-1-20
@ -105,7 +105,7 @@ spec:
- name: hello-world-new
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
traits:
- type: expose
properties:

View File

@ -22,7 +22,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: gateway

View File

@ -19,7 +19,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: gateway

View File

@ -34,7 +34,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: gateway
@ -270,7 +270,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
ports:
- port: 8000
traits:
@ -345,7 +345,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: labels
@ -391,7 +391,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: annotations
@ -651,7 +651,7 @@ spec:
- name: my-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: service-binding

View File

@ -86,7 +86,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -155,7 +155,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress
@ -240,7 +240,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -276,7 +276,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress
@ -330,7 +330,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress
@ -373,7 +373,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
volumes:
- name: "my-pvc"
@ -437,7 +437,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -491,7 +491,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:
@ -540,7 +540,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
workflow:
steps:

View File

@ -21,7 +21,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress

View File

@ -305,7 +305,7 @@ Addon: velaux enabled Successfully.
By default, velaux didn't have any exposed port, you can view it by:
```
vela port-forward addon-velaux -n vela-system
vela port-forward addon-velaux -n vela-system 8080:80
```
Choose `> Cluster: local | Namespace: vela-system | Component: velaux | Kind: Service` for visit.

View File

@ -211,7 +211,7 @@ The `ComponentDefinition` can be instantiated in `Application` abstraction as be
- name: hello
type: stateless
properties:
image: crccheck/hello-world
image: oamdev/hello-world
name: mysvc
- name: countdown
type: task
@ -239,7 +239,7 @@ spec:
spec:
containers:
- name: mysvc
image: crccheck/hello-world
image: oamdev/hello-world
metadata:
labels:
app.oam.dev/component: mysvc
@ -448,7 +448,7 @@ spec:
- name: hello-world
type: webserver
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
env:
- name: "foo"

View File

@ -50,7 +50,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
ports:
- port: 8000
traits:

View File

@ -19,7 +19,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
port: 8000
traits:
- type: ingress
@ -53,7 +53,7 @@ spec:
app.oam.dev/component: express-server
spec:
containers:
- image: crccheck/hello-world
- image: oamdev/hello-world
name: express-server
ports:
- containerPort: 8000

View File

@ -6,7 +6,7 @@ title: Deploy First Application
Welcome to KubeVela! This section will guide you to deliver your first app.
## Deploy a classic application via CLI
## Deploy a classic application
Below is a classic KubeVela application which contains one component with one operational trait, basically, it means to deploy a container image as webservice with one replica. Additionally, there are three policies and workflow steps, it means to deploy the application into two different environments with a bit different configurations.
@ -20,7 +20,7 @@ spec:
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
image: oamdev/hello-world
ports:
- port: 8000
expose: true
@ -64,84 +64,146 @@ spec:
policies: ["target-prod", "deploy-ha"]
```
* Starting deploy the application
* Create an environment for your first app.
```bash
# This command for creating a namespace in the local cluster
# This command will create a namespace in the local cluster
$ vela env init prod --namespace prod
environment prod with namespace prod created
```
* Starting deploy the application
```
$ vela up -f https://kubevela.net/example/applications/first-app.yaml
Applying an application in vela K8s object format...
I0516 15:45:18.123356 27156 apply.go:107] "creating object" name="first-vela-app" resource="core.oam.dev/v1beta1, Kind=Application"
✅ App has been deployed 🚀🚀🚀
Port forward: vela port-forward first-vela-app
SSH: vela exec first-vela-app
Logging: vela logs first-vela-app
App status: vela status first-vela-app
Endpoint: vela status first-vela-app --endpoint
Application prod/first-vela-app applied.
```
* View the process and status of the application deploy
```bash
$ vela status first-vela-app
About:
Name: first-vela-app
Namespace: prod
Created at: 2022-05-16 15:45:18 +0800 CST
Status: workflowSuspending
Workflow:
...
Services:
- Name: express-server
Cluster: local Namespace: default
Type: webservice
Healthy Ready:1/1
Traits:
✅ scaler
```
The application will become a `workflowSuspend` status if the first step is successfully run.
* Resume the workflow
```bash
$ vela workflow resume first-vela-app
```
The application will become a `workflowSuspending` status, it means the workflow has finished the first two steps and waiting for manuel approval as the step specified.
* Access the application
We can check the application by:
```bash
$ vela port-forward first-vela-app 8000:8000
<xmp>
Hello World
## .
## ## ## ==
## ## ## ## ## ===
/""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ / ===- ~~~
\______ o _,/
\ \ _,'
`'--.._\..--''
</xmp>
vela port-forward first-vela-app 8000:8000
```
Great! You have finished deploying your first KubeVela application, the simplest component can only have one component, the rest fields are all optional including trait, policies and workflow.
It will invoke your browser and your can see the website:
> Currently, The application created by CLI will be synced to UI, but it will be readonly.
```
<xmp>
Hello KubeVela! Make shipping applications more enjoyable.
## Deploy a simple application via UI
...snip...
```
After logging into the UI, the first page you enter is for managing the applications:
* Resume the workflow
Then click the button of `New Application` on the upper-right, type in these things:
After we finshed check the application, we can approve the workflow to continue:
1. Name and other basic Infos.
2. Choose the Project. We've created a default Project for you to use or you can click `New` to create your own.
3. Choose the main component type. In this case, we use `webservice` to deploy Stateless Application.
4. Choose your environment. We select the `Default` Environment based on the `Default` Target.
```bash
$ vela workflow resume first-vela-app
Successfully resume workflow: first-vela-app
```
### Setting up properties
Then the rest part will be delivered in `prod` namespace:
Next step, we see the page of properties. Configure following:
```
$ vela status first-vela-app
About:
- Image address `crccheck/hello-world`
Name: first-vela-app
Namespace: prod
Created at: 2022-05-16 15:45:18 +0800 CST
Status: running
![create hello world app](https://static.kubevela.net/images/1.3/create-helloworld.jpg)
Workflow:
Confirmed. Notice that this application is only created but not deployed yet. VelaUX default generates [Workflow](./getting-started/core-concept#workflow) and a scaler [Trait](./getting-started/core-concept#trait).
...snipt...
### Executing Workflow to deploy
Services:
Click the deploy button on the upper-right. When the workflow is finished, you'll get to see the list of status lying within.
- Name: express-server
Cluster: local Namespace: prod
Type: webservice
Healthy Ready:2/2
Traits:
✅ scaler
- Name: express-server
Cluster: local Namespace: default
Type: webservice
Healthy Ready:1/1
Traits:
✅ scaler
```
Great! You have finished deploying your first KubeVela application, you can also view and manage it in UI.
## View and Manage the application from UI
> Currently, the application created by CLI is readonly in your dashboard.
After finished [the installation of VelaUX](./install#4-install-velaux), you can view and manage the application created.
* Port forward the UI if you don't have endpoint for access:
```
vela port-forward addon-velaux -n vela-system 8080:80
```
* Check the password by:
```
vela logs -n vela-system --name apiserver addon-velaux | grep "initialized admin username"
```
### View resources deployed
Click the application card, then you can view the details of the application.
![](./resources/succeed-first-vela-app.jpg)
## Deleting Application
If you want to delete the application when it's no longer used, simply:
1. Enter the page of environment, click `Recycle` to reclaim the resources that this environment used.
2. Go back to the list of applications and click the drop-down menu to remove it.
```
$ vela delete first-vela-app
Deleting Application "first-vela-app"
app "first-vela-app" deleted from namespace "prod"
```
That's it! You succeed at the first application delivery. Congratulation!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 602 KiB

After

Width:  |  Height:  |  Size: 260 KiB

View File

@ -79,8 +79,12 @@ spec:
chart: "redis"
version: "16.8.5"
values:
master.persistence.size: 16Gi
replica.persistence.size: 16Gi
master:
persistence:
size: 16Gi
replica:
persistence:
size: 16Gi
```
Deploy this application