fix docs and update (#244)
This commit is contained in:
parent
7bfa37db18
commit
2605dc4cfe
|
@ -132,4 +132,4 @@ Version: 0.1.2
|
|||
|
||||
## More
|
||||
|
||||
Refer to the [blog post](/blog/kubevela-jenkins-cicd) for more details about deploying Jenkins + KubeVela and more comprehensive demo for application rolling update.
|
||||
Refer to the [blog post](/blog/2021/09/02/kubevela-jenkins-cicd) for more details about deploying Jenkins + KubeVela and more comprehensive demo for application rolling update.
|
|
@ -8,7 +8,7 @@ KubeVela takes Application as the basis of modeling, uses Components and Traits
|
|||
|
||||
In modeling, the YAML file is the bearer of the application deployment plan. A typical YAML example is as follows:
|
||||
|
||||
```
|
||||
```yaml
|
||||
# sample.yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
|
@ -16,17 +16,17 @@ metadata:
|
|||
name: website
|
||||
spec:
|
||||
components:
|
||||
- name: frontend # This is the component I want to deploy
|
||||
- name: frontend # e.g. we want to deploy a frontend component and serves as web service
|
||||
type: webservice
|
||||
properties:
|
||||
image: nginx
|
||||
traits:
|
||||
- type: cpuscaler # Automatically scale the component by CPU usage after deployed
|
||||
- type: cpuscaler # e.g. we add a CPU based auto scaler to this component
|
||||
properties:
|
||||
min: 1
|
||||
max: 10
|
||||
cpuPercent: 60
|
||||
- type: sidecar # Inject a fluentd sidecar before applying the component to runtime cluster
|
||||
- type: sidecar # add a sidecar container into this component
|
||||
properties:
|
||||
name: "sidecar-test"
|
||||
image: "fluentd"
|
||||
|
@ -37,19 +37,129 @@ spec:
|
|||
cmd:
|
||||
- sleep
|
||||
- '1000'
|
||||
policies:
|
||||
- name: demo-policy
|
||||
type: env-binding
|
||||
properties:
|
||||
envs:
|
||||
- name: test
|
||||
placement:
|
||||
namespaceSelector:
|
||||
name: test
|
||||
- name: prod
|
||||
placement:
|
||||
namespaceSelector:
|
||||
name: prod
|
||||
workflow:
|
||||
steps:
|
||||
#workflow step name
|
||||
- name: deploy-test-env
|
||||
type: multi-env
|
||||
properties:
|
||||
# Specify the policy name
|
||||
policy: demo-policy
|
||||
# Specify the env name in the policy
|
||||
env: test
|
||||
- name: manual-approval
|
||||
# use suspend can stop workflow and wait here until condition changed
|
||||
type: suspend
|
||||
- name: deploy-prod-env
|
||||
type: multi-env
|
||||
properties:
|
||||
# Specify the policy name
|
||||
policy: demo-policy
|
||||
# Specify the env name in the policy
|
||||
env: prod
|
||||
```
|
||||
|
||||
|
||||
The fields here correspond to:
|
||||
|
||||
- apiVersion: The OAM API version used.
|
||||
- kind: of CRD Resourse Type. The one we use most often is Pod.
|
||||
- metadata: business-related information. For example, this time I want to create a website.
|
||||
- Spec: Describe what we need to deliver and tell Kubernetes what to make. Here we put the components of KubeVela.
|
||||
- Spec: Describe what we need to deliver and tell Kubernetes what to make. Here we put the `components`, `policies` and `workflow` of KubeVela.
|
||||
- components: KubeVela's component system.
|
||||
- Traits: KubeVela's operation and maintenance feature system.
|
||||
- Traits: KubeVela's operation and maintenance feature system, works in component level.
|
||||
- Policies: KubeVela's application level policy.
|
||||
- Workflow: KubeVela's application level deployment workflow, you can custom every deployment step with it.
|
||||
|
||||
## Components
|
||||
|
||||
KubeVela has some built-in component types, you can find them by using [KubeVela CLI](../getting-started/quick-install#3-get-kubevela-cli):
|
||||
|
||||
```
|
||||
vela components
|
||||
```
|
||||
|
||||
The output shows:
|
||||
|
||||
```
|
||||
NAME NAMESPACE WORKLOAD DESCRIPTION
|
||||
helm vela-system autodetects.core.oam.dev helm release is a group of K8s resources from either git
|
||||
repository or helm repo
|
||||
kustomize vela-system autodetects.core.oam.dev kustomize can fetching, building, updating and applying
|
||||
Kustomize manifests from git repo.
|
||||
task vela-system jobs.batch Describes jobs that run code or a script to completion.
|
||||
webservice vela-system deployments.apps Describes long-running, scalable, containerized services
|
||||
that have a stable network endpoint to receive external
|
||||
network traffic from customers.
|
||||
worker vela-system deployments.apps Describes long-running, scalable, containerized services
|
||||
that running at backend. They do NOT have network endpoint
|
||||
to receive external network traffic.
|
||||
alibaba-ack vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud ACK cluster
|
||||
alibaba-oss vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud OSS object
|
||||
alibaba-rds vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud RDS object
|
||||
```
|
||||
|
||||
You can continue to use [Helm](../end-user/components/helm) and [Kustomize](../end-user/components/kustomize) components to deploy your application, an application is a deployment plan.
|
||||
|
||||
If you're a platform builder who's familiar with Kubernetes, you can learn to [define your custom component](../platform-engineers/components/custom-component) to extend every kind of component in KubeVela. Especially, [Terraform Component](../platform-engineers/components/component-terraform) is one of the best practice.
|
||||
|
||||
|
||||
## Traits
|
||||
|
||||
KubeVela also has many built-in traits, search them by using [KubeVela CLI](../getting-started/quick-install#3-get-kubevela-cli):
|
||||
|
||||
```
|
||||
vela traits
|
||||
```
|
||||
|
||||
The result can be:
|
||||
|
||||
```
|
||||
NAME NAMESPACE APPLIES-TO CONFLICTS-WITH POD-DISRUPTIVE DESCRIPTION
|
||||
annotations vela-system deployments.apps true Add annotations for your Workload.
|
||||
cpuscaler vela-system webservice,worker false Automatically scale the component based on CPU usage.
|
||||
ingress vela-system webservice,worker false Enable public web traffic for the component.
|
||||
labels vela-system deployments.apps true Add labels for your Workload.
|
||||
scaler vela-system webservice,worker false Manually scale the component.
|
||||
sidecar vela-system deployments.apps true Inject a sidecar container to the component.
|
||||
```
|
||||
|
||||
You can learn how to bind trait by these detail docs, such as [ingress trait](../end-user/traits/ingress).
|
||||
|
||||
If you're a platform builder who's familiar with Kubernetes, you can learn to [define your custom trait](../platform-engineers/traits/customize-trait) to extend any operational capability for your users.
|
||||
|
||||
## Policy
|
||||
|
||||
Policy allows you to define application level capabilities, such as health check, security group, fire wall, SLO and so on.
|
||||
|
||||
Policy is similar to trait, but trait works for component while policy works for the whole application.
|
||||
|
||||
## Workflow
|
||||
|
||||
In KubeVela, Workflow allows user to glue various operation and maintenance tasks into one process, and achieve automated and rapid delivery of cloud-native applications to any hybrid environment. From the design point of view, the Workflow is to customize the control logic: not only simply apply all resources, but also to provide some process-oriented flexibility. For example, the use of Workflow can help us implement complex operations such as pause, manual verification, waiting state, data flow transmission, multi-environment grayscale, and A/B testing.
|
||||
|
||||
The Workflow is based on modular design. Each Workflow module is defined by a Definition CRD and provided to users for operation through K8s API. As a "super glue", the Workflow module can combine any of your tools and processes through the CUE language. This allows you to create your own modules through a powerful declarative language and cloud-native APIs.
|
||||
The Workflow is based on modular design. Each Workflow module is defined by a Definition CRD and provided to users for operation through K8s API. As a "super glue", the Workflow module can combine any of your tools and processes through the CUE language. This allows you to create your own modules through a powerful declarative language and cloud-native APIs.
|
||||
|
||||
> Especially, workflow works in application level, if you specify workflow, the resources won't be deployed if you don't specify any step to deploy it.
|
||||
|
||||
If you're a platform builder who's familiar with Kubernetes, you can learn to [define your own workflow step by using CUE](../platform-engineers/workflow/steps).
|
||||
|
||||
## What's Next
|
||||
|
||||
Here are some recommended next steps:
|
||||
|
||||
- Learn KubeVela's user guide to know how to deploy component, let's start from [helm component](../end-user/components/helm).
|
||||
- Learn KubeVela's admin guide to learn more about [the OAM model](../platform-engineers/oam/oam-model).
|
||||
|
|
|
@ -55,3 +55,10 @@ KubeVela allows you to deploy and manage application resources in a consistent w
|
|||
Kubernetes cluster (e.g. local, managed offerings, IoT/edge, on-prem)
|
||||
and non-Kubernetes environments on clouds.
|
||||
KubeVela itself does not run on the execution infrastructures, but manage them instead.
|
||||
|
||||
## What's Next
|
||||
|
||||
Here are some recommended next steps:
|
||||
|
||||
- Learn KubeVela's user guide to know how to deploy component, let's start from [helm component](../end-user/components/helm).
|
||||
- Learn KubeVela's admin guide to learn more about [the OAM model](../platform-engineers/oam/oam-model).
|
||||
|
|
|
@ -1,139 +0,0 @@
|
|||
---
|
||||
title: Workflow
|
||||
---
|
||||
|
||||
Workflow in KubeVela empowers users to glue any operational tasks to automate the delivery of applications to hybrid environments.
|
||||
It is designed to customize the control logic -- not just blindly apply all resources, but provide more procedural flexiblity.
|
||||
This provides solutions to build more complex operations, e.g. workflow suspend, approval gate, data flow, multi-stage rollout, A/B testing.
|
||||
|
||||
Workflow is modular by design.
|
||||
Each module is defined by a Definition CRD and exposed via K8s API.
|
||||
Under the hood, it uses a powerful declarative language -- CUE as the superglue for your favourite tools and processes.
|
||||
|
||||
Here is an example:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
spec:
|
||||
components:
|
||||
- name: database
|
||||
type: helm
|
||||
properties:
|
||||
repoUrl: chart-repo-url
|
||||
chart: mysql
|
||||
|
||||
- name: web
|
||||
type: helm
|
||||
properties:
|
||||
repoUrl: chart-repo-url
|
||||
chart: my-web
|
||||
|
||||
# Deploy the database first and then the web component.
|
||||
# In each step, it ensures the resource has been deployed successfully before jumping to next step.
|
||||
# The connection information will be emitted as output from database and input for web component.
|
||||
workflow:
|
||||
|
||||
# Workflow contains multiple steps and each step instantiates from a Definition.
|
||||
# By running a workflow of an application, KubeVela will orchestrate the flow of data between steps.
|
||||
steps:
|
||||
- name: deploy-database
|
||||
type: apply-and-wait
|
||||
outputs:
|
||||
- name: db-conn
|
||||
exportKey: outConn
|
||||
properties:
|
||||
component: database
|
||||
resourceType: StatefulSet
|
||||
resourceAPIVersion: apps/v1beta2
|
||||
names:
|
||||
- mysql
|
||||
|
||||
- name: deploy-web
|
||||
type: apply-and-wait
|
||||
inputs:
|
||||
- from: db-conn # input comes from the output from `deploy-database` step
|
||||
parameterKey: dbConn
|
||||
properties:
|
||||
component: web
|
||||
resourceType: Deployment
|
||||
resourceAPIVersion: apps/v1
|
||||
names:
|
||||
- my-web
|
||||
|
||||
---
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: WorkflowStepDefinition
|
||||
metadata:
|
||||
name: apply-and-wait
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
import (
|
||||
"vela/op"
|
||||
)
|
||||
parameter: {
|
||||
component: string
|
||||
names: [...string]
|
||||
resourceType: string
|
||||
resourceAPIVersion: string
|
||||
dbConn?: string
|
||||
}
|
||||
// apply the component
|
||||
apply: op.#ApplyComponent & {
|
||||
component: parameter.component
|
||||
if dbConn != _|_ {
|
||||
spec: containers: [{env: [{name: "DB_CONN",value: parameter.dbConn}]}]
|
||||
}
|
||||
}
|
||||
// iterate through given resource names and wait for them
|
||||
step: op.#Steps & {
|
||||
for index, resource in parameter.names {
|
||||
// read resource object
|
||||
"resource-\(index)": op.#Read & {
|
||||
value: {
|
||||
kind: parameter.resourceType
|
||||
apiVersion: parameter.resourceAPIVersion
|
||||
metadata: {
|
||||
name: resource
|
||||
namespace: context.namespace
|
||||
}
|
||||
}
|
||||
}
|
||||
// wait until resource object satisfy given condition.
|
||||
"wait-\(index)": op.#ConditionalWait & {
|
||||
if step["resource-\(index)"].workload.status.ready == "true" {
|
||||
continue: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
outConn: apply.status.address.ip
|
||||
```
|
||||
|
||||
Here are more detailed explanation of the above example:
|
||||
|
||||
- There is a WorkflowStepDefinition that defines the templated operation process:
|
||||
- It applies the specified component.
|
||||
It uses the `op.#ApplyComponent` action which applies all resources of a component.
|
||||
- It then waits all resources of given names to be ready.
|
||||
It uses `op.#Read` action which reads a resource into specified key,
|
||||
and then uses `op#ConditionalWait` which waits until the `continue` field becomes true.
|
||||
- There is an Application that uses the predefined Definition to initiate delivery of two service components:
|
||||
- It first does `apply-and-wait` on `database` component.
|
||||
This will invoke the templated process as defined above with given properties.
|
||||
- Once the first step is finished, it outputs the value of the `outConn` key to output named `db-conn`,
|
||||
which basically means any steps can use the output `db-conn` as input later.
|
||||
- The second step that takes an input `db-conn` from previous output will
|
||||
get the value of `db-conn` and fill it into the parameter key `dbConn`.
|
||||
- It then does `apply-and-wait` on `web` component.
|
||||
This will invoke the same templated process as before except that this time the `dbConn` field will have value.
|
||||
This basically means the container env field will be rendered as well.
|
||||
- Once the second step is finished, the workflow will run to completion and stop.
|
||||
|
||||
So far we have introduced the basic concept of KubeVela Workflow. For next steps, you can:
|
||||
|
||||
- [Try out hands-on workflow scenarios](../end-user/workflow/apply-component).
|
||||
- [Read how to create your own Definition module](../platform-engineers/workflow/steps).
|
||||
- [Learn the design behind the workflow system](https://github.com/oam-dev/kubevela/blob/master/design/vela-core/workflow_policy.md).
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
title: System Addon
|
||||
---
|
||||
|
||||
TBD
|
|
@ -8,7 +8,7 @@ KubeVela efficiently and securely integrates different types of cloud resources
|
|||
|
||||
## Check the cloud resources in KubeVela
|
||||
|
||||
We can use [KubeVela CLI](../getting-started/quick-install.mdx#3-Get-KubeVela-CLI) to check the available cloud resources in the current cluster:
|
||||
We can use [KubeVela CLI](../getting-started/quick-install#3-Get-KubeVela-CLI) to check the available cloud resources in the current cluster:
|
||||
|
||||
```shell
|
||||
$ vela components
|
||||
|
|
|
@ -1,212 +0,0 @@
|
|||
---
|
||||
title: Component Delivery // Deprecated
|
||||
---
|
||||
|
||||
Components are one of the core concepts of KubeVela. You can use them to build the most common types of services, such as a Web Service that provides external access, a Worker that runs scheduled tasks on the backend, or enables Redis and including OSS from Cloud Provider and so on.
|
||||
|
||||
In order to help you quickly and comprehensively implement your business, KubeVela provides a large number of out-of-the-box component types, which not only include business components for conventional microservice scenarios, such as "service-oriented components" (webservice) and "back-end running components" (Worker), “one-off task component” (task), etc.
|
||||
|
||||
KubeVela also include general-purpose components for different product categories in the community, such as the “Helm component” that supports Helm Chart, the “Kustomize component” that supports Git Repo, etc. and at last it contains a series of commonly used cloud service components. If KubeVela's built-in component types cannot meet all your needs, KubeVela also has the ability to expand to almost any type of component products.
|
||||
|
||||
## KubeVela's Component
|
||||
|
||||
We use [KubeVela CLI][1] to check out all the available Components:
|
||||
|
||||
```shell
|
||||
$ vela components
|
||||
NAME NAMESPACE WORKLOAD DESCRIPTION
|
||||
alibaba-ack vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud ACK cluster
|
||||
alibaba-oss vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud OSS object
|
||||
alibaba-rds vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud RDS object
|
||||
helm vela-system autodetects.core.oam.dev helm release is a group of K8s resources from either git
|
||||
repository or helm repo
|
||||
kustomize vela-system autodetects.core.oam.dev kustomize can fetching, building, updating and applying
|
||||
Kustomize manifests from git repo.
|
||||
raw vela-system autodetects.core.oam.dev raw allow users to specify raw K8s object in properties
|
||||
task vela-system jobs.batch Describes jobs that run code or a script to completion.
|
||||
webservice vela-system deployments.apps Describes long-running, scalable, containerized services
|
||||
that have a stable network endpoint to receive external
|
||||
network traffic from customers.
|
||||
worker vela-system deployments.apps Describes long-running, scalable, containerized services
|
||||
that running at backend. They do NOT have network endpoint
|
||||
to receive external network traffic.
|
||||
```
|
||||
|
||||
Let's take several typical component types as example to introduce the usage of KubeVela component delivery. If you want to directly view how Cloud Services are used, please read [Integrated Cloud Service][2].
|
||||
|
||||
|
||||
## Using Service-Based Components (Web Service)
|
||||
|
||||
Service-oriented components are components that support external access to services with the container as the core, and their functions cover the needs of most of he microservice scenarios.
|
||||
|
||||
Please copy shell below and apply to the cluster:
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
# YAML begins
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: website
|
||||
spec:
|
||||
components:
|
||||
- name: frontend
|
||||
type: webservice
|
||||
properties:
|
||||
image: oamdev/testapp:v1
|
||||
cmd: ["node", "server.js"]
|
||||
port: 8080
|
||||
cpu: "0.1"
|
||||
env:
|
||||
- name: FOO
|
||||
value: bar
|
||||
# YAML ends
|
||||
EOF
|
||||
```
|
||||
You can also save the YAML file as website.yaml and use the `kubectl apply -f website.yaml` command to deploy.
|
||||
|
||||
Next, check the deployment status of the application through `kubectl get application <application name> -o yaml`:
|
||||
```shell
|
||||
$ kubectl get application website -o yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: website
|
||||
... # Omit non-critical information
|
||||
spec:
|
||||
components:
|
||||
- name: frontend
|
||||
properties:
|
||||
... # Omit non-critical information
|
||||
type: webservice
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-08-28T10:26:47Z"
|
||||
reason: Available
|
||||
status: "True"
|
||||
... # Omit non-critical information
|
||||
type: HealthCheck
|
||||
observedGeneration: 1
|
||||
... # Omit non-critical information
|
||||
services:
|
||||
- healthy: true
|
||||
name: frontend
|
||||
workloadDefinition:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
status: running
|
||||
```
|
||||
|
||||
When we see that the `status.services.healthy` field is true and the status is running, it means that the entire application is delivered successfully.
|
||||
|
||||
If status shows as rendering or healthy as false, it means that the application has either failed to deploy or is still being deployed. Please proceed according to the information returned in `kubectl get application <application name> -o yaml`.
|
||||
|
||||
You can also view through the CLI of vela, using the following command:
|
||||
```shell
|
||||
$ vela ls
|
||||
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
|
||||
website frontend webservice running healthy 2021-08-28 18:26:47 +0800 CST
|
||||
```
|
||||
We also see that the PHASE of the app is running and the STATUS is healthy.
|
||||
|
||||
## Using Helm Component
|
||||
|
||||
KubeVela's Helm component meets the needs of users to connect to Helm Chart. You can deploy any ready-made Helm chart software package from Helm Repo, Git Repo or OSS bucket through the Helm component, and overwrite its parameters.
|
||||
|
||||
We use the Chart package deployment method from the Helm Repo to explain. In this `Application`, we hope to deliver a component called redis-comp. It is a chart from the [bitnami](https://charts.bitnami.com/bitnami).
|
||||
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: app-delivering-chart
|
||||
spec:
|
||||
components:
|
||||
- name: redis-comp
|
||||
type: helm
|
||||
properties:
|
||||
chart: redis-cluster
|
||||
version: 6.2.7
|
||||
url: https://charts.bitnami.com/bitnami
|
||||
repoType: helm
|
||||
EOF
|
||||
```
|
||||
|
||||
Please copy the above code block and deploy it directly to the runtime cluster:
|
||||
```shell
|
||||
application.core.oam.dev/app-delivering-chart created
|
||||
```
|
||||
|
||||
Finally, we use `vela ls` to view the application status after successful delivery:
|
||||
```shell
|
||||
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
|
||||
app-delivering-chart redis-comp helm running healthy 2021-08-28 18:48:21 +0800 CST
|
||||
```
|
||||
|
||||
We also see that the PHASE of the app-delivering-chart APP is running and the STATUS is healthy.
|
||||
|
||||
For usage examples of Git repositories and OSS buckets, and detailed configuration information about them, please go to Built-in Components in the Admin's Guide.
|
||||
|
||||
## Using Kustomize Component
|
||||
|
||||
KubeVela's `kustomize` component meets the needs of users to directly connect Yaml files and folders as component products. No matter whether your Yaml file/folder is stored in a Git Repo or an OSS bucket, KubeVela can read and deliver it.
|
||||
|
||||
Let's take the YAML folder component from the OSS bucket registry as an example to explain the usage. In the `Application` this time, I hope to deliver a component named bucket-comp. The deployment file corresponding to the component is stored in the cloud storage OSS bucket, and the corresponding bucket name is definition-registry. `kustomize.yaml` comes from this address of oss-cn-beijing.aliyuncs.com and the path is `./app/prod/`.
|
||||
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: bucket-app
|
||||
spec:
|
||||
components:
|
||||
- name: bucket-comp
|
||||
type: kustomize
|
||||
properties:
|
||||
repoType: oss
|
||||
# If the bucket is private, you will need to provide
|
||||
secretRef: bucket-secret
|
||||
url: oss-cn-beijing.aliyuncs.com
|
||||
oss:
|
||||
bucketName: definition-registry
|
||||
path: ./app/prod/
|
||||
EOF
|
||||
```
|
||||
Please copy the above code block and deploy it directly to the runtime cluster:
|
||||
|
||||
```shell
|
||||
application.core.oam.dev/bucket-app created
|
||||
```
|
||||
|
||||
Finally, we use `vela ls` to view the application status after successful delivery:
|
||||
```shell
|
||||
vela ls
|
||||
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
|
||||
bucket-app bucket-comp kustomize running healthy 2021-08-28 18:53:14 +0800 CST
|
||||
```
|
||||
|
||||
The PHASE of the app is running, and the STATUS is healthy. Successful application deployment!
|
||||
|
||||
For usage examples of Git repositories and their detailed configuration item information, please go to Built-in Components in the Admin Guide.
|
||||
|
||||
## Using Cloud Service Component
|
||||
|
||||
Cloud Service components are also the core components supported by KubeVela. Cloud Services are often not used separately. Cloud Services such as databases and caches are often used after they are created. The relevant information is transferred to other components. At the same time, Cloud Services involve different cloud vendors, and Some authentication-related preparations will be explained independently in the chapter [Integrated Cloud Services][5].
|
||||
|
||||
## Custom Component
|
||||
|
||||
When none of the above KubeVela's built-in unpacking components can meet your needs, don’t worry, KubeVela provides powerful expansion capabilities and can be connected to almost any type of component form. You can check the [custom components][6] in the Admin Guide to Learn about how to use CUE and Kubernetes to extend KubeVela's component types.
|
||||
|
||||
## Next
|
||||
|
||||
- Visit the [Integrated Cloud Services][7] document to master the Cloud Service integration methods of different types and different vendors
|
||||
- Visit the [Binding Trait][8] document to master how to bind the operation and maintenance actions and strategies you need to the component
|
||||
|
||||
[1]: ../getting-started/quick-install#3-get-kubevela-cli
|
||||
[2]: ./cloud-services
|
||||
|
||||
[5]: ./cloud-services
|
||||
[6]: ../platform-engineers/components/custom-component
|
||||
[7]: ./cloud-services
|
||||
[8]: ./binding-traits
|
|
@ -29,4 +29,8 @@ spec:
|
|||
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
|
||||
restartPolicy: Never
|
||||
backoffLimit: 4
|
||||
```
|
||||
```
|
||||
|
||||
## Attributes
|
||||
|
||||
Just write the whole Kubernetes Resource in properties.
|
|
@ -21,16 +21,13 @@ spec:
|
|||
cmd: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
|
||||
```
|
||||
|
||||
## Description
|
||||
## Attributes
|
||||
|
||||
```console
|
||||
# Properties
|
||||
+----------------+--------------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+----------------+--------------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| -------------- | ------------------------------------------------------------------------------------------------ | --------------------------------- | -------- | ------- |
|
||||
| cmd | Commands to run in the container | []string | false | |
|
||||
| env | Define arguments by using environment variables | [[]env](#env) | false | |
|
||||
| count | Specify number of tasks to run in parallel | int | true | 1 |
|
||||
| count | Specify number of tasks to run in parallel | int | true | 1 |
|
||||
| restart | Define the job restart policy, the value can only be Never or OnFailure. By default, it's Never. | string | true | Never |
|
||||
| image | Which image would you like to use for your service | string | true | |
|
||||
| cpu | Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core) | string | false | |
|
||||
|
@ -38,13 +35,12 @@ spec:
|
|||
| volumes | Declare volumes and volumeMounts | [[]volumes](#volumes) | false | |
|
||||
| livenessProbe | Instructions for assessing whether the container is alive. | [livenessProbe](#livenessProbe) | false | |
|
||||
| readinessProbe | Instructions for assessing whether the container is in a suitable state to serve traffic. | [readinessProbe](#readinessProbe) | false | |
|
||||
+----------------+--------------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
|
||||
|
||||
########### readinessProbe
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
### readinessProbe
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
|
||||
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
|
||||
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
|
||||
|
@ -54,56 +50,51 @@ spec:
|
|||
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
|
||||
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
|
||||
| | both the exec attribute and the httpGet attribute. | | | |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| | not ready (readiness probe). | | | |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
############### tcpSocket
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
#### tcpSocket
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
|
||||
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
|
||||
|
||||
############# httpGet
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### httpGet
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
|
||||
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
|
||||
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
|
||||
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
############## httpHeaders
|
||||
+-------+-------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
##### httpHeaders
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----- | ----------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| value | | string | true | |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
|
||||
|
||||
############ exec
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
#### exec
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
|
||||
|
||||
###### livenessProbe
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
### livenessProbe
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
|
||||
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
|
||||
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
|
||||
|
@ -113,85 +104,74 @@ spec:
|
|||
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
|
||||
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
|
||||
| | both the exec attribute and the httpGet attribute. | | | |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| | not ready (readiness probe). | | | |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
########## tcpSocket
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
#### tcpSocket
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
|
||||
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
|
||||
|
||||
######## httpGet
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### httpGet
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
|
||||
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
|
||||
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
|
||||
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
######### httpHeaders
|
||||
+-------+-------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
##### httpHeaders
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----- | ----------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| value | | string | true | |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
|
||||
|
||||
####### exec
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
#### exec
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
|
||||
|
||||
##### volumes
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| --------- | ------------------------------------------------------------------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| mountPath | | string | true | |
|
||||
| type | Specify volume type, options: "pvc","configMap","secret","emptyDir" | string | true | |
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
|
||||
|
||||
## env
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
#### env
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| --------- | --------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| name | Environment variable name | string | true | |
|
||||
| value | The value of the environment variable | string | false | |
|
||||
| valueFrom | Specifies a source the value of this var should come from | [valueFrom](#valueFrom) | false | |
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
### valueFrom
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### valueFrom
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------ | ------------------------------------------------ | ----------------------------- | -------- | ------- |
|
||||
| secretKeyRef | Selects a key of a secret in the pod's namespace | [secretKeyRef](#secretKeyRef) | true | |
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
#### secretKeyRef
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ---------------------------------------------------------------- | ------ | -------- | ------- |
|
||||
| name | The name of the secret in the pod's namespace to select from | string | true | |
|
||||
| key | The key of the secret to select from. Must be a valid secret key | string | true | |
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
```
|
||||
| key | The key of the secret to select from. Must be a valid secret key | string | true | |
|
|
@ -2,11 +2,12 @@
|
|||
title: Web Service
|
||||
---
|
||||
|
||||
Describes long-running, scalable, containerized services that have a stable network endpoint to receive external network traffic from customers.
|
||||
Service-oriented components are components that support external access to services with the container as the core, and their functions cover the needs of most of he microservice scenarios.
|
||||
|
||||
## How-to
|
||||
|
||||
```YAML
|
||||
Please copy shell below and apply to the cluster:
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
# YAML begins
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
|
@ -23,25 +24,63 @@ spec:
|
|||
env:
|
||||
- name: FOO
|
||||
value: bar
|
||||
- name: FOO
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: bar
|
||||
key: bar
|
||||
# YAML ends
|
||||
EOF
|
||||
```
|
||||
You can also save the YAML file as website.yaml and use the `kubectl apply -f website.yaml` command to deploy.
|
||||
|
||||
Next, check the deployment status of the application through `kubectl get application <application name> -o yaml`:
|
||||
```shell
|
||||
$ kubectl get application website -o yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: website
|
||||
... # Omit non-critical information
|
||||
spec:
|
||||
components:
|
||||
- name: frontend
|
||||
properties:
|
||||
... # Omit non-critical information
|
||||
type: webservice
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-08-28T10:26:47Z"
|
||||
reason: Available
|
||||
status: "True"
|
||||
... # Omit non-critical information
|
||||
type: HealthCheck
|
||||
observedGeneration: 1
|
||||
... # Omit non-critical information
|
||||
services:
|
||||
- healthy: true
|
||||
name: frontend
|
||||
workloadDefinition:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
status: running
|
||||
```
|
||||
|
||||
## Description
|
||||
When we see that the `status.services.healthy` field is true and the status is running, it means that the entire application is delivered successfully.
|
||||
|
||||
```console
|
||||
$ vela show webservice
|
||||
# Properties
|
||||
+------------------+-------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------------------+-------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
If status shows as rendering or healthy as false, it means that the application has either failed to deploy or is still being deployed. Please proceed according to the information returned in `kubectl get application <application name> -o yaml`.
|
||||
|
||||
You can also view through the CLI of vela, using the following command:
|
||||
```shell
|
||||
$ vela ls
|
||||
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
|
||||
website frontend webservice running healthy 2021-08-28 18:26:47 +0800 CST
|
||||
```
|
||||
We also see that the PHASE of the app is running and the STATUS is healthy.
|
||||
|
||||
## Attributes
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---------------- | ----------------------------------------------------------------------------------------- | --------------------------------- | -------- | ------- |
|
||||
| cmd | Commands to run in the container | []string | false | |
|
||||
| env | Define arguments by using environment variables | [[]env](#env) | false | |
|
||||
| image | Which image would you like to use for your service | string | true | |
|
||||
| port | Which port do you want customer traffic sent to | int | true | 80 |
|
||||
| port | Which port do you want customer traffic sent to | int | true | 80 |
|
||||
| imagePullPolicy | Specify image pull policy for your service | string | false | |
|
||||
| cpu | Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core) | string | false | |
|
||||
| memory | Specifies the attributes of the memory resource required for the container. | string | false | |
|
||||
|
@ -49,13 +88,12 @@ $ vela show webservice
|
|||
| livenessProbe | Instructions for assessing whether the container is alive. | [livenessProbe](#livenessProbe) | false | |
|
||||
| readinessProbe | Instructions for assessing whether the container is in a suitable state to serve traffic. | [readinessProbe](#readinessProbe) | false | |
|
||||
| imagePullSecrets | Specify image pull secrets for your service | []string | false | |
|
||||
+------------------+-------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
|
||||
|
||||
########### readinessProbe
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
### readinessProbe
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
|
||||
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
|
||||
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
|
||||
|
@ -65,56 +103,47 @@ $ vela show webservice
|
|||
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
|
||||
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
|
||||
| | both the exec attribute and the httpGet attribute. | | | |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| | not ready (readiness probe). | | | |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
############### tcpSocket
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
#### tcpSocket
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
|
||||
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
|
||||
|
||||
############# httpGet
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### httpGet
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
|
||||
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
|
||||
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
|
||||
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
############## httpHeaders
|
||||
+-------+-------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
##### httpHeaders
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----- | ----------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| value | | string | true | |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
|
||||
|
||||
############ exec
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
###### exec
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
|
||||
|
||||
###### livenessProbe
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
### livenessProbe
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
|
||||
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
|
||||
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
|
||||
|
@ -124,85 +153,68 @@ $ vela show webservice
|
|||
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
|
||||
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
|
||||
| | both the exec attribute and the httpGet attribute. | | | |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| | not ready (readiness probe). | | | |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
########## tcpSocket
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
###### tcpSocket
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
|
||||
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
|
||||
|
||||
######## httpGet
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
##### httpGet
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
|
||||
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
|
||||
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
|
||||
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
######### httpHeaders
|
||||
+-------+-------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
###### httpHeaders
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----- | ----------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| value | | string | true | |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
|
||||
|
||||
####### exec
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
##### exec
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
|
||||
|
||||
##### volumes
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
### volumes
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| --------- | ------------------------------------------------------------------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| mountPath | | string | true | |
|
||||
| type | Specify volume type, options: "pvc","configMap","secret","emptyDir" | string | true | |
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
|
||||
|
||||
## env
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
#### env
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| --------- | --------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| name | Environment variable name | string | true | |
|
||||
| value | The value of the environment variable | string | false | |
|
||||
| valueFrom | Specifies a source the value of this var should come from | [valueFrom](#valueFrom) | false | |
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
### valueFrom
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------ | ------------------------------------------------ | ----------------------------- | -------- | ------- |
|
||||
| secretKeyRef | Selects a key of a secret in the pod's namespace | [secretKeyRef](#secretKeyRef) | true | |
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
#### secretKeyRef
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ---------------------------------------------------------------- | ------ | -------- | ------- |
|
||||
| name | The name of the secret in the pod's namespace to select from | string | true | |
|
||||
| key | The key of the secret to select from. Must be a valid secret key | string | true | |
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
```
|
|
@ -22,14 +22,10 @@ spec:
|
|||
- "1000"
|
||||
```
|
||||
|
||||
## Description
|
||||
## Attributes
|
||||
|
||||
```console
|
||||
$ vela show worker
|
||||
# Properties
|
||||
+------------------+-------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------------------+-------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---------------- | ----------------------------------------------------------------------------------------- | --------------------------------- | -------- | ------- |
|
||||
| cmd | Commands to run in the container | []string | false | |
|
||||
| env | Define arguments by using environment variables | [[]env](#env) | false | |
|
||||
| image | Which image would you like to use for your service | string | true | |
|
||||
|
@ -40,13 +36,11 @@ $ vela show worker
|
|||
| livenessProbe | Instructions for assessing whether the container is alive. | [livenessProbe](#livenessProbe) | false | |
|
||||
| readinessProbe | Instructions for assessing whether the container is in a suitable state to serve traffic. | [readinessProbe](#readinessProbe) | false | |
|
||||
| imagePullSecrets | Specify image pull secrets for your service | []string | false | |
|
||||
+------------------+-------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
|
||||
|
||||
########### readinessProbe
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
### readinessProbe
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
|
||||
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
|
||||
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
|
||||
|
@ -56,56 +50,46 @@ $ vela show worker
|
|||
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
|
||||
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
|
||||
| | both the exec attribute and the httpGet attribute. | | | |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| | not ready (readiness probe). | | | |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
############### tcpSocket
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
##### tcpSocket
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
|
||||
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
|
||||
|
||||
############# httpGet
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### httpGet
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
|
||||
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
|
||||
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
|
||||
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
############## httpHeaders
|
||||
+-------+-------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
##### httpHeaders
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----- | ----------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| value | | string | true | |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
|
||||
|
||||
############ exec
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
##### exec
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
|
||||
|
||||
###### livenessProbe
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
### livenessProbe
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
|
||||
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
|
||||
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
|
||||
|
@ -115,85 +99,68 @@ $ vela show worker
|
|||
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
|
||||
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
|
||||
| | both the exec attribute and the httpGet attribute. | | | |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| | not ready (readiness probe). | | | |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
########## tcpSocket
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
#### tcpSocket
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
|
||||
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
|
||||
|
||||
######## httpGet
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### httpGet
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
|
||||
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
|
||||
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
|
||||
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
######### httpHeaders
|
||||
+-------+-------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
##### httpHeaders
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----- | ----------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| value | | string | true | |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
|
||||
|
||||
####### exec
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
#### exec
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
|
||||
|
||||
##### volumes
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
#### volumes
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| --------- | ------------------------------------------------------------------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| mountPath | | string | true | |
|
||||
| type | Specify volume type, options: "pvc","configMap","secret","emptyDir" | string | true | |
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
|
||||
|
||||
## env
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
#### env
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| --------- | --------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| name | Environment variable name | string | true | |
|
||||
| value | The value of the environment variable | string | false | |
|
||||
| valueFrom | Specifies a source the value of this var should come from | [valueFrom](#valueFrom) | false | |
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
### valueFrom
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### valueFrom
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------ | ------------------------------------------------ | ----------------------------- | -------- | ------- |
|
||||
| secretKeyRef | Selects a key of a secret in the pod's namespace | [secretKeyRef](#secretKeyRef) | true | |
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
#### secretKeyRef
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ---------------------------------------------------------------- | ------ | -------- | ------- |
|
||||
| name | The name of the secret in the pod's namespace to select from | string | true | |
|
||||
| key | The key of the secret to select from. Must be a valid secret key | string | true | |
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
```
|
|
@ -2,25 +2,14 @@
|
|||
title: Helm
|
||||
---
|
||||
|
||||
Create a Helm Component, it could be from Helm Repo, Git Repo or OSS bucket.
|
||||
KubeVela's Helm component meets the needs of users to connect to Helm Chart. You can deploy any ready-made Helm chart software package from Helm Repo, Git Repo or OSS bucket through the Helm component, and overwrite its parameters.
|
||||
|
||||
## From Helm Repo
|
||||
## Deploy From Helm Repo
|
||||
|
||||
| Parameters | Description | Example |
|
||||
| --------------- | ------------------------------------------------------------ | ---------------------------------- |
|
||||
| repoType | required, indicates where it's from | Helm |
|
||||
| pullInterval | optional, synchronize with Helm Repo, tunning interval and 5 minutes by default | 10m |
|
||||
| url | required, Helm Reop address, it supports http/https | https://charts.bitnami.com/bitnami |
|
||||
| secretRef | optional, The name of the Secret object that holds the credentials required to pull the repo. The username and password fields must be included in the HTTP/S basic authentication Secret. For TLS the secret must contain a certFile and keyFile, and/or caCert fields. For TLS authentication, the secret must contain a certFile / keyFile field and/or caCert field. | sec-name |
|
||||
| timeout | optional, timeout for pulling repo index | 60s |
|
||||
| chart | required, chart title | redis-cluster |
|
||||
| version | optional, chart version, * by default | 6.2.7 |
|
||||
| targetNamespace | optional, the namespace to install chart, decided by chart itself | your-ns |
|
||||
| releaseName | optional, release name after installed | your-rn |
|
||||
| values | optional, override the Values.yaml inchart, using for the rendering of Helm | |
|
||||
In this `Application`, we hope to deliver a component called redis-comp. It is a chart from the [bitnami](https://charts.bitnami.com/bitnami).
|
||||
|
||||
**How-to**
|
||||
```yaml
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
|
@ -34,25 +23,55 @@ spec:
|
|||
version: 6.2.7
|
||||
url: https://charts.bitnami.com/bitnami
|
||||
repoType: helm
|
||||
EOF
|
||||
```
|
||||
|
||||
## From OSS bucket
|
||||
Please copy the above code block and deploy it directly to the runtime cluster:
|
||||
```shell
|
||||
application.core.oam.dev/app-delivering-chart created
|
||||
```
|
||||
|
||||
| Parameters | Description | Example |
|
||||
| --------------- | -------- | ------------------------------------------------------------ | --------------------------- |
|
||||
| repoType | required, indicates where it's from | oss |
|
||||
| pullInterval | optional, synchronize with bucket, tunning interval and 5 minutes by default | 10m |
|
||||
| url | required, bucket's endpoint and no need to fill in with scheme | oss-cn-beijing.aliyuncs.com |
|
||||
| secretRef | optional, Save the name of a Secret, which is the credential to read the bucket. Secret contains accesskey and secretkey fields| sec-name |
|
||||
| timeout | optional, The timeout period of the download operation, the default is 20s | 60s |
|
||||
| chart | required, Chart storage path (key) | ./chart/podinfo-5.1.3.tgz |
|
||||
| version | optional, In OSS source, this parameter has no effect | |
|
||||
| targetNamespace | optional, The namespace of the installed chart, which is determined by the chart itself by default | your-ns |
|
||||
| releaseName | optional, Installed release name | your-rn |
|
||||
| values | optional, Overwrite the Values.yaml of the chart for Helm rendering. | |
|
||||
| oss.bucketName | required, bucket name | your-bucket |
|
||||
| oss.provider | optional, Optional generic or aws, fill in aws if the certificate is obtained from aws EC2. The default is generic.| generic |
|
||||
| oss.region | optional, bucket region | |
|
||||
Finally, we use `vela ls` to view the application status after successful delivery:
|
||||
```shell
|
||||
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
|
||||
app-delivering-chart redis-comp helm running healthy 2021-08-28 18:48:21 +0800 CST
|
||||
```
|
||||
|
||||
We also see that the PHASE of the app-delivering-chart APP is running and the STATUS is healthy.
|
||||
|
||||
### Attributes
|
||||
|
||||
| Parameters | Description | Example |
|
||||
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------- |
|
||||
| repoType | required, indicates where it's from | Helm |
|
||||
| pullInterval | optional, synchronize with Helm Repo, tunning interval and 5 minutes by default | 10m |
|
||||
| url | required, Helm Reop address, it supports http/https | https://charts.bitnami.com/bitnami |
|
||||
| secretRef | optional, The name of the Secret object that holds the credentials required to pull the repo. The username and password fields must be included in the HTTP/S basic authentication Secret. For TLS the secret must contain a certFile and keyFile, and/or caCert fields. For TLS authentication, the secret must contain a certFile / keyFile field and/or caCert field. | sec-name |
|
||||
| timeout | optional, timeout for pulling repo index | 60s |
|
||||
| chart | required, chart title | redis-cluster |
|
||||
| version | optional, chart version, * by default | 6.2.7 |
|
||||
| targetNamespace | optional, the namespace to install chart, decided by chart itself | your-ns |
|
||||
| releaseName | optional, release name after installed | your-rn |
|
||||
| values | optional, override the Values.yaml inchart, using for the rendering of Helm | |
|
||||
|
||||
|
||||
## Deploy From OSS bucket
|
||||
|
||||
| Parameters | Description | Example |
|
||||
| ---------- | ----------- | ------- ||
|
||||
| repoType | required, indicates where it's from | oss |
|
||||
| pullInterval | optional, synchronize with bucket, tunning interval and 5 minutes by default | 10m |
|
||||
| url | required, bucket's endpoint and no need to fill in with scheme | oss-cn-beijing.aliyuncs.com |
|
||||
| secretRef | optional, Save the name of a Secret, which is the credential to read the bucket. Secret contains accesskey and secretkey fields | sec-name |
|
||||
| timeout | optional, The timeout period of the download operation, the default is 20s | 60s |
|
||||
| chart | required, Chart storage path (key) | ./chart/podinfo-5.1.3.tgz |
|
||||
| version | optional, In OSS source, this parameter has no effect | |
|
||||
| targetNamespace | optional, The namespace of the installed chart, which is determined by the chart itself by default | your-ns |
|
||||
| releaseName | optional, Installed release name | your-rn |
|
||||
| values | optional, Overwrite the Values.yaml of the chart for Helm rendering. | |
|
||||
| oss.bucketName | required, bucket name | your-bucket |
|
||||
| oss.provider | optional, Optional generic or aws, fill in aws if the certificate is obtained from aws EC2. The default is generic. | generic |
|
||||
| oss.region | optional, bucket region | |
|
||||
|
||||
**How-to**
|
||||
|
||||
|
@ -83,21 +102,21 @@ spec:
|
|||
bucketName: definition-registry
|
||||
```
|
||||
|
||||
## From Git Repo
|
||||
## Deploy From Git Repo
|
||||
|
||||
| Parameters | Description | Example |
|
||||
| --------------- | -------- | ------------------------------------------------------------ | ----------------------------------------------- |
|
||||
| repoType | required, indicates where it's from | git |
|
||||
| pullInterval | optional, synchronize with Git Repo, tunning interval and 5 minutes by default | 10m |
|
||||
| url | required, Git Repo address | https://github.com/oam-dev/terraform-controller |
|
||||
| Parameters | Description | Example |
|
||||
| ---------- | ----------- | ------- ||
|
||||
| repoType | required, indicates where it's from | git |
|
||||
| pullInterval | optional, synchronize with Git Repo, tunning interval and 5 minutes by default | 10m |
|
||||
| url | required, Git Repo address | https://github.com/oam-dev/terraform-controller |
|
||||
| secretRef | optional, The name of the Secret object that holds the credentials required to pull the Git repository. For HTTP/S basic authentication, the Secret must contain the username and password fields. For SSH authentication, the identity, identity.pub and known_hosts fields must be included | sec-name |
|
||||
| timeout | optional, The timeout period of the download operation, the default is 20s | 60s |
|
||||
| chart | required, Chart storage path (key) | ./chart/podinfo-5.1.3.tgz |
|
||||
| version | optional, In Git source, this parameter has no effect | |
|
||||
| targetNamespace | optional, the namespace to install chart, decided by chart itself | your-ns |
|
||||
| releaseName | optional, Installed release name | your-rn |
|
||||
| values | optional, Overwrite the Values.yaml of the chart for Helm rendering. | |
|
||||
| git.branch | optional, Git branch, master by default | dev |
|
||||
| timeout | optional, The timeout period of the download operation, the default is 20s | 60s |
|
||||
| chart | required, Chart storage path (key) | ./chart/podinfo-5.1.3.tgz |
|
||||
| version | optional, In Git source, this parameter has no effect | |
|
||||
| targetNamespace | optional, the namespace to install chart, decided by chart itself | your-ns |
|
||||
| releaseName | optional, Installed release name | your-rn |
|
||||
| values | optional, Overwrite the Values.yaml of the chart for Helm rendering. | |
|
||||
| git.branch | optional, Git branch, master by default | dev |
|
||||
|
||||
**How-to**
|
||||
|
||||
|
|
|
@ -4,21 +4,12 @@ title: Kustomize
|
|||
|
||||
Create a Kustomize Component, it could be from Git Repo or OSS bucket.
|
||||
|
||||
### From OSS bucket
|
||||
## Deploy From OSS bucket
|
||||
|
||||
| Parameters | Description | Example |
|
||||
| -------------- | ------------------------------------------------------------ | --------------------------- |
|
||||
| repoType | required, The value of the Git. To indicate that kustomize configuration comes from the Git repository | oss |
|
||||
| pullInterval | optional, Synchronize with Git repository, and the time interval between tuning helm release. The default value is 5m (5 minutes) | 10m |
|
||||
| url | required, bucket's endpoint, no need to fill in with scheme | oss-cn-beijing.aliyuncs.com |
|
||||
| secretRef | optional, Save the name of a Secret, which is the credential to read the bucket. Secret contains accesskey and secretkey fields | sec-name |
|
||||
| timeout | optional, The timeout period of the download operation, the default is 20s | 60s |
|
||||
| path | required, The directory containing the kustomization.yaml file, or the directory containing a set of YAML files (used to generate kustomization.yaml) | ./prod |
|
||||
| oss.bucketName | required, bucket name | your-bucket |
|
||||
| oss.provider | optional, Generic or aws, if you get the certificate from aws EC2, fill in aws. The default is generic. | generic |
|
||||
| oss.region | optional, bucket region | |
|
||||
KubeVela's `kustomize` component meets the needs of users to directly connect Yaml files and folders as component products. No matter whether your Yaml file/folder is stored in a Git Repo or an OSS bucket, KubeVela can read and deliver it.
|
||||
|
||||
Let's take the YAML folder component from the OSS bucket registry as an example to explain the usage. In the `Application` this time, I hope to deliver a component named bucket-comp. The deployment file corresponding to the component is stored in the cloud storage OSS bucket, and the corresponding bucket name is definition-registry. `kustomize.yaml` comes from this address of oss-cn-beijing.aliyuncs.com and the path is `./app/prod/`.
|
||||
|
||||
**How-to**
|
||||
|
||||
1. (Opentional) If your OSS bucket needs identity verification, create a Secret:
|
||||
|
||||
|
@ -27,8 +18,10 @@ $ kubectl create secret generic bucket-secret --from-literal=accesskey=<your-ak>
|
|||
secret/bucket-secret created
|
||||
```
|
||||
|
||||
2. Example
|
||||
```yaml
|
||||
2. Deploy it:
|
||||
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
|
@ -39,26 +32,55 @@ spec:
|
|||
type: kustomize
|
||||
properties:
|
||||
repoType: oss
|
||||
# required if bucket is private
|
||||
# If the bucket is private, you will need to provide
|
||||
secretRef: bucket-secret
|
||||
url: oss-cn-beijing.aliyuncs.com
|
||||
oss:
|
||||
bucketName: definition-registry
|
||||
path: ./app/prod/
|
||||
|
||||
EOF
|
||||
```
|
||||
Please copy the above code block and deploy it directly to the runtime cluster:
|
||||
|
||||
```shell
|
||||
application.core.oam.dev/bucket-app created
|
||||
```
|
||||
|
||||
### From Git Repo
|
||||
Finally, we use `vela ls` to view the application status after successful delivery:
|
||||
```shell
|
||||
vela ls
|
||||
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
|
||||
bucket-app bucket-comp kustomize running healthy 2021-08-28 18:53:14 +0800 CST
|
||||
```
|
||||
|
||||
The PHASE of the app is running, and the STATUS is healthy. Successful application deployment!
|
||||
|
||||
### Attributes
|
||||
|
||||
| Parameters | Description | Example |
|
||||
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
|
||||
| repoType | required, The value of the Git. To indicate that kustomize configuration comes from the Git repository | oss |
|
||||
| pullInterval | optional, Synchronize with Git repository, and the time interval between tuning helm release. The default value is 5m (5 minutes) | 10m |
|
||||
| url | required, bucket's endpoint, no need to fill in with scheme | oss-cn-beijing.aliyuncs.com |
|
||||
| secretRef | optional, Save the name of a Secret, which is the credential to read the bucket. Secret contains accesskey and secretkey fields | sec-name |
|
||||
| timeout | optional, The timeout period of the download operation, the default is 20s | 60s |
|
||||
| path | required, The directory containing the kustomization.yaml file, or the directory containing a set of YAML files (used to generate kustomization.yaml) | ./prod |
|
||||
| oss.bucketName | required, bucket name | your-bucket |
|
||||
| oss.provider | optional, Generic or aws, if you get the certificate from aws EC2, fill in aws. The default is generic. | generic |
|
||||
| oss.region | optional, bucket region | |
|
||||
|
||||
|
||||
| Parameters | Description | Example |
|
||||
| --------------- | ------------------------------------------------------------ | ----------------------------------------------- |
|
||||
| repoType | required, The value of the Git. To indicate that kustomize configuration comes from the Git repository | git |
|
||||
| pullInterval | optional, Synchronize with Git repository, and the time interval between tuning helm release. The default value is 5m (5 minutes) | 10m |
|
||||
| url | required, Git repository address | https://github.com/oam-dev/terraform-controller |
|
||||
| secretRef | optional, The Secret object name that holds the credentials required to pull the Git repository. The username and password fields must be included in the HTTP/S basic authentication Secret. For SSH authentication, the identity, identity.pub and known_hosts fields must be included | sec-name |
|
||||
| timeout | optional, The timeout period of the download operation, the default is 20s | 60s |
|
||||
| git.branch | optional, Git branch, master by default | dev |
|
||||
## Deploy From Git Repo
|
||||
|
||||
|
||||
| Parameters | Description | Example |
|
||||
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
|
||||
| repoType | required, The value of the Git. To indicate that kustomize configuration comes from the Git repository | git |
|
||||
| pullInterval | optional, Synchronize with Git repository, and the time interval between tuning helm release. The default value is 5m (5 minutes) | 10m |
|
||||
| url | required, Git repository address | https://github.com/oam-dev/terraform-controller |
|
||||
| secretRef | optional, The Secret object name that holds the credentials required to pull the Git repository. The username and password fields must be included in the HTTP/S basic authentication Secret. For SSH authentication, the identity, identity.pub and known_hosts fields must be included | sec-name |
|
||||
| timeout | optional, The timeout period of the download operation, the default is 20s | 60s |
|
||||
| git.branch | optional, Git branch, master by default | dev |
|
||||
|
||||
**How-to**
|
||||
|
||||
|
@ -79,7 +101,7 @@ spec:
|
|||
path: ./app/dev/
|
||||
```
|
||||
|
||||
## Override Kustomize
|
||||
**Override Kustomize**
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
|
|
|
@ -4,17 +4,12 @@ title: AutoScaler
|
|||
|
||||
## Specification
|
||||
|
||||
```
|
||||
$ vela show cpuscaler
|
||||
# Properties
|
||||
+---------+---------------------------------------------------------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------+---------------------------------------------------------------------------------+------+----------+---------+
|
||||
| min | Specify the minimal number of replicas to which the autoscaler can scale down | int | true | 1 |
|
||||
| max | Specify the maximum number of of replicas to which the autoscaler can scale up | int | true | 10 |
|
||||
| cpuUtil | Specify the average cpu utilization, for example, 50 means the CPU usage is 50% | int | true | 50 |
|
||||
+---------+---------------------------------------------------------------------------------+------+----------+---------+
|
||||
```
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------- | ------------------------------------------------------------------------------- | ---- | -------- | ------- |
|
||||
| min | Specify the minimal number of replicas to which the autoscaler can scale down | int | true | 1 |
|
||||
| max | Specify the maximum number of of replicas to which the autoscaler can scale up | int | true | 10 |
|
||||
| cpuUtil | Specify the average cpu utilization, for example, 50 means the CPU usage is 50% | int | true | 50 |
|
||||
|
||||
## How to use
|
||||
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
---
|
||||
title: Manual Scaler
|
||||
---
|
||||
|
||||
## Specification
|
||||
|
||||
```shell
|
||||
vela show scaler
|
||||
```
|
||||
```console
|
||||
# Properties
|
||||
+----------+--------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+----------+--------------------------------+------+----------+---------+
|
||||
| replicas | Specify replicas of workload | int | true | 1 |
|
||||
+----------+--------------------------------+------+----------+---------+
|
||||
```
|
||||
|
||||
## How to use
|
||||
|
||||
```yaml
|
||||
# sample-manual.yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: website
|
||||
spec:
|
||||
components:
|
||||
- name: frontend
|
||||
type: webservice
|
||||
properties:
|
||||
image: nginx
|
||||
traits:
|
||||
- type: scaler
|
||||
properties:
|
||||
replicas: 2
|
||||
- type: sidecar
|
||||
properties:
|
||||
name: "sidecar-test"
|
||||
image: "fluentd"
|
||||
- name: backend
|
||||
type: worker
|
||||
properties:
|
||||
image: busybox
|
||||
cmd:
|
||||
- sleep
|
||||
- '1000'
|
||||
```
|
||||
|
||||
To scale up or scale down, you just need to modify the `replicas` field of `scaler` trait and re-apply the YAML.
|
||||
|
|
@ -3,22 +3,11 @@ title: Rollout
|
|||
---
|
||||
This chapter will introduce how to use Rollout Trait to perform a rolling update on Workload.
|
||||
|
||||
## Background
|
||||
|
||||
### ComponentRevision
|
||||
Updating a component will generate a new ControllerRevision. The format of the generated name for ControllerRevision is: `<Component name>-<revision number>`. You can also specify ControllerRevision name by setting `spec.components[x].externalRevision`.
|
||||
|
||||
### Supported workload type
|
||||
Rollout Trait supports following workload types: webservice,worker and cloneset.
|
||||
|
||||
When using webservice/worker as Workload type with Rollout Trait, Workload's name will be controllerRevision's name. And when Workload's type is cloneset, because of clonset support in-place update Workload's name will always be component's name.
|
||||
|
||||
|
||||
## How to
|
||||
|
||||
### First Deployment
|
||||
|
||||
Apply the Application YAML below which includes a webservice-type workload with Rollout Trait, and sets ControllerRevision name to express-server-v1 by setting `spec.components[0].externalRevision` field.
|
||||
Apply the Application YAML below which includes a webservice-type workload with Rollout Trait, and sets ControllerRevision name to express-server-v1 by setting `spec.components[0].externalRevision` field. If the revision name is not specified, it will be genrated automatically by the format: `<Component name>-<revision number>`.
|
||||
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
|
@ -42,6 +31,7 @@ spec:
|
|||
- replicas: 3
|
||||
EOF
|
||||
```
|
||||
|
||||
This Rollout Trait has target size of 5 and two rollout batches. The first batch has 2 replicas and second batch has 3. Only after all replicas in the first batch are ready, it will start to rollout the second batch.
|
||||
|
||||
Check the Application status whether the rollout is successful:
|
||||
|
@ -283,7 +273,8 @@ express-server-v1 3/3 3 3 5m
|
|||
|
||||
### Rollout cloneset type Workload
|
||||
|
||||
Enable kruise [addon](./addons/introduction)。
|
||||
You need to enable kruise addon。
|
||||
|
||||
```shell
|
||||
$ vela addon enable kruise
|
||||
```
|
||||
|
@ -403,15 +394,21 @@ Other operations such as Scale up, Scale down, Rollback are the same as the oper
|
|||
|
||||
All configurations for Rolling Traits.
|
||||
|
||||
Name | Description | Type | Required | Default
|
||||
------------ | ------------- | ------------- | ------------- | -------------
|
||||
targetRevision|The target ComponentRevision|string|No|If this field is empty, it will always point to the latest revision
|
||||
targetSize|Number of target Workload's replicas|int|Yes|Nil
|
||||
rolloutBatches|Strategy of rolling update|[]rolloutBatch|Yes|Nil
|
||||
batchPartition|Partition of rolloutBatches|int|No|Nil, if this field is empty, all batches will be updated
|
||||
| Name | Description | Type | Required | Default |
|
||||
| -------------- | ------------------------------------ | -------------- | -------- | ------------------------------------------------------------------- |
|
||||
| targetRevision | The target ComponentRevision | string | No | If this field is empty, it will always point to the latest revision |
|
||||
| targetSize | Number of target Workload's replicas | int | Yes | Nil |
|
||||
| rolloutBatches | Strategy of rolling update | []rolloutBatch | Yes | Nil |
|
||||
| batchPartition | Partition of rolloutBatches | int | No | Nil, if this field is empty, all batches will be updated |
|
||||
|
||||
Configurations of rolloutBatch
|
||||
|
||||
Name | Description | Type | Required | Default
|
||||
------------ | ------------- | ------------- | ------------- | -------------
|
||||
replicas|number of replicas in one batch|int|Yes|Nil
|
||||
| Name | Description | Type | Required | Default |
|
||||
| -------- | ------------------------------- | ---- | -------- | ------- |
|
||||
| replicas | number of replicas in one batch | int | Yes | Nil |
|
||||
|
||||
### Supported workload type
|
||||
|
||||
Rollout Trait supports following workload types: webservice,worker and cloneset.
|
||||
|
||||
When using webservice/worker as Workload type with Rollout Trait, Workload's name will be controllerRevision's name. And when Workload's type is cloneset, because of clonset support in-place update Workload's name will always be component's name.
|
|
@ -64,5 +64,7 @@ Welcome onboard and sail Vela!
|
|||
|
||||
Here are some recommended next steps:
|
||||
|
||||
- Start to [install KubeVela](./getting-started/quick-install).
|
||||
- Learn KubeVela's [Core Concepts](core-concepts/application).
|
||||
- Learn KubeVela's [Architecture](core-concepts/architecture).
|
||||
|
||||
|
|
|
@ -188,18 +188,15 @@ sudo mv ./vela /usr/local/bin/vela
|
|||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## 4. Enable Helm Support
|
||||
## 4. Enable Addons
|
||||
|
||||
KubeVela leverages Helm controller from [Flux v2](https://github.com/fluxcd/flux2) to deploy [Helm](https://helm.sh/) based components.
|
||||
|
||||
You can enable this feature by enabling fluxcd addon
|
||||
|
||||
```shell
|
||||
vela addon enable fluxcd
|
||||
```
|
||||
|
||||
Or you could install full Flux v2 following its own guide of course.
|
||||
KubeVela support a dozen of [out-of-box addons](../platform-engineers/advanced-install#Addons),
|
||||
please at least enable following addons to make sure KubeVela functioning well:
|
||||
|
||||
* Helm and Kustomize Components addons
|
||||
```shell
|
||||
vela addon enable fluxcd
|
||||
```
|
||||
|
||||
## 5. Verify
|
||||
|
||||
|
@ -223,4 +220,8 @@ These capabilities are built-in so they are ready to use if showed up. KubeVela
|
|||
|
||||
Also, whenever new capabilities are added in the platform, you will immediately see them in above output.
|
||||
|
||||
> See the [advanced installation guide](../platform-engineers/advanced-install) to learn more about installation details.
|
||||
## What's Next
|
||||
|
||||
* Start to [deploy our first application](./first-application).
|
||||
* See the [advanced installation guide](../platform-engineers/advanced-install) to learn more about installation details.
|
||||
|
||||
|
|
|
@ -182,4 +182,36 @@ Then clean up CRDs (CRDs are not removed via helm by default):
|
|||
workflows.core.oam.dev \
|
||||
workflowstepdefinitions.core.oam.dev \
|
||||
workloaddefinitions.core.oam.dev
|
||||
```
|
||||
```
|
||||
|
||||
## Addons
|
||||
|
||||
| Name | Description | capability | Open Source Project Reference |
|
||||
|---------------------|-------------------------------------------------|----------------|-------------------------------------------------|
|
||||
| terraform | Basic addon to Provide Cloud Resources(installed by default) | - | https://github.com/oam-dev/terraform-controller |
|
||||
| fluxcd | Support Deployment of Helm and Kustomize components | kustomize、helm | https://fluxcd.io/ |
|
||||
| kruise | Support more powerful workload feature | cloneset | https://openkruise.io/ |
|
||||
| prometheus | Support basic observability from Promethus | - | https://prometheus.io/ |
|
||||
| keda | Support event driven auto scaling | - | https://keda.sh/ |
|
||||
| ocm | Support Multi-cluster Application Deployment | - | http://open-cluster-management.io/ |
|
||||
| observability | Support KubeVela core observability | - | - |
|
||||
|
||||
1. Search all addons
|
||||
|
||||
```shell
|
||||
vela addon list
|
||||
```
|
||||
|
||||
2. Install addons (use fluxcd as example)
|
||||
|
||||
```shell
|
||||
vela addon enable fluxcd
|
||||
```
|
||||
|
||||
3. Disable addons
|
||||
|
||||
```
|
||||
vela addon disable fluxcd
|
||||
```
|
||||
|
||||
Please remove all application using this addon before disable it.
|
||||
|
|
|
@ -8,11 +8,11 @@ When cluster scale becomes large and more applications are needed for managing,
|
|||
|
||||
According to the KubeVela performance test, three sets of parameters are recommended in clusters with different scales as below.
|
||||
|
||||
| Scale | #Nodes | #Apps | #Pods | concurrent-reconciles | kube-api-qps | kube-api-burst | CPU | Memory |
|
||||
| :---: | -------: | ------------: | -------: | --------------------: | :----------: | -------------: | ----: | -----: |
|
||||
| Small | < 200 | < 3,000 | < 18,000 | 2 | 300 | 500 | 0.5 | 1Gi |
|
||||
| Medium | < 500 | < 5,000 | < 30,000 | 4 | 500 | 800 | 1 | 2Gi |
|
||||
| Large | < 1,000 | < 12,000 | < 72,000 | 4 | 800 | 1,000 | 2 | 4Gi |
|
||||
| Scale | #Nodes | #Apps | #Pods | concurrent-reconciles | kube-api-qps | kube-api-burst | CPU | Memory |
|
||||
| :----: | ------: | -------: | -------: | --------------------: | :----------: | -------------: | ---: | -----: |
|
||||
| Small | < 200 | < 3,000 | < 18,000 | 2 | 300 | 500 | 0.5 | 1Gi |
|
||||
| Medium | < 500 | < 5,000 | < 30,000 | 4 | 500 | 800 | 1 | 2Gi |
|
||||
| Large | < 1,000 | < 12,000 | < 72,000 | 4 | 800 | 1,000 | 2 | 4Gi |
|
||||
|
||||
> The above configurations are based on medium size applications (each application contains 2~3 components and 5~6 resources). If the applications in your scenario are generally larger, e.g., containing 20 resources, then you could increase the application number accordingly to find the appropriate configuration and parameters.
|
||||
|
||||
|
@ -25,4 +25,4 @@ You might encounter various performance bottlenecks. Read the following examples
|
|||
3. Applications could be found in cluster but no status information could be displayed. If there is no problem with the application content, it might be caused by the KubeVela controller bottleneck, such as limiting requests to apiserver. Increase **kube-api-qps / kube-api-burst** and check if CPU is overloaded. If CPU is not overloaded, check if the thread number is below the number of CPU cores.
|
||||
4. KubeVela Controller itself could crash frequently due to Out-Of-Memory. Increase the memory to solve it.
|
||||
|
||||
> Read more details in [KubeVela Performance Test Report](/blog/kubevela-performance-test)
|
||||
> Read more details in [KubeVela Performance Test Report](/blog/2021/08/30/kubevela-performance-test)
|
|
@ -54,16 +54,6 @@ module.exports = {
|
|||
label: 'Blog',
|
||||
position: 'left'
|
||||
},
|
||||
{
|
||||
type: 'localeDropdown',
|
||||
position: 'right',
|
||||
dropdownItemsAfter: [
|
||||
{
|
||||
to: '/blog/kubevela-official-documentation-translation-event',
|
||||
label: 'Help Us Translate',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
href: 'https://github.com/oam-dev/kubevela',
|
||||
className: 'header-githab-link',
|
||||
|
|
|
@ -132,4 +132,4 @@ Version: 0.1.2
|
|||
|
||||
## 更多
|
||||
|
||||
详细的环境部署流程以及更加完整的应用滚动更新可以参考[博客](/blog/kubevela-jenkins-cicd)。
|
||||
详细的环境部署流程以及更加完整的应用滚动更新可以参考[博客](/blog/2021/09/02/kubevela-jenkins-cicd)。
|
|
@ -2,7 +2,7 @@
|
|||
title: 应用部署计划
|
||||
---
|
||||
|
||||
KubeVela 背后的应用交付模型是 [OAM(Open Application Model)](../platform-engineers/oam/oam-model.md),其核心是将应用部署所需的所有组件和各项运维动作,描述为一个统一的、与基础设施无关的“部署计划”,进而实现在混合环境中进行标准化和高效率的应用交付。这个应用部署计划就是这一节所要介绍的 **Application** 对象,也是 OAM 模型的使用者唯一需要了解的 API。
|
||||
KubeVela 背后的应用交付模型是 [OAM(Open Application Model)](../platform-engineers/oam/oam-model),其核心是将应用部署所需的所有组件和各项运维动作,描述为一个统一的、与基础设施无关的“部署计划”,进而实现在混合环境中进行标准化和高效率的应用交付。这个应用部署计划就是这一节所要介绍的 **Application** 对象,也是 OAM 模型的使用者唯一需要了解的 API。
|
||||
|
||||
## 应用程序部署计划(Application)
|
||||
|
||||
|
@ -37,39 +37,38 @@ spec:
|
|||
cmd:
|
||||
- sleep
|
||||
- '1000'
|
||||
workflow:
|
||||
steps:
|
||||
# 步骤名称
|
||||
- name: deploy-frontend
|
||||
# 指定步骤类型
|
||||
type: apply-component
|
||||
properties:
|
||||
# 指定组件名称
|
||||
component: frontend
|
||||
- name: manual-approval
|
||||
# 工作流内置 suspend 类型的任务,用于暂停工作流
|
||||
type: suspend
|
||||
- name: deploy-backend
|
||||
type: apply-component
|
||||
properties:
|
||||
component: backend
|
||||
policies:
|
||||
- name: demo-policy
|
||||
type: env-binding
|
||||
properties:
|
||||
engine: local
|
||||
envs:
|
||||
- name: test
|
||||
patch:
|
||||
components:
|
||||
- name: nginx-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: nginx:1.20
|
||||
port: 80
|
||||
placement:
|
||||
namespaceSelector:
|
||||
name: test
|
||||
- name: prod
|
||||
placement:
|
||||
namespaceSelector:
|
||||
name: prod
|
||||
workflow:
|
||||
steps:
|
||||
# 步骤名称
|
||||
- name: deploy-test-env
|
||||
# 指定步骤类型
|
||||
type: multi-env
|
||||
properties:
|
||||
# 指定策略名称
|
||||
policy: demo-policy
|
||||
# 指定部署的环境名称
|
||||
env: test
|
||||
- name: manual-approval
|
||||
# 工作流内置 suspend 类型的任务,用于暂停工作流
|
||||
type: suspend
|
||||
- name: deploy-prod-env
|
||||
type: multi-env
|
||||
properties:
|
||||
policy: demo-policy
|
||||
env: prod
|
||||
```
|
||||
|
||||
这里的字段对应着:
|
||||
|
@ -77,11 +76,11 @@ spec:
|
|||
- `apiVersion`:所使用的 OAM API 版本。
|
||||
- `kind`:种类。我们最经常用到的就是 Pod 了。
|
||||
- `metadata`:业务相关信息。比如这次要创建的是一个网站。
|
||||
- `Spec`:描述我们需要应用去交付什么,告诉 Kubernetes 做成什么样。这里我们放入 KubeVela 的 `components`。
|
||||
- `Spec`:描述我们需要应用去交付什么,告诉 Kubernetes 做成什么样。这里我们放入 KubeVela 的 `components`、`policies` 以及 `workflow`。
|
||||
- `components`:一次应用交付部署计划所涵盖的全部组件。
|
||||
- `traits`:应用交付部署计划中每个组件独立的运维特征。
|
||||
- `workflow`:自定义应用交付的工作流,可以不填,则默认依次全部创建。
|
||||
- `policies`:应用策略。示例中的 `env-binding` 可以为应用提供差异化配置和环境调度策略。
|
||||
- `policies`:作用于整个应用全局的部署策略。
|
||||
- `workflow`:自定义应用交付“执行过程”的工作流。
|
||||
|
||||
下面这张示意图诠释了它们之间的关系:
|
||||

|
||||
|
@ -92,7 +91,7 @@ spec:
|
|||
|
||||
## 组件(Components)
|
||||
|
||||
KubeVela 内置了常用的组件类型,使用 [KubeVela CLI](../getting-started/quick-install.mdx##3) 命令查看:
|
||||
KubeVela 内置了常用的组件类型,使用 [KubeVela CLI](../getting-started/quick-install#3) 命令查看:
|
||||
```
|
||||
vela components
|
||||
```
|
||||
|
@ -116,7 +115,7 @@ worker vela-system deployments.apps Describes long-run
|
|||
|
||||
## 运维特征(Traits)
|
||||
|
||||
KubeVela 也内置了常用的运维特征类型,使用 [KubeVela CLI](../getting-started/quick-install.mdx##3) 命令查看:
|
||||
KubeVela 也内置了常用的运维特征类型,使用 [KubeVela CLI](../getting-started/quick-install#3-安装-kubevela-cli) 命令查看:
|
||||
```
|
||||
vela traits
|
||||
```
|
||||
|
@ -135,35 +134,36 @@ sidecar vela-system deployments.apps true Inject a
|
|||
|
||||
如果你是熟悉 Kubernetes 的平台管理员,也可以了解 KubeVela 中[自定义运维特征](../platform-engineers/traits/customize-trait) 的能力,为你的用户扩展任意运维功能。
|
||||
|
||||
## 应用策略(Policy)
|
||||
|
||||
应用策略(Policy)负责定义应用级别的部署特征,比如健康检查规则、安全组、防火墙、SLO、检验等模块。
|
||||
应用策略的扩展性和功能与运维特征类似,可以灵活的扩展和对接所有云原生应用生命周期管理的能力。相对于运维特征而言,应用策略作用于一个应用的整体,而运维特征作用于应用中的某个组件。
|
||||
|
||||
在本例中,我们设置了一个将应用部署到不同环境的策略。
|
||||
|
||||
## 工作流(Workflow)
|
||||
|
||||
KubeVela 的工作流机制允许用户自定义应用部署计划中的步骤,粘合额外的交付流程,指定任意的交付环境。简而言之,工作流提供了定制化的控制逻辑,在原有 Kubernetes 模式交付资源(Apply)的基础上,提供了面向过程的灵活性。比如说,使用工作流实现暂停、人工验证、状态等待、数据流传递、多环境灰度、A/B 测试等复杂操作。
|
||||
|
||||
工作流是 KubeVela 实践过程中基于 OAM 模型的进一步探索和最佳实践,充分遵守 OAM 的模块化理念和可复用特性。每一个工作流模块都是一个“超级粘合剂”,可以将你任意的工具和流程都组合起来。使得你在现代复杂云原生应用交付环境中,可以通过一份申明式的配置,完整的描述所有的交付流程,保证交付过程的稳定性和便利性。
|
||||
|
||||
> 需要说明的是,工作流机制是应用交付过程中的强大补充能力,但并非必填能力,用户在不编写 Workflow 过程的情况下,依旧可以完成组件和运维策略的自动化部署。
|
||||
> 需要说明的是,工作流机制是基于“应用和环境”粒度工作的,它提供了“自定义交付过程”的强大能力。一旦定义工作流,就代表用户自己指定交付的执行过程,原有的组件部署过程会被取代。工作流并非必填能力,用户在不编写 Workflow 过程的情况下,依旧可以完成组件和运维策略的自动化部署。
|
||||
|
||||
在上面的例子中,我们已经可以看到一些工作流的步骤:
|
||||
|
||||
- 这里使用了 `apply-component` 和 `suspend` 类型的工作流步骤:
|
||||
- `apply-component` 类型可以使用户部署指定的组件及其运维特征。
|
||||
- 这里使用了 `multi-env` 和 `suspend` 类型的工作流步骤:
|
||||
- `multi-env` 类型可以根据用户定义的策略将应用部署到指定的环境。
|
||||
- 在第一步完成后,开始执行 `suspend` 类型的工作流步骤。该步骤会暂停工作流,我们可以查看集群中第一个组件的状态,当其成功运行后,再使用 `vela workflow resume website` 命令来继续该工作流。
|
||||
- 当工作流继续运行后,第三个步骤开始部署组件及运维特征。此时我们查看集群,可以看到所以资源都已经被成功部署。
|
||||
|
||||
关于工作流,你可以从[指定组件部署](../end-user/workflow/apply-component)这个工作流节点类型开始逐次了解更多 KubeVela 当前的内置工作流节点类型。
|
||||
关于工作流,你可以从[指定环境部署](../end-user/workflow/multi-env)这个工作流节点类型开始逐次了解更多 KubeVela 当前的内置工作流节点类型。
|
||||
|
||||
如果你是熟悉 Kubernetes 的平台管理员,你可以[学习创建自定义工作流节点类型](../platform-engineers/workflow/steps),或者通过[设计文档](https://github.com/oam-dev/kubevela/blob/master/design/vela-core/workflow_policy.md)了解工作流系统背后的设计和架构.
|
||||
|
||||
## 应用策略(Policy)
|
||||
|
||||
应用策略(Policy)负责定义应用级别的部署特征,比如健康检查规则、安全组、防火墙、SLO、检验等模块。
|
||||
|
||||
应用策略的扩展性和功能与运维特征类似,可以灵活的扩展和对接所有云原生应用生命周期管理的能力。相对于运维特征而言,应用策略作用于一个应用的整体,而运维特征作用于应用中的某个组件。
|
||||
|
||||
## 下一步
|
||||
|
||||
后续步骤:
|
||||
|
||||
- 加入 KubeVela 中文社区钉钉群,群号:23310022。
|
||||
- [阅读**用户手册**基于开箱即用功能,构建你的应用部署计划](../end-user/component-delivery)。
|
||||
- [阅读**管理员手册**了解 KubeVela 的扩展方式和背后的原理](../platform-engineers/oam/oam-model)。
|
||||
- 阅读[**用户手册**](../end-user/components/helm),从 Helm 组件开始了解如何构建你的应用部署计划。
|
||||
- 阅读[**管理员手册**](../platform-engineers/oam/oam-model)了解 KubeVela 的扩展方式和背后的 OAM 模型原理。
|
|
@ -13,12 +13,11 @@ KubeVela 的系统在默认安装的模式下,是一个只包含“控制平
|
|||
|
||||
### 应用(Application)控制器
|
||||
|
||||
应用控制器是 KubeVela 的核心控制器,也是 KubeVela 唯一一个必须要安装且不可替换的控制器,负责应用的全生命周期管控,主要包含应用版本化、模块渲染引擎、工作流引擎、资源回收等模块,即图中淡红色部分框图。
|
||||
应用控制器是 KubeVela 的核心控制器,也是 KubeVela 唯一一个必须要安装且不可替换的控制器,负责应用的全生命周期管控,主要包含应用版本化、交付模型引擎、工作流引擎等模块,即图中淡红色部分框图。
|
||||
|
||||
* 版本化控制(Revision Manager):对于 KubeVela 而言,应用的每一次变动都会生成两种类型的版本,一个是应用的版本(AppRevision),一个是组件版本(Component Revision)。应用版本主要作为应用的快照记录,可以方便的进行应用修改的审计。组件的版本主要用于组件的滚动升级与回滚,也可以指定不同的组件版本同时运行,并做发布时的流量控制。
|
||||
* 交付模型引擎(CUE Engine):KubeVela 采用 Open Application Model(OAM)作为应用交付模型,并通过 [CUE](https://cuelang.org/) 配置语言来实现该模型,从而以可编程的方式(IaC)对待交付组件、运维能力、用户输入和交付工作流进行统一的编排和管理。
|
||||
* 工作流引擎(Workflow Engine):工作流是一次应用部署执行过程的描述,用户可以通过工作流自己定义部署的完整流程,或者灵活的插入各种步骤。举例来说,用户可以在工作流的最开始加入一个环境初始化的节点,这个工作流节点可以是创建一个运行时 Kubernetes 集群,或者是在一个环境上安装某种系统组件。然后再将应用部署到刚刚初始化完成的部署环境中。简而言之,**KubeVela 的工作流使得应用部署的完整流程可以通过一份声明式配置文件完成描述**。
|
||||
* 资源回收引擎(Garbage Collection):负责资源的记录和删除,声明式应用描述只记录终态时的资源情况,而实际有些已经存在的资源若不存在于终态,就需要通过这个模块来做自动化的垃圾回收。
|
||||
|
||||
### 模块定义(Definition)控制器
|
||||
|
||||
|
@ -62,7 +61,7 @@ OCM(Open Cluster Management)是 KubeVela 默认的多集群管理引擎,
|
|||
|
||||
### FluxCD 控制器
|
||||
|
||||
KubeVela 通过 FluxCD 控制器来实现 Pull 模式的应用组件交付。
|
||||
KubeVela 通过 FluxCD 控制器来实现 Helm, Kustomize 等组件的交付,并实现基于 GitOps 模式的组件交付功能。
|
||||
|
||||
|
||||
## 系统数据流
|
||||
|
@ -103,5 +102,5 @@ KubeVela 的用户数据面数据流动采用 Pull 模式(订阅模式),Ku
|
|||
后续步骤:
|
||||
|
||||
- 加入 KubeVela 中文社区钉钉群,群号:23310022。
|
||||
- [阅读**用户手册**基于开箱即用功能,构建你的应用部署计划](../end-user/component-delivery)。
|
||||
- [阅读**管理员手册**了解 KubeVela 的扩展方式和背后的原理](../platform-engineers/oam/oam-model)。
|
||||
- 阅读[**用户手册**](../end-user/components/helm),从 Helm 组件开始了解如何构建你的应用部署计划。
|
||||
- 阅读[**管理员手册**](../platform-engineers/oam/oam-model)了解 KubeVela 的扩展方式和背后的 OAM 模型原理。
|
|
@ -35,7 +35,7 @@ services:
|
|||
|
||||
## Schema
|
||||
|
||||
> 在深入学习 Appfile 的详细 schema 之前,我们建议你先熟悉 KubeVela 的[核心概念](../core-concepts/application.md)
|
||||
> 在深入学习 Appfile 的详细 schema 之前,我们建议你先熟悉 KubeVela 的[核心概念](../core-concepts/application)
|
||||
|
||||
```yaml
|
||||
name: _app-name_
|
||||
|
|
|
@ -1,116 +0,0 @@
|
|||
---
|
||||
title: 介绍
|
||||
---
|
||||
|
||||
本节会介绍如何使用 KubeVela 的默认系统插件(Addon)
|
||||
|
||||
## 背景
|
||||
|
||||
KubeVela 默认是一个应用管理和交付的控制平面,同时它也支持一系列开箱即用的功能,这些都通过系统插件的方式提供。你只需要有对 KubeVela 控制平面集群的写权限,即可一键即可开启这些默认的系统插件,使用包括弹性扩缩容、可观测性、GitOps 在内的多种生态功能。
|
||||
除此之外,作为平台管理员的你,可以根据业务需要添加自定义的系统插件。本质上,系统插件提供了一种统一的方式,可以灵活的安装、拆卸满足应用交付和应用管理不同场景的系统能力。
|
||||
一个系统插件通常可以包含如下两个组成部分:
|
||||
- 系统组件,如 Kubernetes 的自定义资源(CRD Controller),系统所需的数据库、缓存、负载均衡等中间件,其他容易需要安装运行的系统组件。
|
||||
- OAM 标准化定义(X-Definition),如组件定义(ComponentDefinition)等,可以将系统组件的能力通过 OAM 的标准方式提供给最终的用户使用。
|
||||
|
||||
## 开始之前
|
||||
|
||||
系统插件可以通过 KubeVela 的命令行工具一键安装,请确保你已经安装了 [vela CLI](../../getting-started/quick-install#quick-install/#3-安装-kubevela-cli)。
|
||||
|
||||
## 查看默认的系统插件
|
||||
|
||||
1. 使用 vela CLI 查看可用的插件
|
||||
|
||||
```shell
|
||||
vela addon list
|
||||
```
|
||||
|
||||
```shell
|
||||
NAME DESCRIPTION STATUS IN-NAMESPACE
|
||||
fluxcd Flux is a set of continuous and progressive delivery solutions for Kubernetes uninstalled vela-system
|
||||
keda KEDA is a Kubernetes-based Event Driven Autoscaler. uninstalled vela-system
|
||||
kruise Kruise is a Kubernetes extended suite for application automations uninstalled vela-system
|
||||
ns-flux-system Create namespace for flux-system uninstalled vela-system
|
||||
observability An out of the box solution for KubeVela observability uninstalled vela-system
|
||||
observability-asset Preparations that observability need uninstalled vela-system
|
||||
ocm-cluster-manager ocm-cluster-manager can deploy an OCM hub cluster environment. uninstalled vela-system
|
||||
prometheus Prometheus is an open-source systems monitoring and alerting toolkit uninstalled vela-system
|
||||
terraform Terraform Controller is a Kubernetes Controller for Terraform. uninstalled vela-system
|
||||
```
|
||||
|
||||
2. 系统插件简介
|
||||
|
||||
| 插件 | 参考地址 | 简介 | 已内置Definition |
|
||||
| ------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ---------------- |
|
||||
| fluxcd | https://fluxcd.io/ | 提供 GitOps,持续部署的相关能力 | kustomize、helm |
|
||||
| ns-flux-system | - | 目前为 fluxcd 插件提供 namespace 使用,后续优化方向为使之对所有用户不可见 | - |
|
||||
| kruise | https://openkruise.io/ | 提供比 Kubernetes 原生更强大的工作负载套件 | cloneset |
|
||||
| prometheus | https://prometheus.io/ | 提供监控能力 | - |
|
||||
| keda | https://keda.sh/ | 提供工作负载的自动扩缩容能力 | - |
|
||||
| terraform | https://github.com/oam-dev/terraform-controller <br />https://www.terraform.io/ | IaC(基础设施即代码) | - |
|
||||
| ocm | https://github.com/open-cluster-management | 多集群相关依赖 | - |
|
||||
| observability | - | 为 KubeVela core 提供系统级别的监控,也可以为应用提供业务级别的监控。 | - |
|
||||
| observability-asset | - | 目前仅为 observability 插件提供相关所需资源,后续优化方向为使之对所有用户不可见 | - |
|
||||
|
||||
|
||||
|
||||
## 使用示例
|
||||
|
||||
1. 需求
|
||||
|
||||
假设此时你想以 helm chart 形式作为应用部署计划的组件,你需要满足这个需求。经过一番查阅,你发现 KubeVela 提供的名为 fluxcd 的插件已经满足了你的需求。
|
||||
|
||||
这个插件已经将调协集群中的 helm chart 的能力整理好,准备了相关的组件定义,可以一键启用。
|
||||
|
||||
> [FluxCD](https://fluxcd.io/) 是一套提供 Gitops 功能的解决方案。它提供了一种方便的,向集群中安装Helm chart/Kustomize 形式对象的方案。它可以从 Git 仓库、OSS 等来源读取配置。
|
||||
> fluxcd 插件集成了该项目的功能。
|
||||
|
||||
下面将以 fluxcd 为例,演示一个插件的安装和使用过程。
|
||||
|
||||
1. 以 fluxcd 这个插件为例,启用 fluxcd 以后, CLI 将会持续检查 fluxcd 插件的状态,直至其成功安装。
|
||||
|
||||
```shell
|
||||
vela addon enable fluxcd
|
||||
```
|
||||
|
||||
```shell
|
||||
I0813 16:35:02.430540 13705 apply.go:93] "creating object" name="fluxcd" resource="core.oam.dev/v1beta1, Kind=Initializer"
|
||||
Initializer fluxcd is in phase:...
|
||||
Initializer fluxcd is in phase:checkingDependsOn...
|
||||
Initializer fluxcd is in phase:initializing...
|
||||
Successfully enable addon:fluxcd
|
||||
```
|
||||
|
||||
3. 使用 fluxcd 插件内置的组件定义:
|
||||
|
||||
至此,你作为平台管理员的所有工作都已经就绪。接下来你只需要告诉与你合作的应用开发者:可以使用 helm 类型的组件了。
|
||||
|
||||
fluxcd 插件中已经附带了一个帮助交付 helm chart 类型的[组件定义](https://github.com/oam-dev/kubevela/blob/master/vela-templates/addons/fluxcd/definitions/helm-release.yaml) helm。
|
||||
|
||||
你可以通过如下命令查看该组件定义已在集群中就绪:
|
||||
|
||||
```shell
|
||||
vela components
|
||||
NAME NAMESPACE WORKLOAD DESCRIPTION
|
||||
helm vela-system autodetects.core.oam.dev helm release is a group of K8s resources from either git
|
||||
repository or helm repo
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
## 禁用插件
|
||||
|
||||
1. 清理应用:
|
||||
|
||||
```shell
|
||||
kubectl delete application
|
||||
```
|
||||
```shell
|
||||
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
|
||||
redis default 1 2021-08-17 04:12:49.3966701 +0000 UTC deployed redis-cluster-6.2.7 6.2.5
|
||||
```
|
||||
|
||||
2. 禁用插件
|
||||
|
||||
你可以使用 `vela addon disable fluxcd` 来禁用该插件。 请注意在禁用插件之前清理相关应用。注意如果直接禁用插件,带有 helm 类型的交付组件将无法被正确地删除。
|
||||
|
||||
另外,要完全清理 fluxcd 插件,最后你还需要执行 `vela addon disable ns-flux-system`,这是 fluxcd 的辅助插件,需要手动禁用。
|
|
@ -8,7 +8,7 @@ KubeVela 通过云资源组件(Component)和运维特征(Trait)里的资
|
|||
|
||||
## 查看 KubeVela 的云资源组件
|
||||
|
||||
我们通过 [KubeVela CLI](../getting-started/quick-install.mdx#3-安装-kubevela-cli)来查看,当前系统中可用的云资源组件类型:
|
||||
我们通过 [KubeVela CLI](../getting-started/quick-install#3-安装-kubevela-cli)来查看,当前系统中可用的云资源组件类型:
|
||||
|
||||
```shell
|
||||
$ vela components
|
||||
|
|
|
@ -1,218 +0,0 @@
|
|||
---
|
||||
title: 组件交付 // Deprecated
|
||||
---
|
||||
|
||||
组件(Components)是应用部署计划的核心组成之一,你可以使用它来构建最常见的服务类型,比如一个对外提供访问的 Web Service、一个在后端跑定时任务的 Worker,又或者开启 Redis 和引用 OSS 等等。
|
||||
|
||||
为了帮你快速而全面的落地业务,KubeVela 提供了大量开箱即用的组件类型,不仅包含了面向常规微服务场景的业务型组件,如”服务型组件”(webservice)、“后台运行组件”(worker)、“一次性任务组件”(task)等,还包含了面向社区不同制品类别的通用型组件,如支持 Helm Chart 的“Helm 组件”、支持 Git 仓库的“Kustomize 组件”等,同时还包含了一系列常用的云服务组件。如果 KubeVela 内置的组件类型不能满足你的全部需求,KubeVela 还拥有几乎可以对接任意类型组件制品的扩展能力。
|
||||
|
||||
## 查看 KubeVela 的组件类型
|
||||
|
||||
我们通过 [KubeVela CLI][1] 来查看系统中可用组件类型:
|
||||
|
||||
```shell
|
||||
$ vela components
|
||||
NAME NAMESPACE WORKLOAD DESCRIPTION
|
||||
alibaba-ack vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud ACK cluster
|
||||
alibaba-oss vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud OSS object
|
||||
alibaba-rds vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud RDS object
|
||||
helm vela-system autodetects.core.oam.dev helm release is a group of K8s resources from either git
|
||||
repository or helm repo
|
||||
kustomize vela-system autodetects.core.oam.dev kustomize can fetching, building, updating and applying
|
||||
Kustomize manifests from git repo.
|
||||
raw vela-system autodetects.core.oam.dev raw allow users to specify raw K8s object in properties
|
||||
task vela-system jobs.batch Describes jobs that run code or a script to completion.
|
||||
webservice vela-system deployments.apps Describes long-running, scalable, containerized services
|
||||
that have a stable network endpoint to receive external
|
||||
network traffic from customers.
|
||||
worker vela-system deployments.apps Describes long-running, scalable, containerized services
|
||||
that running at backend. They do NOT have network endpoint
|
||||
to receive external network traffic.
|
||||
```
|
||||
|
||||
每个类型具体是指:
|
||||
- `webservice`:长时间运行、弹性的容器化服务,对外提供访问
|
||||
- `worker`:长时间运行、弹性、容器化的后端服务,不对外访问
|
||||
- `task`:跑代码或者脚本的一次性任务
|
||||
- `helm`:面向社区不同制品类别的通用型 Helm 组件
|
||||
- `kustomize`:面向社区不同制品类别的通用型 Kustomize 组件
|
||||
- `alibaba-ack`:云资源之一,阿里云容器服务 Kubernetes 版(ACK )
|
||||
- `alibaba-oss`:云资源之一,阿里云对象存储服务(OSS)
|
||||
- `alibaba-rds`:云资源之一,阿里云关系型数据库服务(RDS)
|
||||
- `raw`:直接引用原生的 Kubernetes 资源对象的组件
|
||||
|
||||
下面让我们以几个典型的组件类型为例,介绍 KubeVela 组件交付的用法。如果你希望直接查看云资源的使用方式,请阅读[集成云资源][2]。
|
||||
|
||||
## 使用服务型组件(webservice)部署应用
|
||||
|
||||
服务型组件是以容器为核心支撑对外访问服务的组件,其功能涵盖了主流微服务场景的需要。
|
||||
|
||||
为了便于你快速学习,请直接复制下面的 Shell 执行,会部署到集群中:
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
# YAML 文件开始
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: website
|
||||
spec:
|
||||
components:
|
||||
- name: frontend
|
||||
type: webservice
|
||||
properties:
|
||||
image: oamdev/testapp:v1
|
||||
cmd: ["node", "server.js"]
|
||||
port: 8080
|
||||
cpu: "0.1"
|
||||
env:
|
||||
- name: FOO
|
||||
value: bar
|
||||
# YAML 文件结束
|
||||
EOF
|
||||
```
|
||||
你也可以自行将 YAML 文件保存为 website.yaml,使用 `kubectl apply -f website.yaml` 命令进行部署。
|
||||
|
||||
接下来,通过 `kubectl get application <应用 name> -o yaml` 查看应用的部署状态:
|
||||
```shell
|
||||
$ kubectl get application website -o yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: website
|
||||
... # 省略非关键信息
|
||||
spec:
|
||||
components:
|
||||
- name: frontend
|
||||
properties:
|
||||
... # 省略非关键信息
|
||||
type: webservice
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-08-28T10:26:47Z"
|
||||
reason: Available
|
||||
status: "True"
|
||||
... # 省略非关键信息
|
||||
type: HealthCheck
|
||||
observedGeneration: 1
|
||||
... # 省略非关键信息
|
||||
services:
|
||||
- healthy: true
|
||||
name: frontend
|
||||
workloadDefinition:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
status: running
|
||||
```
|
||||
当我们看到 status-services-healthy 的字段为 true,并且 status 为 running 时,即表示整个应用交付成功。
|
||||
|
||||
如果 status 显示为 rendering,或者 healthy 为 false,则表示应用要么部署失败,要么还在部署中。请根据 `kubectl get application <应用 name> -o yaml` 中返回的信息对应地进行处理。
|
||||
|
||||
你也可以通过 vela 的 CLI 查看,使用如下命令:
|
||||
```shell
|
||||
$ vela ls
|
||||
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
|
||||
website frontend webservice running healthy 2021-08-28 18:26:47 +0800 CST
|
||||
```
|
||||
我们也看到 website APP 的 PHASE 为 running,同时 STATUS 为 healthy。
|
||||
|
||||
## 使用 Helm 组件部署应用
|
||||
|
||||
KubeVela 的 `helm` 组件满足了用户对接 Helm Chart 的需求,你可以通过 `helm` 组件部署任意来自 Helm 仓库、Git 仓库或者 OSS bucket 的现成 Helm chart 软件包,并对其进行参数覆盖。
|
||||
|
||||
我们以来自 Helm 仓库的 Chart 包部署方式,进行示例讲解。在这次的应用部署计划中,希望交付的是一个名为 redis-comp 的组件。它是来自 https://charts.bitnami.com/bitnami Helm 仓库的 Chart。Chart 类型为 redis-cluster,版本 6.2.7。
|
||||
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: app-delivering-chart
|
||||
spec:
|
||||
components:
|
||||
- name: redis-comp
|
||||
type: helm
|
||||
properties:
|
||||
chart: redis-cluster
|
||||
version: 6.2.7
|
||||
url: https://charts.bitnami.com/bitnami
|
||||
repoType: helm
|
||||
EOF
|
||||
```
|
||||
|
||||
请复制上面的代码块,直接部署到运行时集群:
|
||||
```shell
|
||||
application.core.oam.dev/app-delivering-chart created
|
||||
```
|
||||
|
||||
最后我们使用 `vela ls` 来查看交付成功后的应用状态:
|
||||
```shell
|
||||
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
|
||||
app-delivering-chart redis-comp helm running healthy 2021-08-28 18:48:21 +0800 CST
|
||||
```
|
||||
|
||||
我们也看到 app-delivering-chart APP 的 PHASE 为 running,同时 STATUS 为 healthy。
|
||||
|
||||
关于 Git 仓库和 OSS bucket 的使用示例,以及关于它们的详细配置项信息,请前往管理员手册里的内置组件查阅。
|
||||
|
||||
## 使用 Kustomize 组件部署应用
|
||||
|
||||
KubeVela 的 `kustomize` 组件满足了用户直接对接 Yaml 文件、文件夹作为组件制品的需求。无论你的 Yaml 文件/文件夹是存放在 Git 仓库还是 OSS bucket,KubeVela 均能读取并交付。
|
||||
|
||||
我们以来自 OSS bucket 仓库 YAML 文件夹组件为例来做用法的讲解。这一次的应用部署计划中,希望交付的是一个名为 bucket-comp 的组件。组件对应的部署文件存放在云存储 OSS bucket,使用对应 bucket 名称是 definition-registry。kustomize.yaml 来自 oss-cn-beijing.aliyuncs.com 的这个地址,所在路径为 `./app/prod/`。
|
||||
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: bucket-app
|
||||
spec:
|
||||
components:
|
||||
- name: bucket-comp
|
||||
type: kustomize
|
||||
properties:
|
||||
repoType: oss
|
||||
# 如果 bucket 是私用权限,会需要你提供
|
||||
secretRef: bucket-secret
|
||||
url: oss-cn-beijing.aliyuncs.com
|
||||
oss:
|
||||
bucketName: definition-registry
|
||||
path: ./app/prod/
|
||||
EOF
|
||||
```
|
||||
请复制上面的代码块,直接部署到运行时集群:
|
||||
|
||||
```shell
|
||||
application.core.oam.dev/bucket-app created
|
||||
```
|
||||
|
||||
最后我们使用 `vela ls` 来查看交付成功后的应用状态:
|
||||
```shell
|
||||
vela ls
|
||||
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
|
||||
bucket-app bucket-comp kustomize running healthy 2021-08-28 18:53:14 +0800 CST
|
||||
```
|
||||
|
||||
bucket-app APP 的 PHASE 为 running,同时 STATUS 为 healthy。应用部署成功!
|
||||
|
||||
关于 Git 仓库的使用示例,以及关于它们的详细配置项信息,请前往管理员手册里的内置组件查阅。
|
||||
|
||||
## 使用云资源组件
|
||||
|
||||
云资源组件也是 KubeVela 支持的核心组件,云资源往往不会单独使用,如数据库、缓存等云资源,往往需要在创建之后将相关信息传递到其他组件使用,同时云资源涉及到不同云厂商,以及一些鉴权相关的准备工作,我们将在[集成云资源][5]这个章节独立讲解。
|
||||
|
||||
## 自定义组件
|
||||
|
||||
当以上 KubeVela 内置的开箱组件都无法满足需求的时候,不要担心,KubeVela 提供了强大了扩展能力,几乎可以对接任意类型的组件形态,你可以查看管理员手册里的[自定义组件][6]学习使用 CUE 和 Kubernetes 扩展 KubeVela 的组件类型。
|
||||
|
||||
## 下一步
|
||||
|
||||
- 访问[集成云资源][7]文档,掌握不同类型不同厂商的云资源集成方式
|
||||
- 访问[绑定运维特征][8]文档,掌握如何给组件绑定你需要的运维动作和策略
|
||||
|
||||
[1]: ../getting-started/quick-install#3-安装-kubevela-cli
|
||||
[2]: ./cloud-services
|
||||
[5]: ./cloud-services
|
||||
[6]: ../platform-engineers/components/custom-component
|
||||
[7]: ./cloud-services
|
||||
[8]: ./binding-traits
|
|
@ -29,4 +29,8 @@ spec:
|
|||
command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
|
||||
restartPolicy: Never
|
||||
backoffLimit: 4
|
||||
```
|
||||
```
|
||||
|
||||
## 属性说明
|
||||
|
||||
在 properties 字段中填写完整的 Kubernetes 资源结构体。
|
|
@ -23,14 +23,12 @@ spec:
|
|||
|
||||
## 属性说明
|
||||
|
||||
```console
|
||||
# Properties
|
||||
+----------------+--------------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+----------------+--------------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| -------------- | ------------------------------------------------------------------------------------------------ | --------------------------------- | -------- | ------- |
|
||||
| cmd | Commands to run in the container | []string | false | |
|
||||
| env | Define arguments by using environment variables | [[]env](#env) | false | |
|
||||
| count | Specify number of tasks to run in parallel | int | true | 1 |
|
||||
| count | Specify number of tasks to run in parallel | int | true | 1 |
|
||||
| restart | Define the job restart policy, the value can only be Never or OnFailure. By default, it's Never. | string | true | Never |
|
||||
| image | Which image would you like to use for your service | string | true | |
|
||||
| cpu | Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core) | string | false | |
|
||||
|
@ -38,13 +36,12 @@ spec:
|
|||
| volumes | Declare volumes and volumeMounts | [[]volumes](#volumes) | false | |
|
||||
| livenessProbe | Instructions for assessing whether the container is alive. | [livenessProbe](#livenessProbe) | false | |
|
||||
| readinessProbe | Instructions for assessing whether the container is in a suitable state to serve traffic. | [readinessProbe](#readinessProbe) | false | |
|
||||
+----------------+--------------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
|
||||
|
||||
########### readinessProbe
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
### readinessProbe
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
|
||||
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
|
||||
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
|
||||
|
@ -54,56 +51,51 @@ spec:
|
|||
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
|
||||
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
|
||||
| | both the exec attribute and the httpGet attribute. | | | |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| | not ready (readiness probe). | | | |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
############### tcpSocket
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
#### tcpSocket
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
|
||||
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
|
||||
|
||||
############# httpGet
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### httpGet
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
|
||||
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
|
||||
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
|
||||
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
############## httpHeaders
|
||||
+-------+-------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
##### httpHeaders
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----- | ----------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| value | | string | true | |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
|
||||
|
||||
############ exec
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
#### exec
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
|
||||
|
||||
###### livenessProbe
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
### livenessProbe
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
|
||||
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
|
||||
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
|
||||
|
@ -113,85 +105,74 @@ spec:
|
|||
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
|
||||
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
|
||||
| | both the exec attribute and the httpGet attribute. | | | |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| | not ready (readiness probe). | | | |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
########## tcpSocket
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
#### tcpSocket
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
|
||||
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
|
||||
|
||||
######## httpGet
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### httpGet
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
|
||||
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
|
||||
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
|
||||
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
######### httpHeaders
|
||||
+-------+-------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
##### httpHeaders
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----- | ----------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| value | | string | true | |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
|
||||
|
||||
####### exec
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
#### exec
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
|
||||
|
||||
##### volumes
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| --------- | ------------------------------------------------------------------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| mountPath | | string | true | |
|
||||
| type | Specify volume type, options: "pvc","configMap","secret","emptyDir" | string | true | |
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
|
||||
|
||||
## env
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
#### env
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| --------- | --------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| name | Environment variable name | string | true | |
|
||||
| value | The value of the environment variable | string | false | |
|
||||
| valueFrom | Specifies a source the value of this var should come from | [valueFrom](#valueFrom) | false | |
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
### valueFrom
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### valueFrom
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------ | ------------------------------------------------ | ----------------------------- | -------- | ------- |
|
||||
| secretKeyRef | Selects a key of a secret in the pod's namespace | [secretKeyRef](#secretKeyRef) | true | |
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
#### secretKeyRef
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ---------------------------------------------------------------- | ------ | -------- | ------- |
|
||||
| name | The name of the secret in the pod's namespace to select from | string | true | |
|
||||
| key | The key of the secret to select from. Must be a valid secret key | string | true | |
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
```
|
||||
| key | The key of the secret to select from. Must be a valid secret key | string | true | |
|
|
@ -2,11 +2,15 @@
|
|||
title: Web 服务
|
||||
---
|
||||
|
||||
Web 服务(Web Service)描述在后端运行的长时间运行、可水平扩展、且对外暴露服务端口的容器化服务。
|
||||
服务型组件是以容器为核心支撑对外访问服务的组件,其功能涵盖了主流微服务场景的需要,即在后端长时间运行、可水平扩展、且对外暴露服务端口的服务。
|
||||
|
||||
## 如何使用
|
||||
|
||||
```YAML
|
||||
为了便于你快速学习,请直接复制下面的 Shell 执行,应用会部署到集群中:
|
||||
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
# YAML 文件开始
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
|
@ -23,25 +27,68 @@ spec:
|
|||
env:
|
||||
- name: FOO
|
||||
value: bar
|
||||
- name: FOO
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: bar
|
||||
key: bar
|
||||
# YAML 文件结束
|
||||
EOF
|
||||
```
|
||||
|
||||
你也可以自行将 YAML 文件保存为 website.yaml,使用 `kubectl apply -f website.yaml` 命令进行部署。
|
||||
|
||||
接下来,通过 `kubectl get application <应用 name> -o yaml` 查看应用的部署状态:
|
||||
|
||||
```shell
|
||||
$ kubectl get application website -o yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: website
|
||||
... # 省略非关键信息
|
||||
spec:
|
||||
components:
|
||||
- name: frontend
|
||||
properties:
|
||||
... # 省略非关键信息
|
||||
type: webservice
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2021-08-28T10:26:47Z"
|
||||
reason: Available
|
||||
status: "True"
|
||||
... # 省略非关键信息
|
||||
type: HealthCheck
|
||||
observedGeneration: 1
|
||||
... # 省略非关键信息
|
||||
services:
|
||||
- healthy: true
|
||||
name: frontend
|
||||
workloadDefinition:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
status: running
|
||||
```
|
||||
|
||||
当我们看到 status-services-healthy 的字段为 true,并且 status 为 running 时,即表示整个应用交付成功。
|
||||
|
||||
如果 status 显示为 rendering,或者 healthy 为 false,则表示应用要么部署失败,要么还在部署中。请根据 `kubectl get application <应用 name> -o yaml` 中返回的信息对应地进行处理。
|
||||
|
||||
你也可以通过 vela 的 CLI 查看,使用如下命令:
|
||||
|
||||
```shell
|
||||
$ vela ls
|
||||
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
|
||||
website frontend webservice running healthy 2021-08-28 18:26:47 +0800 CST
|
||||
```
|
||||
|
||||
我们也看到 website APP 的 PHASE 为 running,同时 STATUS 为 healthy。
|
||||
|
||||
|
||||
## 属性说明
|
||||
|
||||
```console
|
||||
$ vela show webservice
|
||||
# Properties
|
||||
+------------------+-------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------------------+-------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---------------- | ----------------------------------------------------------------------------------------- | --------------------------------- | -------- | ------- |
|
||||
| cmd | Commands to run in the container | []string | false | |
|
||||
| env | Define arguments by using environment variables | [[]env](#env) | false | |
|
||||
| image | Which image would you like to use for your service | string | true | |
|
||||
| port | Which port do you want customer traffic sent to | int | true | 80 |
|
||||
| port | Which port do you want customer traffic sent to | int | true | 80 |
|
||||
| imagePullPolicy | Specify image pull policy for your service | string | false | |
|
||||
| cpu | Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core) | string | false | |
|
||||
| memory | Specifies the attributes of the memory resource required for the container. | string | false | |
|
||||
|
@ -49,13 +96,12 @@ $ vela show webservice
|
|||
| livenessProbe | Instructions for assessing whether the container is alive. | [livenessProbe](#livenessProbe) | false | |
|
||||
| readinessProbe | Instructions for assessing whether the container is in a suitable state to serve traffic. | [readinessProbe](#readinessProbe) | false | |
|
||||
| imagePullSecrets | Specify image pull secrets for your service | []string | false | |
|
||||
+------------------+-------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
|
||||
|
||||
########### readinessProbe
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
### readinessProbe
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
|
||||
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
|
||||
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
|
||||
|
@ -65,56 +111,47 @@ $ vela show webservice
|
|||
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
|
||||
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
|
||||
| | both the exec attribute and the httpGet attribute. | | | |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| | not ready (readiness probe). | | | |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
############### tcpSocket
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
#### tcpSocket
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
|
||||
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
|
||||
|
||||
############# httpGet
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### httpGet
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
|
||||
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
|
||||
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
|
||||
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
############## httpHeaders
|
||||
+-------+-------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
##### httpHeaders
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----- | ----------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| value | | string | true | |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
|
||||
|
||||
############ exec
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
###### exec
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
|
||||
|
||||
###### livenessProbe
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
### livenessProbe
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
|
||||
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
|
||||
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
|
||||
|
@ -124,85 +161,68 @@ $ vela show webservice
|
|||
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
|
||||
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
|
||||
| | both the exec attribute and the httpGet attribute. | | | |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| | not ready (readiness probe). | | | |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
########## tcpSocket
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
###### tcpSocket
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
|
||||
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
|
||||
|
||||
######## httpGet
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
##### httpGet
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
|
||||
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
|
||||
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
|
||||
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
######### httpHeaders
|
||||
+-------+-------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
###### httpHeaders
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----- | ----------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| value | | string | true | |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
|
||||
|
||||
####### exec
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
##### exec
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
|
||||
|
||||
##### volumes
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
### volumes
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| --------- | ------------------------------------------------------------------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| mountPath | | string | true | |
|
||||
| type | Specify volume type, options: "pvc","configMap","secret","emptyDir" | string | true | |
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
|
||||
|
||||
## env
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
#### env
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| --------- | --------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| name | Environment variable name | string | true | |
|
||||
| value | The value of the environment variable | string | false | |
|
||||
| valueFrom | Specifies a source the value of this var should come from | [valueFrom](#valueFrom) | false | |
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
### valueFrom
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------ | ------------------------------------------------ | ----------------------------- | -------- | ------- |
|
||||
| secretKeyRef | Selects a key of a secret in the pod's namespace | [secretKeyRef](#secretKeyRef) | true | |
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
#### secretKeyRef
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ---------------------------------------------------------------- | ------ | -------- | ------- |
|
||||
| name | The name of the secret in the pod's namespace to select from | string | true | |
|
||||
| key | The key of the secret to select from. Must be a valid secret key | string | true | |
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
```
|
|
@ -24,12 +24,9 @@ spec:
|
|||
|
||||
## 属性说明
|
||||
|
||||
```console
|
||||
$ vela show worker
|
||||
# Properties
|
||||
+------------------+-------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------------------+-------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---------------- | ----------------------------------------------------------------------------------------- | --------------------------------- | -------- | ------- |
|
||||
| cmd | Commands to run in the container | []string | false | |
|
||||
| env | Define arguments by using environment variables | [[]env](#env) | false | |
|
||||
| image | Which image would you like to use for your service | string | true | |
|
||||
|
@ -40,13 +37,11 @@ $ vela show worker
|
|||
| livenessProbe | Instructions for assessing whether the container is alive. | [livenessProbe](#livenessProbe) | false | |
|
||||
| readinessProbe | Instructions for assessing whether the container is in a suitable state to serve traffic. | [readinessProbe](#readinessProbe) | false | |
|
||||
| imagePullSecrets | Specify image pull secrets for your service | []string | false | |
|
||||
+------------------+-------------------------------------------------------------------------------------------+-----------------------------------+----------+---------+
|
||||
|
||||
|
||||
########### readinessProbe
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
### readinessProbe
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
|
||||
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
|
||||
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
|
||||
|
@ -56,56 +51,46 @@ $ vela show worker
|
|||
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
|
||||
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
|
||||
| | both the exec attribute and the httpGet attribute. | | | |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| | not ready (readiness probe). | | | |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
############### tcpSocket
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
##### tcpSocket
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
|
||||
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
|
||||
|
||||
############# httpGet
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### httpGet
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
|
||||
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
|
||||
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
|
||||
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
############## httpHeaders
|
||||
+-------+-------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
##### httpHeaders
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----- | ----------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| value | | string | true | |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
|
||||
|
||||
############ exec
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
##### exec
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
|
||||
|
||||
###### livenessProbe
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
### livenessProbe
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| exec | Instructions for assessing container health by executing a command. Either this attribute or the | [exec](#exec) | false | |
|
||||
| | httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive | | | |
|
||||
| | with both the httpGet attribute and the tcpSocket attribute. | | | |
|
||||
|
@ -115,85 +100,68 @@ $ vela show worker
|
|||
| tcpSocket | Instructions for assessing container health by probing a TCP socket. Either this attribute or the | [tcpSocket](#tcpSocket) | false | |
|
||||
| | exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with | | | |
|
||||
| | both the exec attribute and the httpGet attribute. | | | |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| initialDelaySeconds | Number of seconds after the container is started before the first probe is initiated. | int | true | 0 |
|
||||
| periodSeconds | How often, in seconds, to execute the probe. | int | true | 10 |
|
||||
| timeoutSeconds | Number of seconds after which the probe times out. | int | true | 1 |
|
||||
| successThreshold | Minimum consecutive successes for the probe to be considered successful after having failed. | int | true | 1 |
|
||||
| failureThreshold | Number of consecutive failures required to determine the container is not alive (liveness probe) or | int | true | 3 |
|
||||
| | not ready (readiness probe). | | | |
|
||||
+---------------------+------------------------------------------------------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
########## tcpSocket
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
#### tcpSocket
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ------------------------------------------------------------------------------------- | ---- | -------- | ------- |
|
||||
| port | The TCP socket within the container that should be probed to assess container health. | int | true | |
|
||||
+------+---------------------------------------------------------------------------------------+------+----------+---------+
|
||||
|
||||
|
||||
######## httpGet
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### httpGet
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----------- | ------------------------------------------------------------------------------------- | ----------------------------- | -------- | ------- |
|
||||
| path | The endpoint, relative to the port, to which the HTTP GET request should be directed. | string | true | |
|
||||
| port | The TCP socket within the container to which the HTTP GET request should be directed. | int | true | |
|
||||
| httpHeaders | | [[]httpHeaders](#httpHeaders) | false | |
|
||||
+-------------+---------------------------------------------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
######### httpHeaders
|
||||
+-------+-------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
##### httpHeaders
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ----- | ----------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| value | | string | true | |
|
||||
+-------+-------------+--------+----------+---------+
|
||||
|
||||
|
||||
####### exec
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
+---------+------------------------------------------------------------------------------------------------------+----------+----------+---------+
|
||||
#### exec
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------- | --------------------------------------------------------------------------------------------------- | -------- | -------- | ------- |
|
||||
| command | A command to be executed inside the container to assess its health. Each space delimited token of | []string | true | |
|
||||
| | the command is a separate array element. Commands exiting 0 are considered to be successful probes, | | | |
|
||||
| | whilst all other exit codes are considered failures. | | | |
|
||||
|
||||
|
||||
##### volumes
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
#### volumes
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| --------- | ------------------------------------------------------------------- | ------ | -------- | ------- |
|
||||
| name | | string | true | |
|
||||
| mountPath | | string | true | |
|
||||
| type | Specify volume type, options: "pvc","configMap","secret","emptyDir" | string | true | |
|
||||
+-----------+---------------------------------------------------------------------+--------+----------+---------+
|
||||
|
||||
|
||||
## env
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
#### env
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| --------- | --------------------------------------------------------- | ----------------------- | -------- | ------- |
|
||||
| name | Environment variable name | string | true | |
|
||||
| value | The value of the environment variable | string | false | |
|
||||
| valueFrom | Specifies a source the value of this var should come from | [valueFrom](#valueFrom) | false | |
|
||||
+-----------+-----------------------------------------------------------+-------------------------+----------+---------+
|
||||
|
||||
|
||||
### valueFrom
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
#### valueFrom
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ------------ | ------------------------------------------------ | ----------------------------- | -------- | ------- |
|
||||
| secretKeyRef | Selects a key of a secret in the pod's namespace | [secretKeyRef](#secretKeyRef) | true | |
|
||||
+--------------+--------------------------------------------------+-------------------------------+----------+---------+
|
||||
|
||||
|
||||
#### secretKeyRef
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
| ---- | ---------------------------------------------------------------- | ------ | -------- | ------- |
|
||||
| name | The name of the secret in the pod's namespace to select from | string | true | |
|
||||
| key | The key of the secret to select from. Must be a valid secret key | string | true | |
|
||||
+------+------------------------------------------------------------------+--------+----------+---------+
|
||||
```
|
|
@ -2,25 +2,14 @@
|
|||
title: Helm 组件
|
||||
---
|
||||
|
||||
KubeVela 可以部署任何 Helm Chart 组件 ,Chart 组件的来源可以是 Helm 仓库、Git 仓库 或者 OSS bucket。
|
||||
KubeVela 的 `helm` 组件满足了用户对接 Helm Chart 的需求,你可以通过 `helm` 组件部署任意来自 Helm 仓库、Git 仓库或者 OSS bucket 的现成 Helm chart 软件包,并对其进行参数覆盖。
|
||||
|
||||
## 部署来自 Helm 仓库的 Chart
|
||||
|
||||
| 参数 | 是否可选 | 含义 | 例子 |
|
||||
| --------------- | -------- | ------------------------------------------------------------ | ---------------------------------- |
|
||||
| repoType | 必填 | 值为 Helm 标志chart来自 Helm 仓库 | Helm |
|
||||
| pullInterval | 可选 | 与 Helm 仓库进行同步,与调谐 Helm release 的时间间隔 默认值5m(5分钟) | 10m |
|
||||
| url | 必填 | Helm 仓库地址,支持 http/https | https://charts.bitnami.com/bitnami |
|
||||
| secretRef | 可选 | 存有拉取仓库所需凭证的 Secret 对象名,对 HTTP/S 基本鉴权 Secret 中必须包含 username 和 password 字段。对于 TLS the secret must contain a certFile and keyFile, and/or // caCert fields.对 TLS 鉴权 Secret 中必须包含 certFile / keyFile 字段 和/或 caCert 字段。 | sec-name |
|
||||
| timeout | 可选 | 拉取仓库索引的超时时间 | 60s |
|
||||
| chart | 必填 | chart 名称 | redis-cluster |
|
||||
| version | 可选 | chart 版本,默认为* | 6.2.7 |
|
||||
| targetNamespace | 可选 | 安装 chart 的名字空间,默认由 chart 本身决定 | your-ns |
|
||||
| releaseName | 可选 | 安装得到的 release 名称 | your-rn |
|
||||
| values | 可选 | 覆写 chart 的 Values.yaml ,用于 Helm 渲染。 | 见来自 Git 仓库的例子 |
|
||||
来自 Helm 仓库的 Chart 包部署方式,我们以一个 redis-comp 组件为例。它是来自 [bitnami](https://charts.bitnami.com/) Helm 仓库的 Chart。Chart 类型为 `redis-cluster`,版本 `6.2.7`。
|
||||
|
||||
**使用示例**
|
||||
```yaml
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
|
@ -34,26 +23,55 @@ spec:
|
|||
version: 6.2.7
|
||||
url: https://charts.bitnami.com/bitnami
|
||||
repoType: helm
|
||||
EOF
|
||||
```
|
||||
|
||||
请复制上面的代码块,直接部署到运行时集群:
|
||||
```shell
|
||||
application.core.oam.dev/app-delivering-chart created
|
||||
```
|
||||
|
||||
最后我们使用 `vela ls` 来查看交付成功后的应用状态:
|
||||
```shell
|
||||
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
|
||||
app-delivering-chart redis-comp helm running healthy 2021-08-28 18:48:21 +0800 CST
|
||||
```
|
||||
|
||||
我们也看到 app-delivering-chart APP 的 PHASE 为 running,同时 STATUS 为 healthy。
|
||||
|
||||
### 参数说明
|
||||
|
||||
| 参数 | 是否可选 | 含义 | 例子 |
|
||||
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
|
||||
| repoType | 必填 | 值为 Helm 标志chart来自 Helm 仓库 | Helm |
|
||||
| pullInterval | 可选 | 与 Helm 仓库进行同步,与调谐 Helm release 的时间间隔 默认值5m(5分钟) | 10m |
|
||||
| url | 必填 | Helm 仓库地址,支持 http/https | https://charts.bitnami.com/bitnami |
|
||||
| secretRef | 可选 | 存有拉取仓库所需凭证的 Secret 对象名,对 HTTP/S 基本鉴权 Secret 中必须包含 username 和 password 字段。对于 TLS the secret must contain a certFile and keyFile, and/or // caCert fields.对 TLS 鉴权 Secret 中必须包含 certFile / keyFile 字段 和/或 caCert 字段。 | sec-name |
|
||||
| timeout | 可选 | 拉取仓库索引的超时时间 | 60s |
|
||||
| chart | 必填 | chart 名称 | redis-cluster |
|
||||
| version | 可选 | chart 版本,默认为* | 6.2.7 |
|
||||
| targetNamespace | 可选 | 安装 chart 的名字空间,默认由 chart 本身决定 | your-ns |
|
||||
| releaseName | 可选 | 安装得到的 release 名称 | your-rn |
|
||||
| values | 可选 | 覆写 chart 的 Values.yaml ,用于 Helm 渲染。 | 见来自 Git 仓库的例子 |
|
||||
|
||||
|
||||
## 部署来自 OSS bucket 的 Chart
|
||||
|
||||
| 参数 | 是否可选 | 含义 | 例子 |
|
||||
| --------------- | -------- | ------------------------------------------------------------ | --------------------------- |
|
||||
| repoType | 必填 | 值为 oss 标志 chart 来自 OSS bucket | oss |
|
||||
| pullInterval | 可选 | 与 bucket 进行同步,与调谐 Helm release 的时间间隔 默认值5m(5分钟) | 10m |
|
||||
| url | 必填 | bucket 的 endpoint,无需填写 scheme | oss-cn-beijing.aliyuncs.com |
|
||||
| 参数 | 是否可选 | 含义 | 例子 |
|
||||
| --------------- | -------- | --------------------------------------------------------------------------------------------- | --------------------------- |
|
||||
| repoType | 必填 | 值为 oss 标志 chart 来自 OSS bucket | oss |
|
||||
| pullInterval | 可选 | 与 bucket 进行同步,与调谐 Helm release 的时间间隔 默认值5m(5分钟) | 10m |
|
||||
| url | 必填 | bucket 的 endpoint,无需填写 scheme | oss-cn-beijing.aliyuncs.com |
|
||||
| secretRef | 可选 | 保存一个 Secret 的名字,该Secret是读取 bucket 的凭证。Secret 包含 accesskey 和 secretkey 字段 | sec-name |
|
||||
| timeout | 可选 | 下载操作的超时时间,默认 20s | 60s |
|
||||
| chart | 必填 | chart 存放路径(key) | ./chart/podinfo-5.1.3.tgz |
|
||||
| version | 可选 | 在 OSS 来源中,该参数不起作用 | |
|
||||
| targetNamespace | 可选 | 安装 chart 的名字空间,默认由 chart 本身决定 | your-ns |
|
||||
| releaseName | 可选 | 安装得到的 release 名称 | your-rn |
|
||||
| values | 可选 | 覆写 chart 的 Values.yaml ,用于 Helm 渲染。 | 见来自 Git 仓库的例子 |
|
||||
| oss.bucketName | 必填 | bucket 名称 | your-bucket |
|
||||
| oss.provider | 可选 | 可选 generic 或 aws,若从 aws EC2 获取凭证则填 aws。默认 generic。 | generic |
|
||||
| oss.region | 可选 | bucket 地区 | |
|
||||
| timeout | 可选 | 下载操作的超时时间,默认 20s | 60s |
|
||||
| chart | 必填 | chart 存放路径(key) | ./chart/podinfo-5.1.3.tgz |
|
||||
| version | 可选 | 在 OSS 来源中,该参数不起作用 | |
|
||||
| targetNamespace | 可选 | 安装 chart 的名字空间,默认由 chart 本身决定 | your-ns |
|
||||
| releaseName | 可选 | 安装得到的 release 名称 | your-rn |
|
||||
| values | 可选 | 覆写 chart 的 Values.yaml ,用于 Helm 渲染。 | 见来自 Git 仓库的例子 |
|
||||
| oss.bucketName | 必填 | bucket 名称 | your-bucket |
|
||||
| oss.provider | 可选 | 可选 generic 或 aws,若从 aws EC2 获取凭证则填 aws。默认 generic。 | generic |
|
||||
| oss.region | 可选 | bucket 地区 | |
|
||||
|
||||
**使用示例**
|
||||
|
||||
|
@ -88,19 +106,19 @@ spec:
|
|||
|
||||
## 部署来自 Git 仓库的 Chart
|
||||
|
||||
| 参数 | 是否可选 | 含义 | 例子 |
|
||||
| --------------- | -------- | ------------------------------------------------------------ | ----------------------------------------------- |
|
||||
| repoType | 必填 | 值为 git 标志 chart 来自 Git 仓库 | git |
|
||||
| pullInterval | 可选 | 与 Git 仓库进行同步,与调谐 Helm release 的时间间隔 默认值5m(5分钟) | 10m |
|
||||
| url | 必填 | Git 仓库地址 | https://github.com/oam-dev/terraform-controller |
|
||||
| 参数 | 是否可选 | 含义 | 例子 |
|
||||
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- |
|
||||
| repoType | 必填 | 值为 git 标志 chart 来自 Git 仓库 | git |
|
||||
| pullInterval | 可选 | 与 Git 仓库进行同步,与调谐 Helm release 的时间间隔 默认值5m(5分钟) | 10m |
|
||||
| url | 必填 | Git 仓库地址 | https://github.com/oam-dev/terraform-controller |
|
||||
| secretRef | 可选 | 存有拉取 Git 仓库所需凭证的 Secret 对象名,对 HTTP/S 基本鉴权 Secret 中必须包含 username 和 password 字段。对 SSH 形式鉴权必须包含 identity, identity.pub 和 known_hosts 字段 | sec-name |
|
||||
| timeout | 可选 | 下载操作的超时时间,默认 20s | 60s |
|
||||
| chart | 必填 | chart 存放路径(key) | ./chart/podinfo-5.1.3.tgz |
|
||||
| version | 可选 | 在 Git 来源中,该参数不起作用 | |
|
||||
| targetNamespace | 可选 | 安装 chart 的名字空间,默认由 chart 本身决定 | your-ns |
|
||||
| releaseName | 可选 | 安装得到的 release 名称 | your-rn |
|
||||
| values | 可选 | 覆写 chart 的 Values.yaml ,用于 Helm 渲染。 | 见来自 Git 仓库的例子 |
|
||||
| git.branch | 可选 | Git 分支,默认为 master | dev |
|
||||
| timeout | 可选 | 下载操作的超时时间,默认 20s | 60s |
|
||||
| chart | 必填 | chart 存放路径(key) | ./chart/podinfo-5.1.3.tgz |
|
||||
| version | 可选 | 在 Git 来源中,该参数不起作用 | |
|
||||
| targetNamespace | 可选 | 安装 chart 的名字空间,默认由 chart 本身决定 | your-ns |
|
||||
| releaseName | 可选 | 安装得到的 release 名称 | your-rn |
|
||||
| values | 可选 | 覆写 chart 的 Values.yaml ,用于 Helm 渲染。 | 见来自 Git 仓库的例子 |
|
||||
| git.branch | 可选 | Git 分支,默认为 master | dev |
|
||||
|
||||
**使用示例**
|
||||
|
||||
|
|
|
@ -2,19 +2,87 @@
|
|||
title: Kustomize 组件
|
||||
---
|
||||
|
||||
KubeVela 可以部署多种来源的 [Kustomize](https://github.com/kubernetes-sigs/kustomize) 组件,目前主要支持来自 Git 仓库和 OSS bucket。
|
||||
|
||||
### 来自 Git 仓库
|
||||
KubeVela 的 [`kustomize` 组件](https://github.com/kubernetes-sigs/kustomize)满足了用户直接对接 Yaml 文件、文件夹作为组件制品的需求。无论你的 Yaml 文件/文件夹是存放在 Git 仓库还是对象存储库(如 OSS bucket),KubeVela 均能读取并交付。
|
||||
|
||||
|
||||
| 参数 | 是否可选 | 含义 | 例子 |
|
||||
| --------------- | -------- | ------------------------------------------------------------ | ----------------------------------------------- |
|
||||
| repoType | 必填 | 值为 git 标志 kustomize 配置来自 Git 仓库 | git |
|
||||
| pullInterval | 可选 | 与 Git 仓库进行同步,与调谐 helm release 的时间间隔 默认值5m(5分钟) | 10m |
|
||||
| url | 必填 | Git 仓库地址 | https://github.com/oam-dev/terraform-controller |
|
||||
| secretRef | 可选 | 存有拉取 Git 仓库所需凭证的 Secret 对象名,对 HTTP/S 基本鉴权 Secret 中必须包含 username 和 password 字段。对 SSH 形式鉴权必须包含 identity, identity.pub 和 known_hosts 字段 | sec-name |
|
||||
| timeout | 可选 | 下载操作的超时时间,默认 20s | 60s |
|
||||
| git.branch | 可选 | Git 分支,默认为 master | dev |
|
||||
## 来自 OSS bucket
|
||||
|
||||
|
||||
来自 OSS bucket 仓库的 YAML 文件夹部署,我们以一个名为 bucket-comp 的组件为例。组件对应的部署文件存放在云存储 OSS bucket,使用对应 bucket 名称是 definition-registry。`kustomize.yaml` 来自 `oss-cn-beijing.aliyuncs.com` 的这个地址,所在路径为 `./app/prod/`。
|
||||
|
||||
|
||||
1. (可选)如果你的 OSS bucket 需要身份验证, 创建 Secret 对象:
|
||||
|
||||
```shell
|
||||
$ kubectl create secret generic bucket-secret --from-literal=accesskey=<your-ak> --from-literal=secretkey=<your-sk>
|
||||
secret/bucket-secret created
|
||||
```
|
||||
|
||||
2. 部署该组件
|
||||
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: bucket-app
|
||||
spec:
|
||||
components:
|
||||
- name: bucket-comp
|
||||
type: kustomize
|
||||
properties:
|
||||
repoType: oss
|
||||
# 如果 bucket 是私用权限,会需要你提供
|
||||
secretRef: bucket-secret
|
||||
url: oss-cn-beijing.aliyuncs.com
|
||||
oss:
|
||||
bucketName: definition-registry
|
||||
path: ./app/prod/
|
||||
EOF
|
||||
```
|
||||
|
||||
请复制上面的代码块,直接部署到运行时集群:
|
||||
|
||||
```shell
|
||||
application.core.oam.dev/bucket-app created
|
||||
```
|
||||
|
||||
最后我们使用 `vela ls` 来查看交付成功后的应用状态:
|
||||
```shell
|
||||
vela ls
|
||||
APP COMPONENT TYPE TRAITS PHASE HEALTHY STATUS CREATED-TIME
|
||||
bucket-app bucket-comp kustomize running healthy 2021-08-28 18:53:14 +0800 CST
|
||||
```
|
||||
|
||||
bucket-app APP 的 PHASE 为 running,同时 STATUS 为 healthy。应用部署成功!
|
||||
|
||||
### 参数说明
|
||||
|
||||
| 参数 | 是否可选 | 含义 | 例子 |
|
||||
| -------------- | -------- | ------------------------------------------------------------------------------------------------- | --------------------------- |
|
||||
| repoType | 必填 | 值为 oss 标志 kustomize 配置来自 OSS bucket | oss |
|
||||
| pullInterval | 可选 | 与 bucket 进行同步,与调谐 kustomize 的时间间隔 默认值5m(5分钟) | 10m |
|
||||
| url | 必填 | bucket 的 endpoint,无需填写 scheme | oss-cn-beijing.aliyuncs.com |
|
||||
| secretRef | 可选 | 保存一个 Secret 的名字,该Secret是读取 bucket 的凭证。Secret 包含 accesskey 和 secretkey 字段 | sec-name |
|
||||
| timeout | 可选 | 下载操作的超时时间,默认 20s | 60s |
|
||||
| path | 必填 | 包含 kustomization.yaml 文件的目录, 或者包含一组 YAML 文件(用以生成 kustomization.yaml )的目录。 | ./prod |
|
||||
| oss.bucketName | 必填 | bucket 名称 | your-bucket |
|
||||
| oss.provider | 可选 | 可选 generic 或 aws,若从 aws EC2 获取凭证则填 aws。默认 generic。 | generic |
|
||||
| oss.region | 可选 | bucket 地区 | |
|
||||
|
||||
|
||||
|
||||
## 来自 Git 仓库
|
||||
|
||||
|
||||
| 参数 | 是否可选 | 含义 | 例子 |
|
||||
| ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- |
|
||||
| repoType | 必填 | 值为 git 标志 kustomize 配置来自 Git 仓库 | git |
|
||||
| pullInterval | 可选 | 与 Git 仓库进行同步,与调谐 helm release 的时间间隔 默认值5m(5分钟) | 10m |
|
||||
| url | 必填 | Git 仓库地址 | https://github.com/oam-dev/terraform-controller |
|
||||
| secretRef | 可选 | 存有拉取 Git 仓库所需凭证的 Secret 对象名,对 HTTP/S 基本鉴权 Secret 中必须包含 username 和 password 字段。对 SSH 形式鉴权必须包含 identity, identity.pub 和 known_hosts 字段 | sec-name |
|
||||
| timeout | 可选 | 下载操作的超时时间,默认 20s | 60s |
|
||||
| git.branch | 可选 | Git 分支,默认为 master | dev |
|
||||
|
||||
**使用示例**
|
||||
|
||||
|
@ -34,65 +102,3 @@ spec:
|
|||
branch: master
|
||||
path: ./app/dev/
|
||||
```
|
||||
|
||||
### 来自 OSS bucket
|
||||
|
||||
| 参数 | 是否可选 | 含义 | 例子 |
|
||||
| -------------- | -------- | ------------------------------------------------------------ | --------------------------- |
|
||||
| repoType | 必填 | 值为 oss 标志 kustomize 配置来自 OSS bucket | oss |
|
||||
| pullInterval | 可选 | 与 bucket 进行同步,与调谐 kustomize 的时间间隔 默认值5m(5分钟) | 10m |
|
||||
| url | 必填 | bucket 的 endpoint,无需填写 scheme | oss-cn-beijing.aliyuncs.com |
|
||||
| secretRef | 可选 | 保存一个 Secret 的名字,该Secret是读取 bucket 的凭证。Secret 包含 accesskey 和 secretkey 字段 | sec-name |
|
||||
| timeout | 可选 | 下载操作的超时时间,默认 20s | 60s |
|
||||
| path | 必填 | 包含 kustomization.yaml 文件的目录, 或者包含一组 YAML 文件(用以生成 kustomization.yaml )的目录。 | ./prod |
|
||||
| oss.bucketName | 必填 | bucket 名称 | your-bucket |
|
||||
| oss.provider | 可选 | 可选 generic 或 aws,若从 aws EC2 获取凭证则填 aws。默认 generic。 | generic |
|
||||
| oss.region | 可选 | bucket 地区 | |
|
||||
|
||||
**使用示例**
|
||||
|
||||
1. (可选)如果你的 OSS bucket 需要身份验证, 创建 Secret 对象:
|
||||
|
||||
```shell
|
||||
$ kubectl create secret generic bucket-secret --from-literal=accesskey=<your-ak> --from-literal=secretkey=<your-sk>
|
||||
secret/bucket-secret created
|
||||
```
|
||||
|
||||
2. 部署该组件
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: bucket-app
|
||||
spec:
|
||||
components:
|
||||
- name: bucket-comp
|
||||
type: kustomize
|
||||
properties:
|
||||
repoType: oss
|
||||
# required if bucket is private
|
||||
secretRef: bucket-secret
|
||||
url: oss-cn-beijing.aliyuncs.com
|
||||
oss:
|
||||
bucketName: definition-registry
|
||||
path: ./app/prod/
|
||||
|
||||
```
|
||||
|
||||
## 覆写 Kustomize 配置
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: bucket-app
|
||||
spec:
|
||||
components:
|
||||
- name: bucket-comp
|
||||
type: kustomize
|
||||
properties:
|
||||
# ...omitted for brevity
|
||||
path: ./app/
|
||||
|
||||
```
|
||||
|
||||
|
|
|
@ -70,46 +70,46 @@ policy-demo nginx-server webservice running true 65s
|
|||
|
||||
如果你想使用 `env-binding` 在多集群环境下创建应用部署计划,请参考 **[应用多集群部署](../multi-app-env-cluster)** 。
|
||||
|
||||
## 附录:属性列表
|
||||
## 参数说明
|
||||
|
||||
环境差异化配置应用策略的所有配置项
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:---------- | :----------- | :----------- | :----------- | :-----------
|
||||
clusterManagementEngine|集群管理方案,可选值 single-cluster(单集群部署)、ocm|string|否|当该字段为空时,默认使用 ocm 多集群管理方案
|
||||
envs|环境配置| env 数组|是|无
|
||||
| 名称 | 描述 | 类型 | 是否必须 | 默认值 |
|
||||
| :---------------------- | :----------------------------------------------------- | :------- | :------- | :------------------------------------------ |
|
||||
| clusterManagementEngine | 集群管理方案,可选值 single-cluster(单集群部署)、ocm | string | 否 | 当该字段为空时,默认使用 ocm 多集群管理方案 |
|
||||
| envs | 环境配置 | env 数组 | 是 | 无 |
|
||||
|
||||
env 的属性
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
name|环境名称|string|是|无
|
||||
patch|对应用部署计划中的组件差异化配置|patch 结构体|是|无
|
||||
placement|资源调度策略,选择将配置化的资源部署到指定的集群或命名空间上| placement 结构体|是|无
|
||||
| 名称 | 描述 | 类型 | 是否必须 | 默认值 |
|
||||
| :-------- | :----------------------------------------------------------- | :--------------- | :------- | :----- |
|
||||
| name | 环境名称 | string | 是 | 无 |
|
||||
| patch | 对应用部署计划中的组件差异化配置 | patch 结构体 | 是 | 无 |
|
||||
| placement | 资源调度策略,选择将配置化的资源部署到指定的集群或命名空间上 | placement 结构体 | 是 | 无 |
|
||||
|
||||
patch 的属性
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
components|需要差异化配置的组件| component 数组|是|无
|
||||
| 名称 | 描述 | 类型 | 是否必须 | 默认值 |
|
||||
| :--------- | :------------------- | :------------- | :------- | :----- |
|
||||
| components | 需要差异化配置的组件 | component 数组 | 是 | 无 |
|
||||
|
||||
placement 的属性
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
clusterSelector|集群选择器,通过标签或者名称筛选集群,该属性只在 clusterManagementEngine 为 ocm 时候有效| clusterSelector 结构体|是|无
|
||||
namespaceSelector|命名空间选择器,通过标签或者名称筛选命名空间,该属性只在 clusterManagementEngine 为 single-cluster 时候有效| namespaceSelector 结构体|是|无
|
||||
| 名称 | 描述 | 类型 | 是否必须 | 默认值 |
|
||||
| :---------------- | :---------------------------------------------------------------------------------------------------------- | :----------------------- | :------- | :----- |
|
||||
| clusterSelector | 集群选择器,通过标签或者名称筛选集群,该属性只在 clusterManagementEngine 为 ocm 时候有效 | clusterSelector 结构体 | 是 | 无 |
|
||||
| namespaceSelector | 命名空间选择器,通过标签或者名称筛选命名空间,该属性只在 clusterManagementEngine 为 single-cluster 时候有效 | namespaceSelector 结构体 | 是 | 无 |
|
||||
|
||||
clusterSelector 的属性
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
labels |集群标签| map[string]string |否|无
|
||||
name |集群名称| string |否|无
|
||||
| 名称 | 描述 | 类型 | 是否必须 | 默认值 |
|
||||
| :----- | :------- | :---------------- | :------- | :----- |
|
||||
| labels | 集群标签 | map[string]string | 否 | 无 |
|
||||
| name | 集群名称 | string | 否 | 无 |
|
||||
|
||||
namespaceSelector 的属性
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
:----------- | :------------ | :------------ | :------------ | :------------
|
||||
labels |命名空间的标签| map[string]string |否|无
|
||||
name |命名空间的名称| string |否|无
|
||||
| 名称 | 描述 | 类型 | 是否必须 | 默认值 |
|
||||
| :----- | :------------- | :---------------- | :------- | :----- |
|
||||
| labels | 命名空间的标签 | map[string]string | 否 | 无 |
|
||||
| name | 命名空间的名称 | string | 否 | 无 |
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
title: 灰度发布和扩缩容
|
||||
---
|
||||
|
||||
WIP
|
|
@ -1,53 +0,0 @@
|
|||
---
|
||||
title: 手动扩缩容
|
||||
---
|
||||
本小节会介绍,如何为应用部署计划的一个待交付组件,配置手动扩缩容。我们使用运维特征里的 `scaler` 来完成开发。
|
||||
|
||||
## 字段说明
|
||||
|
||||
```shell
|
||||
vela show scaler
|
||||
```
|
||||
```console
|
||||
# Properties
|
||||
+----------+--------------------------------+------+----------+---------+
|
||||
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
|
||||
+----------+--------------------------------+------+----------+---------+
|
||||
| replicas | Specify replicas of workload | int | true | 1 |
|
||||
+----------+--------------------------------+------+----------+---------+
|
||||
```
|
||||
|
||||
## 如何使用
|
||||
|
||||
使用时,我们将 `salcer` 运维特征,添加到待交付的组件中去:
|
||||
|
||||
```yaml
|
||||
# sample-manual.yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: website
|
||||
spec:
|
||||
components:
|
||||
- name: frontend
|
||||
type: webservice
|
||||
properties:
|
||||
image: nginx
|
||||
traits:
|
||||
- type: scaler
|
||||
properties:
|
||||
replicas: 2
|
||||
- type: sidecar
|
||||
properties:
|
||||
name: "sidecar-test"
|
||||
image: "fluentd"
|
||||
- name: backend
|
||||
type: worker
|
||||
properties:
|
||||
image: busybox
|
||||
cmd:
|
||||
- sleep
|
||||
- '1000'
|
||||
```
|
||||
|
||||
如果要扩容或缩容,你只需要修改 `scaler` 运维特征的 `replicas` 字段,并重新应用 YAML 文件即可。
|
|
@ -1,24 +1,14 @@
|
|||
---
|
||||
title: 灰度发布和扩缩容
|
||||
---
|
||||
本章节会介绍,如何使用灰度发布( Rollout )运维特征完成对工作负载的滚动发布和扩缩容。
|
||||
|
||||
## 背景
|
||||
|
||||
### 组件版本
|
||||
|
||||
每次对组件的修改都会产生一个组件版本(kubernetes controllerRevision),组件版本名称的默认产生规则是:`<组件名>-<版本序号>`。你也可以通过设置应用部署计划的 `spec.components[x].externalRevision` 字段来指定组件版本名称。
|
||||
|
||||
### 支持的组件类型
|
||||
灰度发布运维特征支持 webservice,worker,clonset 类型的工作负载。
|
||||
|
||||
当使用 webservice和worker 作为工作负载类型并配合使用灰度发布运维特征时,工作负载的名称将被命名为组件版本的名称。 当工作负载类型为 cloneset 时,由于 clonset 支持原地更新, 工作负载的名称将被命名为组件的名称。
|
||||
灰度发布( Rollout )运维特征可以用于对工作负载的滚动发布和扩缩容。
|
||||
|
||||
## 如何使用
|
||||
|
||||
### 首次发布
|
||||
|
||||
应用下面的 YAML 来创建一个应用部署计划,该应用包含了一个使用了灰度发布运维特征的 webservice 类型的组件,并通过设置 `spec.components[0].externalRevision` 来指定组件版本名称为 express-server-v1 。
|
||||
应用下面的 YAML 来创建一个应用部署计划,该应用包含了一个使用了灰度发布运维特征的 webservice 类型的组件,并通过设置 `spec.components[0].externalRevision` 来指定组件版本名称为 express-server-v1 。如果你不指定,每次对组件的修改都会自动产生一个组件版本(ControllerRevision),组件版本名称的默认产生规则是:`<组件名>-<版本序号>`。
|
||||
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
|
@ -46,9 +36,11 @@ spec:
|
|||
- replicas: 3
|
||||
EOF
|
||||
```
|
||||
|
||||
这个灰度发布运维特征表示分两个批次发布工作负载,目标工作负载的副本个数为5个,第一批发布2个副本,第二批发布3个副本。前一批次的副本全部就绪之后,才会发布下一批次。
|
||||
|
||||
等待一段时间发布成功之后查看应用状态。
|
||||
|
||||
```shell
|
||||
$ kubectl get app rollout-trait-test
|
||||
NAME COMPONENT TYPE PHASE HEALTHY STATUS AGE
|
||||
|
@ -56,6 +48,7 @@ rollout-trait-test express-server webservice running true
|
|||
```
|
||||
|
||||
查看组件版本。
|
||||
|
||||
```shell
|
||||
$ kubectl get controllerRevision -l controller.oam.dev/component=express-server
|
||||
NAME CONTROLLER REVISION AGE
|
||||
|
@ -63,6 +56,7 @@ express-server-v1 application.core.oam.dev/rollout-trait-test 1 2d2
|
|||
```
|
||||
|
||||
查看灰度发布运维特征的状态, `ROLLING-STATE` 为 rolloutSucceed 说明发布成功,`BATCH-STATE` 为 batchReady 表明当前批次的副本已全部就绪。`TARGET` `UPGRADED` `READY` 三列说明目标的副本5个,完成升级的副本为5个,就绪的副本为5个。
|
||||
|
||||
```shell
|
||||
$ kubectl get rollout express-server
|
||||
NAME TARGET UPGRADED READY BATCH-STATE ROLLING-STATE AGE
|
||||
|
@ -70,6 +64,7 @@ express-server 5 5 5 batchReady rolloutSucceed 2d20
|
|||
```
|
||||
|
||||
查看工作负载状态( webservice/worker 的底层工作负载是 [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) )
|
||||
|
||||
```shell
|
||||
$ kubectl get deploy -l app.oam.dev/component=express-server
|
||||
NAME READY UP-TO-DATE AVAILABLE AGE
|
||||
|
@ -105,9 +100,11 @@ spec:
|
|||
- replicas: 3
|
||||
EOF
|
||||
```
|
||||
|
||||
该灰度发布运维特征表示,目标副本个数为5个,分两批升级,第一批升级2个副本,第二批升级3个副本,并通过设置 `batchPartition` 为0来指定只升级第1批的2个副本。
|
||||
|
||||
查看组件版本,可见生成了一个新的组件版本 express-server-v2。
|
||||
|
||||
```shell
|
||||
$ kubectl get controllerRevision -l controller.oam.dev/component=express-server
|
||||
NAME CONTROLLER REVISION AGE
|
||||
|
@ -116,6 +113,7 @@ express-server-v2 application.core.oam.dev/rollout-trait-test 2 1m
|
|||
```
|
||||
|
||||
一段时间之后,成功升级第一批次后,查看灰度发布运维特征的状态。 `TARGET` `UPGRADED` `READY` 表示这次升级目标版本的副本5个,已经升级完成了2个,2个已经就绪。 batchReady 状态表示当前的第1批次的副本全部就绪, rollingInBatches 状态表示还未完成全部批次的升级,仍在升级当中。
|
||||
|
||||
```shell
|
||||
$ kubectl get rollout express-server
|
||||
NAME TARGET UPGRADED READY BATCH-STATE ROLLING-STATE AGE
|
||||
|
@ -123,6 +121,7 @@ express-server 5 2 2 batchReady rollingInBatches 2d20
|
|||
```
|
||||
|
||||
查看工作负载状态进行验证,可见新版本的工作负载 express-server-v2 已经升级完成2个副本,老版本的工作负载 express-server-v1 尚有3个副本。
|
||||
|
||||
```shell
|
||||
$ kubectl get deploy -l app.oam.dev/component=express-server
|
||||
NAME READY UP-TO-DATE AVAILABLE AGE
|
||||
|
@ -131,6 +130,7 @@ express-server-v2 2/2 2 2 1m
|
|||
```
|
||||
|
||||
应用下面的 YAML 来去掉灰度发布运维特征的 `batchPartition` 字段来将全部副本升级到最新版本。
|
||||
|
||||
```shell
|
||||
cat <<EOF | kubectl apply -f -
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
|
@ -155,6 +155,7 @@ EOF
|
|||
```
|
||||
|
||||
查看灰度发布运维特征,可见已经升级成功。
|
||||
|
||||
```shell
|
||||
$ kubectl get rollout express-server
|
||||
NAME TARGET UPGRADED READY BATCH-STATE ROLLING-STATE AGE
|
||||
|
@ -162,6 +163,7 @@ express-server 5 5 5 batchReady rolloutSucceed 2d20h
|
|||
```
|
||||
|
||||
查看工作负载状态,可见新版本的工作负载已经完成升级,并且老版本的工作负载已经被删除。
|
||||
|
||||
```shell
|
||||
$ kubectl get deploy -l app.oam.dev/component=express-server
|
||||
NAME READY UP-TO-DATE AVAILABLE AGE
|
||||
|
@ -278,9 +280,11 @@ spec:
|
|||
- replicas: 3
|
||||
EOF
|
||||
```
|
||||
|
||||
这个灰度发布运维特征的表示,从刚才扩容之后的7个副本缩容至目标的3个副本,第一个批次缩容1个,第二个批次缩容3个。
|
||||
|
||||
缩容成功之后,查看资源状态。
|
||||
|
||||
```shell
|
||||
$ kubectl get rollout express-server
|
||||
NAME TARGET UPGRADED READY BATCH-STATE ROLLING-STATE AGE
|
||||
|
@ -291,9 +295,10 @@ NAME READY UP-TO-DATE AVAILABLE AGE
|
|||
express-server-v1 3/3 3 3 5m
|
||||
```
|
||||
|
||||
### cloneset 类型工作负载的灰度发布
|
||||
### 针对 cloneset 类型工作负载的灰度发布
|
||||
|
||||
启用 kruise 的扩展插件。
|
||||
|
||||
启用 kruise 的[扩展插件](./addons/introduction)。
|
||||
```shell
|
||||
$ vela addon enable kruise
|
||||
```
|
||||
|
@ -413,15 +418,21 @@ stefanprodan/podinfo:5.0.2
|
|||
|
||||
灰度发布运维特征的所有配置项
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
------------ | ------------- | ------------- | ------------- | -------------
|
||||
targetRevision|目标组件版本|string|否|当该字段为空时,一直指向组件的最新版本
|
||||
targetSize|目标副本个数|int|是|无
|
||||
rolloutBatches|批次发布策略|rolloutBatch数组|是|无
|
||||
batchPartition|发布批次|int|否|无,缺省为发布全部批次
|
||||
| 名称 | 描述 | 类型 | 是否必须 | 默认值 |
|
||||
| -------------- | ------------ | ---------------- | -------- | -------------------------------------- |
|
||||
| targetRevision | 目标组件版本 | string | 否 | 当该字段为空时,一直指向组件的最新版本 |
|
||||
| targetSize | 目标副本个数 | int | 是 | 无 |
|
||||
| rolloutBatches | 批次发布策略 | rolloutBatch数组 | 是 | 无 |
|
||||
| batchPartition | 发布批次 | int | 否 | 无,缺省为发布全部批次 |
|
||||
|
||||
rolloutBatch的属性
|
||||
|
||||
名称 | 描述 | 类型 | 是否必须 | 默认值
|
||||
------------ | ------------- | ------------- | ------------- | -------------
|
||||
replicas|批次的副本个数|int|是|无
|
||||
| 名称 | 描述 | 类型 | 是否必须 | 默认值 |
|
||||
| -------- | -------------- | ---- | -------- | ------ |
|
||||
| replicas | 批次的副本个数 | int | 是 | 无 |
|
||||
|
||||
### 支持的组件类型
|
||||
|
||||
灰度发布运维特征支持 `webservice`,`worker`,`clonset` 类型的工作负载。
|
||||
|
||||
当使用 webservice 和 worker 作为工作负载类型并配合使用灰度发布运维特征时,工作负载的名称将被命名为组件版本的名称。 当工作负载类型为 cloneset 时,由于 clonset 支持原地更新,工作负载的名称将被命名为组件的名称。
|
|
@ -189,17 +189,15 @@ sudo mv ./vela /usr/local/bin/vela
|
|||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## 4. 打开 Helm 支持
|
||||
## 4. 安装插件
|
||||
|
||||
KubeVela 调用 [Flux v2](https://github.com/fluxcd/flux2) 的 [Helm](https://helm.sh/) 控制器来部署组件系统。
|
||||
KubeVela 支持一系列[开箱即用的插件](../platform-engineers/advanced-install#插件列表),
|
||||
为保证 KubeVela 相关功能正常使用,建议您至少开启以下插件:
|
||||
|
||||
你可以通过如下命令打开这个功能:
|
||||
|
||||
```shell
|
||||
vela addon enable fluxcd
|
||||
```
|
||||
|
||||
或者你也可以通过 Flux v2 的文档来安装完整版本。
|
||||
* Helm 以及 Kustomize 组件功能插件
|
||||
```shell
|
||||
vela addon enable fluxcd
|
||||
```
|
||||
|
||||
|
||||
## 5. 验证是否安装成功
|
||||
|
@ -226,4 +224,5 @@ worker vela-system deployments.apps Describes long-running, scalable, contai
|
|||
|
||||
## 下一步
|
||||
|
||||
安装完毕 KubeVela,开始动手编写[第一个应用部署计划](./first-application)。
|
||||
* 安装完毕 KubeVela,开始动手编写[第一个应用部署计划](./first-application)。
|
||||
* 更多插件功能的安装,了解[自定义安装方式](../platform-engineers/advanced-install)安装。
|
|
@ -139,4 +139,36 @@ rm -r ~/.vela
|
|||
workflows.core.oam.dev \
|
||||
workflowstepdefinitions.core.oam.dev \
|
||||
workloaddefinitions.core.oam.dev
|
||||
```
|
||||
```
|
||||
|
||||
## 插件列表
|
||||
|
||||
| 插件 | 简介 | 对应的内置功能 | 插件对应开源项目 |
|
||||
|---------------------|-------------------------------------------------|----------------|-------------------------------------------------|
|
||||
| terraform | 提供云资源(默认已安装) | - | https://github.com/oam-dev/terraform-controller |
|
||||
| fluxcd | 提供 Helm、Kustomize 组件的部署功能 | kustomize、helm | https://fluxcd.io/ |
|
||||
| kruise | 提供比 Kubernetes 原生更强大的工作负载套件 | cloneset | https://openkruise.io/ |
|
||||
| prometheus | 提供基于 Promethus 的基础监控功能 | - | https://prometheus.io/ |
|
||||
| keda | 提供基于事件驱动的工作负载自动扩缩容功能 | - | https://keda.sh/ |
|
||||
| ocm | 提供多集群功能的系统插件 | - | http://open-cluster-management.io/ |
|
||||
| observability | 为 KubeVela core 提供系统级别的监控,也可以为应用提供业务级别的监控。 | - | - |
|
||||
|
||||
1. 查看可用的插件
|
||||
|
||||
```shell
|
||||
vela addon list
|
||||
```
|
||||
|
||||
2. 安装插件,以 fluxcd 插件为例
|
||||
|
||||
```shell
|
||||
vela addon enable fluxcd
|
||||
```
|
||||
|
||||
3. 禁用插件
|
||||
|
||||
```
|
||||
vela addon disable fluxcd
|
||||
```
|
||||
|
||||
禁用前请先清理使用插件功能的应用,否则将禁用失败。
|
||||
|
|
|
@ -74,8 +74,6 @@ spec:
|
|||
|
||||
### 利用 Helm 组件初始化环境
|
||||
|
||||
在使用 Helm 组件之前,你需要开启 `fluxcd` 这个[系统插件](../../end-user/addons/introduction)。开启 `fluxcd` 系统插件后,会自动帮你安装 helm 组件。
|
||||
|
||||
```shell
|
||||
vela addon enable fluxcd
|
||||
```
|
||||
|
|
|
@ -418,14 +418,14 @@ spec:
|
|||
|
||||
应用一经创建,KubeVela 就会为创建的资源打上一系列的标签,这些标签包含了应用的版本、名称、类型等。通过这些标准协议,应用的组件和运维能力之间就可以进行协作。具体的元数据列表如下所示:
|
||||
|
||||
| 标签 | 描述 |
|
||||
| :-------------------------------------------------: | :-------------------------------------------: |
|
||||
| `workload.oam.dev/type=<组件定义名称>` | 对应了组件定义(`ComponentDefinition`)的名字 |
|
||||
| `trait.oam.dev/type=<运维特征定义名称>` | 对应了运维特征定义(`TraitDefinition`)的名字 |
|
||||
| `app.oam.dev/name=<应用实例名称>` | 应用实例化(Application)的名称 |
|
||||
| `app.oam.dev/component=<组件实例名称>` | 组件实例化的名称 |
|
||||
| `trait.oam.dev/resource=<运维特征中输出的资源名称>` | 运维特征中输出(outputs.\<资源名称\>)的资源名称 |
|
||||
| `app.oam.dev/appRevision=<应用实例的版本名称>` | 应用实例的版本名称 |
|
||||
| 标签 | 描述 |
|
||||
| :-------------------------------------------------: | :--------------------------------------------: |
|
||||
| `workload.oam.dev/type=<组件定义名称>` | 对应了组件定义(`ComponentDefinition`)的名字 |
|
||||
| `trait.oam.dev/type=<运维特征定义名称>` | 对应了运维特征定义(`TraitDefinition`)的名字 |
|
||||
| `app.oam.dev/name=<应用实例名称>` | 应用实例化(Application)的名称 |
|
||||
| `app.oam.dev/component=<组件实例名称>` | 组件实例化的名称 |
|
||||
| `trait.oam.dev/resource=<运维特征中输出的资源名称>` | 运维特征中输出(outputs.\<资源名称\>)的资源名称 |
|
||||
| `app.oam.dev/appRevision=<应用实例的版本名称>` | 应用实例的版本名称 |
|
||||
|
||||
这些元数据可以帮助应用部署以后的运维能力正常运作,比如灰度发布组件在应用更新时根据标签进行灰度发布等,同时这些标签也保证了 KubeVela 被其他系统集成时的正确性。
|
||||
|
||||
|
@ -441,7 +441,7 @@ spec:
|
|||
| `context.name` | 在组件定义和运维特征定义中表示的是组件名称,在应用策略定义中表示的是应用策略名称 | 组件定义、运维特征定义、应用策略定义 |
|
||||
| `context.namespace` | 应用当前实例所在的命名空间 | 组件定义、运维特征定义 |
|
||||
| `context.revision` | 当前组件实例的版本名称 | 组件定义、运维特征定义 |
|
||||
| `context.parameter` | 当前组件实例的参数,可以在运维特征中获得组件的参数 | 运维特征定义 |
|
||||
| `context.parameter` | 当前组件实例的参数,可以在运维特征中获得组件的参数 | 运维特征定义 |
|
||||
| `context.output` | 当前组件实例化后的对象结构体 | 组件定义、运维特征定义 |
|
||||
| `context.outputs.<resourceName>` | 当前组件和运维特征实例化以后的结构体 | 组件定义、运维特征定义 |
|
||||
|
||||
|
@ -460,6 +460,6 @@ spec:
|
|||
[2]: ../cue/basic
|
||||
[3]: ../kube/component
|
||||
[4]: ../traits/customize-trait
|
||||
[5]: ../traits/advanced.md
|
||||
[5]: ../traits/advanced
|
||||
[6]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/
|
||||
[7]: ../cue/basic.md
|
||||
[7]: ../cue/basic
|
|
@ -8,11 +8,11 @@ title: 性能调优
|
|||
|
||||
在 KubeVela 的性能测试中,KubeVela 团队验证了在各种不同规模的场景下 KubeVela 控制器的运维能力。并给出了以下的推荐配置:
|
||||
|
||||
| 规模 | 集群节点数 | 应用数量 | Pod 数量 | concurrent-reconciles | kube-api-qps | kube-api-burst | CPU | Memory |
|
||||
| :---: | -------: | ------------: | -------: | --------------------: | :----------: | -------------: | ----: | -----: |
|
||||
| 小 | < 200 | < 3,000 | < 18,000 | 2 | 300 | 500 | 0.5 | 1Gi |
|
||||
| 中 | < 500 | < 5,000 | < 30,000 | 4 | 500 | 800 | 1 | 2Gi |
|
||||
| 大 | < 1,000 | < 12,000 | < 72,000 | 4 | 800 | 1,000 | 2 | 4Gi |
|
||||
| 规模 | 集群节点数 | 应用数量 | Pod 数量 | concurrent-reconciles | kube-api-qps | kube-api-burst | CPU | Memory |
|
||||
| :---: | ---------: | -------: | -------: | --------------------: | :----------: | -------------: | ---: | -----: |
|
||||
| 小 | < 200 | < 3,000 | < 18,000 | 2 | 300 | 500 | 0.5 | 1Gi |
|
||||
| 中 | < 500 | < 5,000 | < 30,000 | 4 | 500 | 800 | 1 | 2Gi |
|
||||
| 大 | < 1,000 | < 12,000 | < 72,000 | 4 | 800 | 1,000 | 2 | 4Gi |
|
||||
|
||||
> 上述配置中,单一应用的规模应在 2~3 个组件,5~6 个资源左右。如果您的场景下,应用普遍较大,如单个应用需要对应 20 个资源,那么您可以按照比例相应提高各项配置。
|
||||
|
||||
|
@ -25,4 +25,4 @@ title: 性能调优
|
|||
3. 新创建的应用能够获取到,但是没有状态信息。这种情况如果应用本身的内容格式没有问题,有可能是由于 KubeVela 控制器出现瓶颈,如访问 apiserver 被限流,导致吞吐量跟不上请求的速率。可以通过提高 **kube-api-qps / kube-api-burst** 来解决。如果限流不存在问题,可以检查控制器所用的 CPU 资源是否已经用满;如果 CPU 过载。则可以通过提高控制器的 CPU 资源来解决。如果 CPU 资源未使用满,但始终保持在同一负载上,有可能是线程数小于所给 CPU 数量。
|
||||
4. KubeVela 控制器本身由于内存不足频繁崩溃,可以通过给控制器提高内存量解决。
|
||||
|
||||
> 更多细节可以参考 [KubeVela 性能测试报告](/blog/kubevela-performance-test)
|
||||
> 更多细节可以参考 [KubeVela 性能测试报告](/blog/2021/08/30/kubevela-performance-test)
|
|
@ -1,245 +0,0 @@
|
|||
---
|
||||
title: 更多用法
|
||||
---
|
||||
|
||||
CUE 作为一种配置语言,可以让你在定义对象的时候使用更多进阶用法。
|
||||
|
||||
## 一次渲染多个资源
|
||||
|
||||
你可以在 `outputs` 里定义 For 循环。
|
||||
|
||||
> 注意在 For 循环里的 `parameter` 字段必须是 map 类型。
|
||||
|
||||
看看如下这个例子,在一个 `TraitDefinition` 对象里渲染多个 `Service`:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
name: expose
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
parameter: {
|
||||
http: [string]: int
|
||||
}
|
||||
|
||||
outputs: {
|
||||
for k, v in parameter.http {
|
||||
"\(k)": {
|
||||
apiVersion: "v1"
|
||||
kind: "Service"
|
||||
spec: {
|
||||
selector:
|
||||
app: context.name
|
||||
ports: [{
|
||||
port: v
|
||||
targetPort: v
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
这个运维特征可以这样使用:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: testapp
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
...
|
||||
traits:
|
||||
- type: expose
|
||||
properties:
|
||||
http:
|
||||
myservice1: 8080
|
||||
myservice2: 8081
|
||||
```
|
||||
|
||||
## 自定义运维特征里执行 HTTP Request
|
||||
|
||||
`TraitDefinition` 对象可以发送 HTTP 请求并获取应答,让你可以通过关键字 `processing` 来渲染资源。
|
||||
|
||||
你可以在 `processing.http` 里定义 HTTP 请求的 `method`, `url`, `body`, `header` 和 `trailer`,然后返回的数据将被存储在 `processing.output` 中。
|
||||
|
||||
> 请确保目标 HTTP 服务器返回的数据是 JSON 格式
|
||||
|
||||
接着,你就可以通过 `patch` 或者 `output/outputs` 里的 `processing.output` 来引用返回数据了。
|
||||
|
||||
下面是一个示例:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
name: auth-service
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
parameter: {
|
||||
serviceURL: string
|
||||
}
|
||||
|
||||
processing: {
|
||||
output: {
|
||||
token?: string
|
||||
}
|
||||
// The target server will return a JSON data with `token` as key.
|
||||
http: {
|
||||
method: *"GET" | string
|
||||
url: parameter.serviceURL
|
||||
request: {
|
||||
body?: bytes
|
||||
header: {}
|
||||
trailer: {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
patch: {
|
||||
data: token: processing.output.token
|
||||
}
|
||||
```
|
||||
|
||||
在上面这个例子中,`TraitDefinition` 对象发送请求来获取 `token` 的数据,然后将这些数据补丁给组件实例。
|
||||
|
||||
## 数据传递
|
||||
|
||||
`TraitDefinition` 对象可以读取特定 `ComponentDefinition` 对象生成的 API 资源(渲染自 `output` 和 `outputs`)。
|
||||
|
||||
> KubeVela 保证了 `ComponentDefinition` 一定会在 `TraitDefinition` 之前渲染
|
||||
|
||||
具体来说,`context.output` 字段包含了所有渲染后的工作负载 API 资源,然后 `context.outputs.<xx>` 则包含渲染后的其它类型 API 资源。
|
||||
|
||||
下面是一个数据传递的例子:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
name: worker
|
||||
spec:
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
output: {
|
||||
apiVersion: "apps/v1"
|
||||
kind: "Deployment"
|
||||
spec: {
|
||||
selector: matchLabels: {
|
||||
"app.oam.dev/component": context.name
|
||||
}
|
||||
|
||||
template: {
|
||||
metadata: labels: {
|
||||
"app.oam.dev/component": context.name
|
||||
}
|
||||
spec: {
|
||||
containers: [{
|
||||
name: context.name
|
||||
image: parameter.image
|
||||
ports: [{containerPort: parameter.port}]
|
||||
envFrom: [{
|
||||
configMapRef: name: context.name + "game-config"
|
||||
}]
|
||||
if parameter["cmd"] != _|_ {
|
||||
command: parameter.cmd
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outputs: gameconfig: {
|
||||
apiVersion: "v1"
|
||||
kind: "ConfigMap"
|
||||
metadata: {
|
||||
name: context.name + "game-config"
|
||||
}
|
||||
data: {
|
||||
enemies: parameter.enemies
|
||||
lives: parameter.lives
|
||||
}
|
||||
}
|
||||
|
||||
parameter: {
|
||||
// +usage=Which image would you like to use for your service
|
||||
// +short=i
|
||||
image: string
|
||||
// +usage=Commands to run in the container
|
||||
cmd?: [...string]
|
||||
lives: string
|
||||
enemies: string
|
||||
port: int
|
||||
}
|
||||
|
||||
|
||||
---
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
name: ingress
|
||||
spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
parameter: {
|
||||
domain: string
|
||||
path: string
|
||||
exposePort: int
|
||||
}
|
||||
// trait template can have multiple outputs in one trait
|
||||
outputs: service: {
|
||||
apiVersion: "v1"
|
||||
kind: "Service"
|
||||
spec: {
|
||||
selector:
|
||||
app: context.name
|
||||
ports: [{
|
||||
port: parameter.exposePort
|
||||
targetPort: context.output.spec.template.spec.containers[0].ports[0].containerPort
|
||||
}]
|
||||
}
|
||||
}
|
||||
outputs: ingress: {
|
||||
apiVersion: "networking.k8s.io/v1beta1"
|
||||
kind: "Ingress"
|
||||
metadata:
|
||||
name: context.name
|
||||
labels: config: context.outputs.gameconfig.data.enemies
|
||||
spec: {
|
||||
rules: [{
|
||||
host: parameter.domain
|
||||
http: {
|
||||
paths: [{
|
||||
path: parameter.path
|
||||
backend: {
|
||||
serviceName: context.name
|
||||
servicePort: parameter.exposePort
|
||||
}
|
||||
}]
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
在渲染 `worker` `ComponentDefinition` 时,具体发生了:
|
||||
1. 渲染的 `Deployment` 资源放在 `context.output` 中。
|
||||
2. 其它类型资源则放进 `context.outputs.<xx>` 中,同时 `<xx>` 是在特指 `template.outputs` 的唯一名字
|
||||
|
||||
因而,`TraitDefinition` 对象可以从 `context` 里读取渲染后的 API 资源(比如 `context.outputs.gameconfig.data.enemies` 这个字段)。
|
|
@ -1,222 +0,0 @@
|
|||
---
|
||||
title: 自定义运维特征
|
||||
---
|
||||
|
||||
|
||||
本节,我们将为作为平台管理员的你,介绍如何自定义运维特征,为用户的组件增添任何需要的运维特征能力。
|
||||
|
||||
### 开始之前
|
||||
|
||||
请先阅读和理解 [运维特征定义](../oam/x-definition.md#运维特征定义(traitdefinition))
|
||||
|
||||
### 如何使用
|
||||
|
||||
我们首先为你展示一个简单的示例,比如直接引用已有的 Kubernetes API 资源 Ingress。来编写一个下面这样的 YAML 文件:
|
||||
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
name: customize-ingress
|
||||
spec:
|
||||
definitionRef:
|
||||
name: ingresses.networking.k8s.io
|
||||
```
|
||||
|
||||
为了和我们已经内置的 ingress 有所区分,我们将其命名为 `customize-ingress`。然后我们部署到运行时集群:
|
||||
|
||||
```
|
||||
$ kubectl apply -f customize-ingress.yaml
|
||||
traitdefinition.core.oam.dev/customize-ingress created
|
||||
```
|
||||
|
||||
创建成功。这时候,你的用户可以通过 `vela traits` 查看到这个能力:
|
||||
|
||||
```
|
||||
$ vela traits
|
||||
NAME NAMESPACE APPLIES-TO CONFLICTS-WITH POD-DISRUPTIVE DESCRIPTION
|
||||
customize-ingress default false description not defined
|
||||
ingress default false description not defined
|
||||
annotations vela-system deployments.apps true Add annotations for your Workload.
|
||||
configmap vela-system deployments.apps true Create/Attach configmaps to workloads.
|
||||
cpuscaler vela-system deployments.apps false Automatically scale the component based on CPU usage.
|
||||
expose vela-system deployments.apps false Expose port to enable web traffic for your component.
|
||||
hostalias vela-system deployment.apps false Add host aliases to workloads.
|
||||
labels vela-system deployments.apps true Add labels for your Workload.
|
||||
lifecycle vela-system deployments.apps true Add lifecycle hooks to workloads.
|
||||
resource vela-system deployments.apps true Add resource requests and limits to workloads.
|
||||
rollout vela-system false rollout the component
|
||||
scaler vela-system deployments.apps false Manually scale the component.
|
||||
service-binding vela-system webservice,worker false Binding secrets of cloud resources to component env
|
||||
sidecar vela-system deployments.apps true Inject a sidecar container to the component.
|
||||
volumes vela-system deployments.apps true Add volumes for your Workload.
|
||||
```
|
||||
|
||||
最后用户只需要把这个自定义的运维特征,放入一个与之匹配的组件中进行使用即可:
|
||||
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: testapp
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
cmd:
|
||||
- node
|
||||
- server.js
|
||||
image: oamdev/testapp:v1
|
||||
port: 8080
|
||||
traits:
|
||||
- type: customize-ingress
|
||||
properties:
|
||||
rules:
|
||||
- http:
|
||||
paths:
|
||||
- path: /testpath
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: test
|
||||
port:
|
||||
number: 80
|
||||
```
|
||||
|
||||
参照上面的开发过程,你可以继续自定义其它需要的 Kubernetes 资源来提供给你的用户。
|
||||
|
||||
请注意:这种自定义运维特征的方式中,是无法设置诸如 `annotations` 这样的元信息(metadata),来作为运维特征属性的。也就是说,当你只想简单引入自己的 CRD 资源或者控制器作为运维特征时,可以遵循这种做法。
|
||||
|
||||
#### 使用 CUE 来自定义运维特征
|
||||
|
||||
我们更推荐你使用 CUE 模版来自定义运维特征。这种方法给你可以模版化任何资源和资源的灵活性。比如,我们可以组合自定义 `Service` 和 `ingeress` 成为一个运维特征来使用。
|
||||
|
||||
在用法上,你需要把所有的运维特征定义在 `outputs` 里(注意,不是 `output`),格式如下:
|
||||
|
||||
|
||||
```cue
|
||||
outputs: <unique-name>:
|
||||
<full template data>
|
||||
```
|
||||
|
||||
我们下面同样使用一个 `ingress` 和 `Service` 的示例进行讲解:
|
||||
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
name: cue-ingress
|
||||
spec:
|
||||
podDisruptive: false
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
parameter: {
|
||||
domain: string
|
||||
http: [string]: int
|
||||
}
|
||||
|
||||
// 我们可以在一个运维特征 CUE 模版定义多个 outputs
|
||||
outputs: service: {
|
||||
apiVersion: "v1"
|
||||
kind: "Service"
|
||||
metadata: {
|
||||
annotations: {
|
||||
address-type: "intranet"
|
||||
}
|
||||
}
|
||||
spec: {
|
||||
selector:
|
||||
app: context.name
|
||||
ports: [
|
||||
for k, v in parameter.http {
|
||||
port: v
|
||||
targetPort: v
|
||||
},
|
||||
]
|
||||
|
||||
type: "LoadBalancer"
|
||||
}
|
||||
}
|
||||
|
||||
outputs: ingress: {
|
||||
apiVersion: "networking.k8s.io/v1beta1"
|
||||
kind: "Ingress"
|
||||
metadata:
|
||||
name: context.name
|
||||
spec: {
|
||||
rules: [{
|
||||
host: parameter.domain
|
||||
http: {
|
||||
paths: [
|
||||
for k, v in parameter.http {
|
||||
path: k
|
||||
backend: {
|
||||
serviceName: context.name
|
||||
servicePort: v
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
可以看到,`parameter` 字段让我们可以自由自定义和传递业务参数。同时在 `metadata` 的 `annotations` 里可以标记任何你们需要的信息,我们上文的例子里标记了 `Service` 是一个给内网使用的负载均衡。
|
||||
|
||||
接下来我们把这个 cue-ingress YMAL 部署到运行时集群,成功之后用户同样可以通过 `vela traits` 命令,查看到这个新生成的运维特征:
|
||||
|
||||
```shell
|
||||
$ kubectl apply -f cue-ingress.yaml
|
||||
traitdefinition.core.oam.dev/cue-ingress created
|
||||
$ vela traits
|
||||
NAME NAMESPACE APPLIES-TO CONFLICTS-WITH POD-DISRUPTIVE DESCRIPTION
|
||||
cue-ingress default false description not defined
|
||||
ingress default false description not defined
|
||||
annotations vela-system deployments.apps true Add annotations for your Workload.
|
||||
configmap vela-system deployments.apps true Create/Attach configmaps to workloads.
|
||||
cpuscaler vela-system deployments.apps false Automatically scale the component based on CPU usage.
|
||||
expose vela-system deployments.apps false Expose port to enable web traffic for your component.
|
||||
hostalias vela-system deployment.apps false Add host aliases to workloads.
|
||||
labels vela-system deployments.apps true Add labels for your Workload.
|
||||
lifecycle vela-system deployments.apps true Add lifecycle hooks to workloads.
|
||||
resource vela-system deployments.apps true Add resource requests and limits to workloads.
|
||||
rollout vela-system false rollout the component
|
||||
scaler vela-system deployments.apps false Manually scale the component.
|
||||
service-binding vela-system webservice,worker false Binding secrets of cloud resources to component env
|
||||
sidecar vela-system deployments.apps true Inject a sidecar container to the component.
|
||||
volumes vela-system deployments.apps true Add volumes for your Workload.
|
||||
```
|
||||
|
||||
最后用户将这个运维特征放入对应组件,通过应用部署计划完成交付:
|
||||
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: testapp
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
cmd:
|
||||
- node
|
||||
- server.js
|
||||
image: oamdev/testapp:v1
|
||||
port: 8080
|
||||
traits:
|
||||
- type: cue-ingress
|
||||
properties:
|
||||
domain: test.my.domain
|
||||
http:
|
||||
"/api": 8080
|
||||
```
|
||||
|
||||
基于 CUE 的运维特征定义方式,也提供了满足于更多业务场景的用法,比如给运维特征打补丁、传递数据等等。后面的文档将进一步介绍相关内容。
|
|
@ -1,505 +0,0 @@
|
|||
---
|
||||
title: 补丁型特征
|
||||
---
|
||||
|
||||
在自定义运维特征中,使用补丁型特征是一种比较常用的形式。
|
||||
|
||||
它让我们可以修改、补丁某些属性给组件对象(一般是工作负载)来完成特定操作,比如更新 `sidecar` 和节点亲和性(node affinity)的规则(并且,这个操作一定是在资源往集群部署前就已经生效)。
|
||||
|
||||
当我们的组件是从第三方提供并自定义而来的时候,由于它们的模版往往是固定不可变的,所以能使用补丁型特征就显得尤为有用了。
|
||||
|
||||
> 尽管运维特征是由 CUE 来定义,它能打补丁的组件类型并不限,不管是来自 CUE、Helm 还是其余支持的模版格式
|
||||
|
||||
下面,我们通过一个节点亲和性(node affinity)的例子,讲解如何使用补丁型特征:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: "affinity specify node affinity and toleration"
|
||||
name: node-affinity
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
patch: {
|
||||
spec: template: spec: {
|
||||
if parameter.affinity != _|_ {
|
||||
affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: [{
|
||||
matchExpressions: [
|
||||
for k, v in parameter.affinity {
|
||||
key: k
|
||||
operator: "In"
|
||||
values: v
|
||||
},
|
||||
]}]
|
||||
}
|
||||
if parameter.tolerations != _|_ {
|
||||
tolerations: [
|
||||
for k, v in parameter.tolerations {
|
||||
effect: "NoSchedule"
|
||||
key: k
|
||||
operator: "Equal"
|
||||
value: v
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parameter: {
|
||||
affinity?: [string]: [...string]
|
||||
tolerations?: [string]: string
|
||||
}
|
||||
```
|
||||
|
||||
具体来说,我们上面的这个补丁型特征,假定了使用它的组件对象将会使用 `spec.template.spec.affinity` 这个字段。因此,我们需要用 `appliesToWorkloads` 来指明,让当前运维特征被应用到拥有这个字段的对应工作负载实例上。
|
||||
|
||||
另一个重要的字段是 `podDisruptive`,这个补丁型特征将修改 Pod 模板字段,因此对该运维特征的任何字段进行更改,都会导致 Pod 重启。我们应该增加 `podDisruptive` 并且设置它的值为 true,以此告诉用户这个运维特征生效后将导致 Pod 重新启动。
|
||||
|
||||
现在用户只需要,声明他们希望增加一个节点亲和性的规则到组件实例当中:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: Application
|
||||
metadata:
|
||||
name: testapp
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: oamdev/testapp:v1
|
||||
traits:
|
||||
- type: "node-affinity"
|
||||
properties:
|
||||
affinity:
|
||||
server-owner: ["owner1","owner2"]
|
||||
resource-pool: ["pool1","pool2","pool3"]
|
||||
tolerations:
|
||||
resource-pool: "broken-pool1"
|
||||
server-owner: "old-owner"
|
||||
```
|
||||
|
||||
### 待解决的短板
|
||||
|
||||
默认来说,补丁型特征是通过 CUE 的 `merge` 操作来实现的。它有以下限制:
|
||||
|
||||
- 不能处理有冲突的字段名
|
||||
- 比方说,在一个组件实例中已经设置过这样的值 `replicas=5`,那一旦有运维特征实例,尝试给 `replicas` 字段的值打补丁就会失败。所以我们建议你提前规划好,不要在组件和运维特征之间使用重复的字段名。
|
||||
- 数组列表被补丁时,会按索引顺序进行合并。如果数组里出现了重复的值,将导致问题。为了规避这个风险,请查询后面的解决方案。
|
||||
|
||||
### 策略补丁
|
||||
|
||||
策略补丁,通过增加注解(annotation)而生效,并支持如下两种模式。
|
||||
|
||||
> 请注意,这里开始并不是 CUE 官方提供的功能, 而是 KubeVela 扩展开发而来
|
||||
|
||||
#### 1. 使用 `+patchKey=<key_name>` 注解
|
||||
|
||||
这个注解,是给数组列表打补丁用的。它的执行方式也不遵循 CUE 官方的方式,而是将每一个数组列表视作对象,并执行如下的策略:
|
||||
- 如果发现重复的键名,补丁数据会直接替换掉它的值
|
||||
- 如果没有重复键名,补丁则会自动附加这些数据
|
||||
|
||||
下面来看看,一个使用 'patchKey' 的策略补丁:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: "add sidecar to the app"
|
||||
name: sidecar
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
patch: {
|
||||
// +patchKey=name
|
||||
spec: template: spec: containers: [parameter]
|
||||
}
|
||||
parameter: {
|
||||
name: string
|
||||
image: string
|
||||
command?: [...string]
|
||||
}
|
||||
```
|
||||
在上述的这个例子中,我们定义了要 `patchKey` 的字段 `name`,是来自容器的参数键名。如果工作负载中并没有同名的容器,那么一个 sidecar 容器就会被加到 `spec.template.spec.containers` 数组列表中。如果工作负载中有重名的 `sidecar` 运维特征,则会执行 merge 操作而不是附加。
|
||||
|
||||
如果 `patch` 和 `outputs` 同时存在于一个运维特征定义中,`patch` 会率先被执行然后再渲染 `outputs`。
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: "expose the app"
|
||||
name: expose
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
patch: {spec: template: metadata: labels: app: context.name}
|
||||
outputs: service: {
|
||||
apiVersion: "v1"
|
||||
kind: "Service"
|
||||
metadata: name: context.name
|
||||
spec: {
|
||||
selector: app: context.name
|
||||
ports: [
|
||||
for k, v in parameter.http {
|
||||
port: v
|
||||
targetPort: v
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
http: [string]: int
|
||||
}
|
||||
```
|
||||
在上面这个运维特征定义中,我们将会把一个 `Service` 添加到给定的组件实例上。同时会先去给工作负载类型打上补丁数据,然后基于模版里的 `outputs` 渲染余下的资源。
|
||||
|
||||
#### 2. 使用 `+patchStrategy=retainkeys` 注解
|
||||
|
||||
这个注解的策略,与 Kubernetes 官方的 [retainkeys](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/#use-strategic-merge-patch-to-update-a-deployment-using-the-retainkeys-strategy) 策略类似。
|
||||
|
||||
在一些场景下,整个对象需要被一起替换掉,使用 `retainkeys` 就是最适合的办法。
|
||||
|
||||
假定一个 `Deployment` 对象是这样编写的:
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: retainkeys-demo
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: nginx
|
||||
strategy:
|
||||
type: rollingUpdate
|
||||
rollingUpdate:
|
||||
maxSurge: 30%
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: retainkeys-demo-ctr
|
||||
image: nginx
|
||||
```
|
||||
|
||||
现在如果我们想替换掉 `rollingUpdate` 策略,你可以这样写:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
name: recreate
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
extension:
|
||||
template: |-
|
||||
patch: {
|
||||
spec: {
|
||||
// +patchStrategy=retainKeys
|
||||
strategy: type: "Recreate"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
这个 YAML 资源将变更为:
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: retainkeys-demo
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: nginx
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: retainkeys-demo-ctr
|
||||
image: nginx
|
||||
```
|
||||
## 更多补丁型特征的使用场景
|
||||
|
||||
补丁型特征,针对组件层面做些整体操作时,非常有用。我们看看还可以满足哪些需求:
|
||||
|
||||
### 增加标签
|
||||
|
||||
比如说,我们要给组件实例打上 `virtualgroup` 的通用标签。
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: "Add virtual group labels"
|
||||
name: virtualgroup
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
patch: {
|
||||
spec: template: {
|
||||
metadata: labels: {
|
||||
if parameter.scope == "namespace" {
|
||||
"app.namespace.virtual.group": parameter.group
|
||||
}
|
||||
if parameter.scope == "cluster" {
|
||||
"app.cluster.virtual.group": parameter.group
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
group: *"default" | string
|
||||
scope: *"namespace" | string
|
||||
}
|
||||
```
|
||||
|
||||
然后这样用就可以了:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
spec:
|
||||
...
|
||||
traits:
|
||||
- type: virtualgroup
|
||||
properties:
|
||||
group: "my-group1"
|
||||
scope: "cluster"
|
||||
```
|
||||
|
||||
### 增加注解
|
||||
|
||||
与通用标签类似,你也可以给组件实例打补丁,增加一些注解。注解的格式,必须是 JSON。
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: "Specify auto scale by annotation"
|
||||
name: kautoscale
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
podDisruptive: false
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
import "encoding/json"
|
||||
|
||||
patch: {
|
||||
metadata: annotations: {
|
||||
"my.custom.autoscale.annotation": json.Marshal({
|
||||
"minReplicas": parameter.min
|
||||
"maxReplicas": parameter.max
|
||||
})
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
min: *1 | int
|
||||
max: *3 | int
|
||||
}
|
||||
```
|
||||
|
||||
### 增加 Pod 环境变量
|
||||
|
||||
给 Pod 去注入环境变量也是非常常见的操作。
|
||||
|
||||
> 这种使用方式依赖策略补丁而生效, 所以记得加上 `+patchKey=name`
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: "add env into your pods"
|
||||
name: env
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
patch: {
|
||||
spec: template: spec: {
|
||||
// +patchKey=name
|
||||
containers: [{
|
||||
name: context.name
|
||||
// +patchKey=name
|
||||
env: [
|
||||
for k, v in parameter.env {
|
||||
name: k
|
||||
value: v
|
||||
},
|
||||
]
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
parameter: {
|
||||
env: [string]: string
|
||||
}
|
||||
```
|
||||
|
||||
### 基于外部鉴权服务注入 `ServiceAccount`
|
||||
|
||||
在这个场景下,service-account 是从一个鉴权服务中动态获取、再通过打补丁给到应用的。
|
||||
|
||||
我们这里展示的是,将 UID token 放进 `HTTP header` 的例子。你也可以用 `HTTP body` 来完成需求。
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: "dynamically specify service account"
|
||||
name: service-account
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
processing: {
|
||||
output: {
|
||||
credentials?: string
|
||||
}
|
||||
http: {
|
||||
method: *"GET" | string
|
||||
url: parameter.serviceURL
|
||||
request: {
|
||||
header: {
|
||||
"authorization.token": parameter.uidtoken
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
patch: {
|
||||
spec: template: spec: serviceAccountName: processing.output.credentials
|
||||
}
|
||||
|
||||
parameter: {
|
||||
uidtoken: string
|
||||
serviceURL: string
|
||||
}
|
||||
```
|
||||
|
||||
### 增加 `InitContainer`
|
||||
|
||||
[`InitContainer`](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-initialization/#create-a-pod-that-has-an-init-container) 常用于预定义镜像内的操作,并且在承载应用的容器运行前就跑起来。
|
||||
|
||||
看看示例:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: "add an init container and use shared volume with pod"
|
||||
name: init-container
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
patch: {
|
||||
spec: template: spec: {
|
||||
// +patchKey=name
|
||||
containers: [{
|
||||
name: context.name
|
||||
// +patchKey=name
|
||||
volumeMounts: [{
|
||||
name: parameter.mountName
|
||||
mountPath: parameter.appMountPath
|
||||
}]
|
||||
}]
|
||||
initContainers: [{
|
||||
name: parameter.name
|
||||
image: parameter.image
|
||||
if parameter.command != _|_ {
|
||||
command: parameter.command
|
||||
}
|
||||
|
||||
// +patchKey=name
|
||||
volumeMounts: [{
|
||||
name: parameter.mountName
|
||||
mountPath: parameter.initMountPath
|
||||
}]
|
||||
}]
|
||||
// +patchKey=name
|
||||
volumes: [{
|
||||
name: parameter.mountName
|
||||
emptyDir: {}
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
parameter: {
|
||||
name: string
|
||||
image: string
|
||||
command?: [...string]
|
||||
mountName: *"workdir" | string
|
||||
appMountPath: string
|
||||
initMountPath: string
|
||||
}
|
||||
```
|
||||
|
||||
用法像这样:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: testapp
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: oamdev/testapp:v1
|
||||
traits:
|
||||
- type: "init-container"
|
||||
properties:
|
||||
name: "install-container"
|
||||
image: "busybox"
|
||||
command:
|
||||
- wget
|
||||
- "-O"
|
||||
- "/work-dir/index.html"
|
||||
- http://info.cern.ch
|
||||
mountName: "workdir"
|
||||
appMountPath: "/usr/share/nginx/html"
|
||||
initMountPath: "/work-dir"
|
||||
```
|
|
@ -1,130 +0,0 @@
|
|||
---
|
||||
title: 状态回写
|
||||
---
|
||||
|
||||
本文档将为你讲解,如何通过 CUE 模版在定义对象时实现状态回写。
|
||||
|
||||
## 健康检查
|
||||
|
||||
不管是组件定义中,还是运维特征定义中,健康检查对应的配置项都是 `spec.status.healthPolicy`。如果没有定义,它的值默认是 `true`。
|
||||
|
||||
在 CUE 里的关键词是 `isHealth`,CUE 表达式结果必须是 `bool` 类型。
|
||||
KubeVela 运行时会一直检查 CUE 表达式,直至其状态显示为健康。每次控制器都会获取所有的 Kubernetes 资源,并将他们填充到 context 字段中。
|
||||
|
||||
所以 context 字段会包含如下信息:
|
||||
|
||||
```cue
|
||||
context:{
|
||||
name: <component name>
|
||||
appName: <app name>
|
||||
output: <Kubernetes workload resource>
|
||||
outputs: {
|
||||
<resource1>: <Kubernetes trait resource1>
|
||||
<resource2>: <Kubernetes trait resource2>
|
||||
}
|
||||
}
|
||||
```
|
||||
`Trait` 对象,没有 `context.output` 这个字段,其它字段相同。
|
||||
|
||||
我们看看健康检查的例子:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: ComponentDefinition
|
||||
spec:
|
||||
status:
|
||||
healthPolicy: |
|
||||
isHealth: (context.output.status.readyReplicas > 0) && (context.output.status.readyReplicas == context.output.status.replicas)
|
||||
...
|
||||
```
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
spec:
|
||||
status:
|
||||
healthPolicy: |
|
||||
isHealth: len(context.outputs.service.spec.clusterIP) > 0
|
||||
...
|
||||
```
|
||||
|
||||
健康检查的结果将会记录到 `Application` 对象中。
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
spec:
|
||||
components:
|
||||
- name: myweb
|
||||
type: worker
|
||||
properties:
|
||||
cmd:
|
||||
- sleep
|
||||
- "1000"
|
||||
enemies: alien
|
||||
image: busybox
|
||||
lives: "3"
|
||||
traits:
|
||||
- type: ingress
|
||||
properties:
|
||||
domain: www.example.com
|
||||
http:
|
||||
/: 80
|
||||
status:
|
||||
...
|
||||
services:
|
||||
- healthy: true
|
||||
message: "type: busybox,\t enemies:alien"
|
||||
name: myweb
|
||||
traits:
|
||||
- healthy: true
|
||||
message: 'Visiting URL: www.example.com, IP: 47.111.233.220'
|
||||
type: ingress
|
||||
status: running
|
||||
```
|
||||
|
||||
## 自定义状态
|
||||
|
||||
不管是组件定义中,还是运维特征定义中,自定义状态对应的配置项都是 `spec.status.customStatus`。
|
||||
|
||||
在 CUE 中的关键词是 `message`。同时,CUE 表达式的结果必须是 `string` 类型。
|
||||
|
||||
自定义状态和健康检查的原理一致。`Application` 对象的 CRD 控制器都会检查 CUE 表达式,直至显示健康通过。
|
||||
|
||||
context 字段包含如下信息:
|
||||
|
||||
```cue
|
||||
context:{
|
||||
name: <component name>
|
||||
appName: <app name>
|
||||
output: <Kubernetes workload resource>
|
||||
outputs: {
|
||||
<resource1>: <Kubernetes trait resource1>
|
||||
<resource2>: <Kubernetes trait resource2>
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
`Trait` 对象不会有 `context.output` 这个字段, 其它字段一致.
|
||||
|
||||
查看示例:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: ComponentDefinition
|
||||
spec:
|
||||
status:
|
||||
customStatus: |-
|
||||
message: "type: " + context.output.spec.template.spec.containers[0].image + ",\t enemies:" + context.outputs.gameconfig.data.enemies
|
||||
...
|
||||
```
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
spec:
|
||||
status:
|
||||
customStatus: |-
|
||||
message: "type: "+ context.outputs.service.spec.type +",\t clusterIP:"+ context.outputs.service.spec.clusterIP+",\t ports:"+ "\(context.outputs.service.spec.ports[0].port)"+",\t domain"+context.outputs.ingress.spec.rules[0].host
|
||||
...
|
||||
```
|
|
@ -65,4 +65,4 @@ KubeVela 是一个 Kubernetes 插件,用于构建更高级别的抽象。它
|
|||
|
||||
## 入门
|
||||
|
||||
现在,让我们[开始](./quick-start.md)使用 KubeVela!
|
||||
现在,让我们[开始](./quick-start)使用 KubeVela!
|
||||
|
|
37
sidebars.js
37
sidebars.js
|
@ -40,10 +40,10 @@ module.exports = {
|
|||
},
|
||||
{
|
||||
'CUE Component': [
|
||||
'end-user/components/cue/raw',
|
||||
'end-user/components/cue/task',
|
||||
'end-user/components/cue/webservice',
|
||||
'end-user/components/cue/worker',
|
||||
'end-user/components/cue/task',
|
||||
'end-user/components/cue/raw',
|
||||
]
|
||||
},
|
||||
'end-user/components/more',
|
||||
|
@ -52,9 +52,9 @@ module.exports = {
|
|||
|
||||
{
|
||||
'Traits': [
|
||||
'end-user/traits/autoscaler',
|
||||
'end-user/traits/ingress',
|
||||
'end-user/traits/manual-scaler',
|
||||
'end-user/traits/rollout',
|
||||
'end-user/traits/autoscaler',
|
||||
'end-user/traits/kustomize-patch',
|
||||
'end-user/traits/annotations-and-labels',
|
||||
'end-user/traits/service-binding',
|
||||
|
@ -86,13 +86,12 @@ module.exports = {
|
|||
'end-user/policies/envbinding',
|
||||
]
|
||||
},
|
||||
// {
|
||||
// 'Workflow': [
|
||||
// 'end-user/workflow/apply-component',
|
||||
// 'end-user/workflow/apply-remaining',
|
||||
// 'end-user/workflow/multi-env',
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
'Workflow': [
|
||||
'end-user/workflow/multi-env',
|
||||
'end-user/workflow/webhook-notification',
|
||||
]
|
||||
},
|
||||
{
|
||||
'Debugging': [
|
||||
// 'end-user/debug/health',
|
||||
|
@ -123,17 +122,11 @@ module.exports = {
|
|||
'platform-engineers/cue/advanced',
|
||||
]
|
||||
},
|
||||
// {
|
||||
// 'Environment System': [
|
||||
// 'platform-engineers/initializer/basic-initializer',
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
'Addons': [
|
||||
'end-user/addons/introduction',
|
||||
// 'end-user/addons/fluxcd', 这个应该整体放在 reference 文档里去。它的使用方式,只需要在 helm 组件和 Kustomize 组件使用是 refer 即可。
|
||||
]
|
||||
},
|
||||
//{
|
||||
// 'Environment System': [
|
||||
// 'platform-engineers/initializer/basic-initializer',
|
||||
// ]
|
||||
//},
|
||||
{
|
||||
type: 'category',
|
||||
label: 'Component System',
|
||||
|
|
|
@ -132,7 +132,7 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/mast
|
|||
|
||||
KubeVela CLI gives you a simplified workflow to manage applications with optimized output. It is not mandatory though.
|
||||
|
||||
KubeVela CLI could be [installed as kubectl plugin](./kubectl-plugin.mdx), or install as standalone binary.
|
||||
KubeVela CLI could be [installed as kubectl plugin](./kubectl-plugin), or install as standalone binary.
|
||||
|
||||
<Tabs
|
||||
className="unique-tabs"
|
||||
|
|
Loading…
Reference in New Issue