Version: v1.1

快速安装

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

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

确保:

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

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

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

  • Kind
  • RKE
  • Minikube
  • Cloud Provider

安装 minikube 后,创建一个集群:

  1. minikube start

安装 ingress 启用路由访问功能

  1. minikube addons enable ingress

(1)安装 Docker (可选):

RKE 的安装依赖于 Docker, 如未安装,请参考 Docker 安装指南.

(2)安装 RKE 命令行:

下载 RKE 二进制文件, 前往RKE Release页面.

如果你的网络受限无法下载(特别是中国用户),可直接使用下述方式安装:

  1. wget https://static.kubevela.net/binary/rke/rke_linux-amd64 -O /usr/bin/rke
  2. chmod +x /usr/bin/rke

(3)安装 Kubernetes 集群:

  1. mkdir ~/rkeinit && cd ~/rkeinit
  2. # 引导式配置,可参考 [RKE集群配置说明文档](https://rancher.com/docs/rke/latest/en/example-yamls/)。
  3. rke config
  4. # 安装集群
  5. rke up
  6. # 安装 Kubectl 命令行工具
  7. mkdir ~/.kube
  8. cp kube_config_cluster.yml ~/.kube/config
  9. docker cp kubelet:/usr/local/bin/kubectl /usr/local/bin/kubectl

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

  1. cat <<EOF | kind create cluster --image=kindest/node:v1.18.15 --config=-
  2. kind: Cluster
  3. apiVersion: kind.x-k8s.io/v1alpha4
  4. nodes:
  5. - role: control-plane
  6. kubeadmConfigPatches:
  7. - |
  8. kind: InitConfiguration
  9. nodeRegistration:
  10. kubeletExtraArgs:
  11. node-labels: "ingress-ready=true"
  12. extraPortMappings:
  13. - containerPort: 80
  14. hostPort: 80
  15. protocol: TCP
  16. - containerPort: 443
  17. hostPort: 443
  18. protocol: TCP
  19. EOF

安装 ingress 启用路由访问功能

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

注意: 请确保云厂商的集群已安装或启用 ingress-nginx 以保证路由访问功能可正常使用。

2. 安装 KubeVela

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

如果你的网络受限无法下载(特别是中国用户),可直接使用下述方式安装:

  1. wget https://static.kubevela.net/binary/helm/helm-v3.7.0-linux-amd64 -O /usr/bin/helm
  2. chmod +x /usr/bin/helm

该安装方式仅适用于 linux-amd64

  1. 添加并更新 KubeVela helm chart 仓库

    1. helm repo add kubevela https://charts.kubevela.net/core
    2. helm repo update
  2. 安装 KubeVela

    1. helm install --create-namespace -n vela-system kubevela kubevela/vela-core --set multicluster.enabled=true --wait

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

  3. 验证 chart 安装是否成功

    1. helm test kubevela -n vela-system

    点击查看期望输出

    1. Pod kubevela-application-test pending
    2. Pod kubevela-application-test pending
    3. Pod kubevela-application-test running
    4. Pod kubevela-application-test succeeded
    5. NAME: kubevela
    6. LAST DEPLOYED: Tue Apr 13 18:42:20 2021
    7. NAMESPACE: vela-system
    8. STATUS: deployed
    9. REVISION: 1
    10. TEST SUITE: kubevela-application-test
    11. Last Started: Fri Apr 16 20:49:10 2021
    12. Last Completed: Fri Apr 16 20:50:04 2021
    13. Phase: Succeeded
    14. TEST SUITE: first-vela-app
    15. Last Started: Fri Apr 16 20:49:10 2021
    16. Last Completed: Fri Apr 16 20:49:10 2021
    17. Phase: Succeeded
    18. NOTES:
    19. Welcome to use the KubeVela! Enjoy your shipping application journey!

3. 【可选】安装 KubeVela CLI

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

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

  • Script
  • Homebrew
  • Download directly from releases

macOS/Linux

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

Windows

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

macOS/Linux

先更新下你的 brew

  1. brew update

紧接着安装 KubeVela

  1. brew install kubevela
  • 通过发布日志下载最新的 vela 二进制文件。
  • 解压二进制文件,并且在 $PATH 中配好环境变量,就搞定啦。
  1. sudo mv ./vela /usr/local/bin/vela

安装提示: 如果你使用的是 Mac 系统,它会弹出 “vela” 无法打开的警告,因为来自开发者的包无法验证。

MacOS 对能够在系统中运行的软件,采取了更加严格的限制。你暂时可以通过打开 ‘System Preference’ -> ‘Security & Privacy’ -> General 并点击 ‘Allow Anyway’ 来解决这个问题。

4. 【可选】安装插件

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

  • Helm 以及 Kustomize 组件功能插件

    1. vela addon enable fluxcd
  • Terraform 插件

    1. vela addon enable terraform
  • Terraform Provider 插件

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

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

    1. vela addon enable terraform/provider-alibaba ALICLOUD_ACCESS_KEY=<xxx> ALICLOUD_SECRET_KEY=<yyy> ALICLOUD_REGION=<region>

5. 查看已安装能力

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

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

    1. vela components

    查看输出

    1. NAME NAMESPACE WORKLOAD DESCRIPTION
    2. alibaba-ack vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud ACK cluster
    3. alibaba-oss vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud OSS object
    4. alibaba-rds vela-system configurations.terraform.core.oam.dev Terraform configuration for Alibaba Cloud RDS object
    5. helm vela-system autodetects.core.oam.dev helm release is a group of K8s resources from either git
    6. repository or helm repo
    7. kustomize vela-system autodetects.core.oam.dev kustomize can fetching, building, updating and applying
    8. Kustomize manifests from git repo.
    9. raw vela-system autodetects.core.oam.dev raw allow users to specify raw K8s object in properties
    10. task vela-system jobs.batch Describes jobs that run code or a script to completion.
    11. webservice vela-system deployments.apps Describes long-running, scalable, containerized services
    12. that have a stable network endpoint to receive external
    13. network traffic from customers.
    14. worker vela-system deployments.apps Describes long-running, scalable, containerized services
    15. that running at backend. They do NOT have network endpoint
    16. to receive external network traffic.
  • 通过 vela CLI 来看看有哪些运维功能:

    1. vela traits

    查看输出

    1. NAME NAMESPACE APPLIES-TO CONFLICTS-WITH POD-DISRUPTIVE DESCRIPTION
    2. annotations vela-system * true Add annotations on K8s pod for your workload which follows
    3. the pod spec in path 'spec.template'.
    4. configmap vela-system * true Create/Attach configmaps on K8s pod for your workload which
    5. follows the pod spec in path 'spec.template'.
    6. cpuscaler vela-system deployments.apps false Automatically scale the component based on CPU usage.
    7. env vela-system * false add env on K8s pod for your workload which follows the pod
    8. spec in path 'spec.template.'
    9. expose vela-system false Expose port to enable web traffic for your component.
    10. hostalias vela-system * false Add host aliases on K8s pod for your workload which follows
    11. the pod spec in path 'spec.template'.
    12. ingress vela-system false Enable public web traffic for the component.
    13. ingress-1-20 vela-system false Enable public web traffic for the component, the ingress API
    14. matches K8s v1.20+.
    15. init-container vela-system deployments.apps true add an init container and use shared volume with pod
    16. kustomize-json-patch vela-system false A list of JSON6902 patch to selected target
    17. kustomize-patch vela-system false A list of StrategicMerge or JSON6902 patch to selected
    18. target
    19. kustomize-strategy-merge vela-system false A list of strategic merge to kustomize config
    20. labels vela-system * true Add labels on K8s pod for your workload which follows the
    21. pod spec in path 'spec.template'.
    22. lifecycle vela-system * true Add lifecycle hooks for the first container of K8s pod for
    23. your workload which follows the pod spec in path
    24. 'spec.template'.
    25. node-affinity vela-system * true affinity specify node affinity and toleration on K8s pod for
    26. your workload which follows the pod spec in path
    27. 'spec.template'.
    28. pvc vela-system deployments.apps true Create a Persistent Volume Claim and mount the PVC as volume
    29. to the first container in the pod
    30. resource vela-system * true Add resource requests and limits on K8s pod for your
    31. workload which follows the pod spec in path 'spec.template.'
    32. rollout vela-system false rollout the component
    33. scaler vela-system * false Manually scale K8s pod for your workload which follows the
    34. pod spec in path 'spec.template'.
    35. service-binding vela-system webservice,worker false Binding secrets of cloud resources to component env
    36. sidecar vela-system * true Inject a sidecar container to K8s pod for your workload
    37. which follows the pod spec in path 'spec.template'.
    38. volumes vela-system deployments.apps true Add volumes on K8s pod for your workload which follows the
    39. pod spec in path 'spec.template'.

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

下一步