Skip to main content
版本:v1.1

快速安装

如果是要升级现有的 KubeVela,请直接阅读升级指南.

1.2 版本已发布,欢迎试用。去安装

1. 选择放置控制平面的集群

确保:

  • Kubernetes 集群版本 >= v1.18.0
  • 安装并配置 kubectl 命令行工具

KubeVela 得以成为控制平面,主要是依赖 Kubernetes 。它可以放置在任何托管 Kubernetes 作为底座的产品或你自己的集群中。

你可以使用 kind 或 minikube 在本地部署、测试 KubeVela,或者使用云厂商提供的 Kubernetes 服务做生产部署。

安装 Kind 命令行工具后,创建集群:

cat <<EOF | kind create cluster --image=kindest/node:v1.18.15 --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
EOF

安装 ingress 启用路由访问功能:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml

2. 安装 KubeVela

在安装之前,请确保 Helm 工具是可用的,如未安装,请参考 安装说明 安装完成。

如果你的网络情况很难下载成功 Helm,请点击使用国内镜像来安装(仅适用于 linux-amd64)
wget https://static.kubevela.net/binary/helm/helm-v3.7.0-linux-amd64 -O /usr/bin/helm
chmod +x /usr/bin/helm
  1. 添加并更新 KubeVela Helm chart 仓库
helm repo add kubevela https://charts.kubevela.net/core
helm repo update
  1. 安装 KubeVela
helm install --create-namespace -n vela-system kubevela kubevela/vela-core --set multicluster.enabled=true --wait

你可以参考 自定义安装 获取更多安装模式和功能。

  1. 验证 chart 安装是否成功

    helm test kubevela -n vela-system
    点击查看期望输出
    Pod kubevela-application-test pending
    Pod kubevela-application-test pending
    Pod kubevela-application-test running
    Pod kubevela-application-test succeeded
    NAME: kubevela
    LAST DEPLOYED: Tue Apr 13 18:42:20 2021
    NAMESPACE: vela-system
    STATUS: deployed
    REVISION: 1
    TEST SUITE: kubevela-application-test
    Last Started: Fri Apr 16 20:49:10 2021
    Last Completed: Fri Apr 16 20:50:04 2021
    Phase: Succeeded
    TEST SUITE: first-vela-app
    Last Started: Fri Apr 16 20:49:10 2021
    Last Completed: Fri Apr 16 20:49:10 2021
    Phase: Succeeded
    NOTES:
    Welcome to use the KubeVela! Enjoy your shipping application journey!

3. 【可选】安装 KubeVela CLI

KubeVela CLI 可以让你更便捷地来管理应用交付。不过,它不是必须使用的。

KubeVela CLI 也可以通过 kubectl plugin 的方式来安装,或者通过二进制文件.

macOS/Linux

curl -fsSl https://kubevela.io/script/install.sh | bash

Windows

powershell -Command "iwr -useb https://kubevela.io/script/install.ps1 | iex"

4. 【可选】安装插件

KubeVela 支持一系列开箱即用的插件,建议你至少开启以下插件:

  • Helm 以及 Kustomize 组件功能插件

    vela addon enable fluxcd
  • Terraform 插件

    vela addon enable terraform
  • 阿里云 Terraform Provider 插件

    执行如下命令开启 Terraform 对阿里云的支持,可以创建和消费云资源

    其中,请参考如何获取 Access Key设置 Access Key,参考 Region 列表 中的 RegionId 设置 ALICLOUD_REGION。 参数 ALICLOUD_SECURITY_TOKEN 是可选的,你可以通过 这篇介绍 设置。

    vela addon enable terraform/provider-alibaba ALICLOUD_ACCESS_KEY=<xxx> ALICLOUD_SECRET_KEY=<yyy> ALICLOUD_REGION=<region>
  • Azure Terraform Provider 插件

    执行如下命令开启 Terraform 对 Azure 的支持,可以创建和消费云资源

    参考 Authenticate Terraform to Azure,设置如下参数。

    vela addon enable terraform/provider-azure ARM_CLIENT_ID=<aaa> ARM_CLIENT_SECRET=<bbb> ARM_SUBSCRIPTION_ID=<ccc> ARM_TENANT_ID=<ddd>
  • AWS Terraform Provider 插件

    执行如下命令开启 Terraform 对 AWS 的支持,可以创建和消费云资源

    参考 Authenticate Terraform to AWS,设置如下参数。

    vela addon enable terraform/provider-aws AWS_ACCESS_KEY_ID=<aaa> AWS_SECRET_ACCESS_KEY=<bbb> AWS_DEFAULT_REGION=<region>

5. 查看已安装能力

如果没安装 vela 命令行工具,你也可以通过 kubectl get comp -Akubectl get trait -A 代替.

  • 通过 vela CLI 来看看有哪些组件类型:

    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.
  • 通过 vela CLI 来看看有哪些运维功能:

    vela traits
    查看输出
    NAME                        NAMESPACE   APPLIES-TO          CONFLICTS-WITH  POD-DISRUPTIVE  DESCRIPTION
    annotations vela-system * true Add annotations on K8s pod for your workload which follows
    the pod spec in path 'spec.template'.
    configmap vela-system * true Create/Attach configmaps on K8s pod for your workload which
    follows the pod spec in path 'spec.template'.
    cpuscaler vela-system deployments.apps false Automatically scale the component based on CPU usage.
    env vela-system * false add env on K8s pod for your workload which follows the pod
    spec in path 'spec.template.'
    expose vela-system false Expose port to enable web traffic for your component.
    hostalias vela-system * false Add host aliases on K8s pod for your workload which follows
    the pod spec in path 'spec.template'.
    ingress vela-system false Enable public web traffic for the component.
    ingress-1-20 vela-system false Enable public web traffic for the component, the ingress API
    matches K8s v1.20+.
    init-container vela-system deployments.apps true add an init container and use shared volume with pod
    kustomize-json-patch vela-system false A list of JSON6902 patch to selected target
    kustomize-patch vela-system false A list of StrategicMerge or JSON6902 patch to selected
    target
    kustomize-strategy-merge vela-system false A list of strategic merge to kustomize config
    labels vela-system * true Add labels on K8s pod for your workload which follows the
    pod spec in path 'spec.template'.
    lifecycle vela-system * true Add lifecycle hooks for the first container of K8s pod for
    your workload which follows the pod spec in path
    'spec.template'.
    node-affinity vela-system * true affinity specify node affinity and toleration on K8s pod for
    your workload which follows the pod spec in path
    'spec.template'.
    pvc vela-system deployments.apps true Create a Persistent Volume Claim and mount the PVC as volume
    to the first container in the pod
    resource vela-system * true Add resource requests and limits on K8s pod for your
    workload which follows the pod spec in path 'spec.template.'
    rollout vela-system false rollout the component
    scaler vela-system * false Manually scale K8s pod for your workload which follows the
    pod spec in path 'spec.template'.
    service-binding vela-system webservice,worker false Binding secrets of cloud resources to component env
    sidecar vela-system * true Inject a sidecar container to K8s pod for your workload
    which follows the pod spec in path 'spec.template'.
    volumes vela-system deployments.apps true Add volumes on K8s pod for your workload which follows the
    pod spec in path 'spec.template'.

以上的这些能力都是已经内置的,随取随用。而由于 KubeVela 从一开始就被设计成可编程的,你可以按玩乐高积木一样,添加任何你需要的功能。

下一步