update v1.5 doc
Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
This commit is contained in:
parent
e2124158c9
commit
dbde543c5b
|
@ -4,6 +4,130 @@ title: Traefik
|
|||
|
||||
Traefik 是一个现代化且易用的 HTTP 反向代理和负载均衡服务,用于部署微服务。你可以使用该插件作为你的集群网关活着微服务系统的网关。
|
||||
|
||||
|
||||
## 插件安装
|
||||
|
||||
```bash
|
||||
vela addon enable traefik
|
||||
```
|
||||
|
||||
### 访问 Traefik 的 UI
|
||||
|
||||
默认安装情况下 Traefik 无法直接访问,可通过 port-forward 进行本地代理,这仅适用于调试阶段。
|
||||
|
||||
```bash
|
||||
vela port-forward -n vela-system addon-traefik
|
||||
```
|
||||
|
||||
expected output:
|
||||
|
||||
```bash
|
||||
Forwarding from 127.0.0.1:9000 -> 9000
|
||||
Forwarding from [::1]:9000 -> 9000
|
||||
|
||||
Forward successfully! Opening browser ...
|
||||
Handling connection for 9000
|
||||
```
|
||||
|
||||
你可以通过 `http://127.0.0.1:9000/dashboard/` 地址访问到 Traefik 的 UI 可视化面板。
|
||||
|
||||
### 设置网关流量接入方式
|
||||
|
||||
如果你使用云上的集群,使用 LoadBalancer 暴露 Traefik 的访问入口是最佳方案。
|
||||
|
||||
```bash
|
||||
vela addon enable traefik serviceType=LoadBalancer
|
||||
```
|
||||
|
||||
如果在自建集群,需要根据你是作为集群网关还是应用网关来选择流量接入方式。
|
||||
|
||||
## 如何使用
|
||||
|
||||
1. 为组件配置一个 HTTP 域名
|
||||
|
||||
```bash
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: example
|
||||
namespace: e2e-test
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: oamdev/hello-world
|
||||
ports:
|
||||
- port: 8000
|
||||
expose: true
|
||||
traits:
|
||||
- properties:
|
||||
domains:
|
||||
- example.domain.com
|
||||
rules:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
port: 8080
|
||||
type: http-route
|
||||
```
|
||||
|
||||
2. 为组件配置一个 HTTPS 域名
|
||||
|
||||
首先需要准备一个证书并创建一个 Secret。
|
||||
|
||||
```yaml
|
||||
|
||||
apiVersion: v1
|
||||
type: Opaque
|
||||
data:
|
||||
tls.crt: <BASE64>
|
||||
tls.key: <BASE64>
|
||||
kind: Secret
|
||||
metadata:
|
||||
annotations:
|
||||
config.oam.dev/alias: ""
|
||||
config.oam.dev/description: ""
|
||||
labels:
|
||||
config.oam.dev/catalog: velacore-config
|
||||
config.oam.dev/multi-cluster: "true"
|
||||
config.oam.dev/project: addons
|
||||
config.oam.dev/type: config-tls-certificate
|
||||
workload.oam.dev/type: config-tls-certificate
|
||||
name: example
|
||||
```
|
||||
|
||||
应用配置案例如下:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: example-https
|
||||
namespace: e2e-test
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: oamdev/hello-world
|
||||
ports:
|
||||
- port: 8000
|
||||
expose: true
|
||||
traits:
|
||||
- properties:
|
||||
domains:
|
||||
- example.domain.com
|
||||
rules:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
port: 8080
|
||||
secrets:
|
||||
- name: example
|
||||
type: https-route
|
||||
```
|
||||
|
||||
## XDefinitions
|
||||
|
||||
### http-route(trait)
|
||||
|
@ -120,40 +244,3 @@ Traefik 是一个现代化且易用的 HTTP 反向代理和负载均衡服务,
|
|||
------------ | ------------- | ------------- | ------------- | -------------
|
||||
cert | the certificate public key encrypted by base64 | string | true |
|
||||
key | the certificate private key encrypted by base64 | string | true |
|
||||
|
||||
|
||||
## 插件安装
|
||||
|
||||
```bash
|
||||
vela addon enable traefik
|
||||
```
|
||||
|
||||
### 访问 Traefik 的 UI
|
||||
|
||||
默认安装情况下 Traefik 无法直接访问,可通过 port-forward 进行本地代理,这仅适用于调试阶段。
|
||||
|
||||
```bash
|
||||
vela port-forward -n vela-system addon-traefik
|
||||
```
|
||||
|
||||
expected output:
|
||||
|
||||
```
|
||||
Forwarding from 127.0.0.1:9000 -> 9000
|
||||
Forwarding from [::1]:9000 -> 9000
|
||||
|
||||
Forward successfully! Opening browser ...
|
||||
Handling connection for 9000
|
||||
```
|
||||
|
||||
你可以通过 `http://127.0.0.1:9000/dashboard/` 地址访问到 Traefik 的 UI 可视化面板。
|
||||
|
||||
### 设置网关流量接入方式
|
||||
|
||||
如果你使用云上的集群,使用 LoadBalancer 暴露 Traefik 的访问入口是最佳方案。
|
||||
|
||||
```bash
|
||||
vela addon enable traefik serviceType=LoadBalancer
|
||||
```
|
||||
|
||||
如果在自建集群,需要根据你是作为集群网关还是应用网关来选择流量接入方式。
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 152 KiB |
31
sidebars.js
31
sidebars.js
|
@ -170,7 +170,6 @@ module.exports = {
|
|||
'UX Customization': [
|
||||
'platform-engineers/openapi-v3-json-schema',
|
||||
'reference/ui-schema',
|
||||
'reference/topology-rule',
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -182,24 +181,18 @@ module.exports = {
|
|||
items: [
|
||||
'contributor/overview',
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Extension',
|
||||
collapsed: true,
|
||||
items: [
|
||||
{
|
||||
Addons: [
|
||||
'platform-engineers/addon/intro',
|
||||
'platform-engineers/addon/addon-cue',
|
||||
'platform-engineers/addon/addon-yaml',
|
||||
'platform-engineers/addon/addon-registry',
|
||||
],
|
||||
},
|
||||
{
|
||||
'Cloud Resources': [
|
||||
'platform-engineers/addon/terraform',
|
||||
'platform-engineers/components/component-terraform',
|
||||
],
|
||||
},
|
||||
Addons: [
|
||||
'platform-engineers/addon/intro',
|
||||
'platform-engineers/addon/addon-cue',
|
||||
'platform-engineers/addon/addon-yaml',
|
||||
'reference/topology-rule',
|
||||
'platform-engineers/addon/addon-registry',
|
||||
],
|
||||
},
|
||||
{
|
||||
'Cloud Resources': [
|
||||
'platform-engineers/addon/terraform',
|
||||
'platform-engineers/components/component-terraform',
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
@ -127,7 +127,7 @@ boot docker-entrypoint.sh lib mnt root srv usr
|
|||
dev etc lib64 opt run sys var
|
||||
```
|
||||
|
||||
- `vela port-forward` can discover and forward ports of pods or services in managed clusters to your local endpoint.
|
||||
- `vela port-forward` can discover and forward ports of pods or services in managed clusters to your local endpoint.
|
||||
|
||||
```bash
|
||||
$ vela port-forward basic-topology -n examples 8080:80
|
||||
|
|
|
@ -24,7 +24,7 @@ vela def del DEFINITION_NAME [flags]
|
|||
```
|
||||
-h, --help help for del
|
||||
-n, --namespace string Specify which namespace the definition locates. (default "vela-system")
|
||||
-t, --type string Specify the definition type of target. Valid types: component, trait, policy, workload, scope, workflow-step
|
||||
-t, --type string Specify the definition type of target. Valid types: scope, workflow-step, component, trait, policy, workload
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
|
|
@ -27,7 +27,7 @@ vela def edit NAME [flags]
|
|||
```
|
||||
-h, --help help for edit
|
||||
-n, --namespace string Specify which namespace the definition locates. (default "vela-system")
|
||||
-t, --type string Specify which definition type to get. If empty, all types will be searched. Valid types: trait, policy, workload, scope, workflow-step, component
|
||||
-t, --type string Specify which definition type to get. If empty, all types will be searched. Valid types: policy, workload, scope, workflow-step, component, trait
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
|
|
@ -28,7 +28,7 @@ vela def get NAME [flags]
|
|||
-n, --namespace string Specify which namespace the definition locates. (default "vela-system")
|
||||
-r, --revision string Get the specified version of a definition.
|
||||
--revisions List revisions of the specified definition.
|
||||
-t, --type string Specify which definition type to get. If empty, all types will be searched. Valid types: scope, workflow-step, component, trait, policy, workload
|
||||
-t, --type string Specify which definition type to get. If empty, all types will be searched. Valid types: workflow-step, component, trait, policy, workload, scope
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
|
|
@ -43,7 +43,7 @@ vela def init DEF_NAME [flags]
|
|||
--path string Specify which path the configuration(HCL) is stored in the Git repository. Valid when --git is set.
|
||||
-p, --provider alibaba Specify which provider the cloud resource definition belongs to. Only alibaba, `aws`, `azure` are supported.
|
||||
-f, --template-yaml string Specify the template yaml file that definition will use to build the schema. If empty, a default template for the given definition type will be used.
|
||||
-t, --type string Specify the type of the new definition. Valid types: component, trait, policy, workload, scope, workflow-step
|
||||
-t, --type string Specify the type of the new definition. Valid types: trait, policy, workload, scope, workflow-step, component
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
|
|
@ -27,7 +27,7 @@ vela def list [flags]
|
|||
--from string Filter definitions by which addon installed them.
|
||||
-h, --help help for list
|
||||
-n, --namespace string Specify which namespace the definition locates. (default "vela-system")
|
||||
-t, --type string Specify which definition type to list. If empty, all types will be searched. Valid types: trait, policy, workload, scope, workflow-step, component
|
||||
-t, --type string Specify which definition type to list. If empty, all types will be searched. Valid types: scope, workflow-step, component, trait, policy, workload
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: Helm repository
|
||||
title: Connect Helm Repository
|
||||
description: Configure a helm repository
|
||||
---
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: Image Registry
|
||||
title: Connect Image Registry
|
||||
description: Configure an image registry
|
||||
---
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ template: {
|
|||
}
|
||||
```
|
||||
|
||||
The rule is align with component definition, you must specify `output`, while you can use `outputs` for more objects, the format as below:
|
||||
The rule is aligned with component definition, you must specify `output`, while you can use `outputs` for more objects, the format as below:
|
||||
|
||||
```cue
|
||||
output: {
|
||||
|
|
|
@ -61,6 +61,6 @@ spec:
|
|||
image: stefanprodan/podinfo:4.0.3
|
||||
```
|
||||
|
||||
In this way, if system admin changes the ComponentDefinition, it won't affect your application.
|
||||
In this way, if system admin changes the ComponentDefinition, it won't affect your application.
|
||||
|
||||
If no revision specified, KubeVela will always use the latest revision when you upgrade your application.
|
||||
|
|
|
@ -4,6 +4,127 @@ title: Traefik
|
|||
|
||||
Traefik is a modern HTTP reverse proxy and load balancer made to deploy microservices with ease. you can use this addon as a cluster gateway or a microservices gateway.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
vela addon enable traefik
|
||||
```
|
||||
|
||||
### Visit Traefik dashboard by port-forward
|
||||
|
||||
Port forward will work as a proxy to allow visiting Traefik dashboard by local port.
|
||||
|
||||
```bash
|
||||
vela port-forward -n vela-system addon-traefik
|
||||
```
|
||||
|
||||
expected output:
|
||||
|
||||
```bash
|
||||
Forwarding from 127.0.0.1:9000 -> 9000
|
||||
Forwarding from [::1]:9000 -> 9000
|
||||
|
||||
Forward successfully! Opening browser ...
|
||||
Handling connection for 9000
|
||||
```
|
||||
|
||||
You can visiting Traefik dashboard with address `http://127.0.0.1:9000/dashboard/`.
|
||||
|
||||
### Setup with Specified Service Type
|
||||
|
||||
If your cluster has cloud LoadBalancer available:
|
||||
|
||||
```bash
|
||||
vela addon enable traefik serviceType=LoadBalancer
|
||||
```
|
||||
|
||||
## How to use
|
||||
|
||||
1. Configure a HTTP domain for a component.
|
||||
|
||||
```bash
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: example
|
||||
namespace: e2e-test
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: oamdev/hello-world
|
||||
ports:
|
||||
- port: 8000
|
||||
expose: true
|
||||
traits:
|
||||
- properties:
|
||||
domains:
|
||||
- example.domain.com
|
||||
rules:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
port: 8080
|
||||
type: http-route
|
||||
```
|
||||
|
||||
2. Configure a HTTPS domain for a component.
|
||||
|
||||
You should create a secret that includes the certificate first.
|
||||
|
||||
```yaml
|
||||
|
||||
apiVersion: v1
|
||||
type: Opaque
|
||||
data:
|
||||
tls.crt: <BASE64>
|
||||
tls.key: <BASE64>
|
||||
kind: Secret
|
||||
metadata:
|
||||
annotations:
|
||||
config.oam.dev/alias: ""
|
||||
config.oam.dev/description: ""
|
||||
labels:
|
||||
config.oam.dev/catalog: velacore-config
|
||||
config.oam.dev/multi-cluster: "true"
|
||||
config.oam.dev/project: addons
|
||||
config.oam.dev/type: config-tls-certificate
|
||||
workload.oam.dev/type: config-tls-certificate
|
||||
name: example
|
||||
```
|
||||
|
||||
The example application configuration:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: example-https
|
||||
namespace: e2e-test
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: oamdev/hello-world
|
||||
ports:
|
||||
- port: 8000
|
||||
expose: true
|
||||
traits:
|
||||
- properties:
|
||||
domains:
|
||||
- example.domain.com
|
||||
rules:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
port: 8080
|
||||
secrets:
|
||||
- name: example
|
||||
type: https-route
|
||||
```
|
||||
|
||||
## Definitions
|
||||
|
||||
### http-route(trait)
|
||||
|
@ -120,39 +241,4 @@ This component definition is designed to manage the TLS certificate
|
|||
Name | Description | Type | Required | Default
|
||||
------------ | ------------- | ------------- | ------------- | -------------
|
||||
cert | the certificate public key encrypted by base64 | string | true |
|
||||
key | the certificate private key encrypted by base64 | string | true |
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
vela addon enable traefik
|
||||
```
|
||||
|
||||
### Visit Traefik dashboard by port-forward
|
||||
|
||||
Port forward will work as a proxy to allow visiting Traefik dashboard by local port.
|
||||
|
||||
```bash
|
||||
vela port-forward -n vela-system addon-traefik
|
||||
```
|
||||
|
||||
expected output:
|
||||
|
||||
```
|
||||
Forwarding from 127.0.0.1:9000 -> 9000
|
||||
Forwarding from [::1]:9000 -> 9000
|
||||
|
||||
Forward successfully! Opening browser ...
|
||||
Handling connection for 9000
|
||||
```
|
||||
|
||||
You can visiting Traefik dashboard with address `http://127.0.0.1:9000/dashboard/`.
|
||||
|
||||
### Setup with Specified Service Type
|
||||
|
||||
If your cluster has cloud LoadBalancer available:
|
||||
|
||||
```bash
|
||||
vela addon enable traefik serviceType=LoadBalancer
|
||||
```
|
||||
key | the certificate private key encrypted by base64 | string | true |
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: Access the application
|
||||
title: Access Application
|
||||
---
|
||||
|
||||
After deploying the application, the next station is publishing your service.
|
||||
|
|
|
@ -180,8 +180,7 @@
|
|||
{
|
||||
"UX Customization": [
|
||||
"platform-engineers/openapi-v3-json-schema",
|
||||
"reference/ui-schema",
|
||||
"reference/topology-rule"
|
||||
"reference/ui-schema"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -193,24 +192,18 @@
|
|||
"items": [
|
||||
"contributor/overview",
|
||||
{
|
||||
"type": "category",
|
||||
"label": "Extension",
|
||||
"collapsed": true,
|
||||
"items": [
|
||||
{
|
||||
"Addons": [
|
||||
"platform-engineers/addon/intro",
|
||||
"platform-engineers/addon/addon-cue",
|
||||
"platform-engineers/addon/addon-yaml",
|
||||
"platform-engineers/addon/addon-registry"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Cloud Resources": [
|
||||
"platform-engineers/addon/terraform",
|
||||
"platform-engineers/components/component-terraform"
|
||||
]
|
||||
}
|
||||
"Addons": [
|
||||
"platform-engineers/addon/intro",
|
||||
"platform-engineers/addon/addon-cue",
|
||||
"platform-engineers/addon/addon-yaml",
|
||||
"reference/topology-rule",
|
||||
"platform-engineers/addon/addon-registry"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Cloud Resources": [
|
||||
"platform-engineers/addon/terraform",
|
||||
"platform-engineers/components/component-terraform"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue