Version: v1.1
快速安装
如果是要升级现有的 KubeVela,请直接阅读升级指南.
1. 选择放置控制平面的集群
确保:
- Kubernetes 集群版本 >= v1.18.0
- 安装并配置 kubectl 命令行工具
KubeVela 得以成为控制平面,主要是依赖 Kubernetes 。它可以放置在任何托管 Kubernetes 作为底座的产品或你自己的集群中。
你可以使用 kind 或 minikube 在本地部署、测试 KubeVela,或者使用云厂商提供的 Kubernetes 服务做生产部署。
- Kind
- RKE
- Minikube
- Cloud Provider
安装 minikube 后,创建一个集群:
minikube start
安装 ingress 启用路由访问功能
minikube addons enable ingress
(1)安装 Docker (可选):
RKE 的安装依赖于 Docker, 如未安装,请参考 Docker 安装指南.
(2)安装 RKE 命令行:
下载 RKE 二进制文件, 前往RKE Release页面.
如果你的网络受限无法下载(特别是中国用户),可直接使用下述方式安装:
wget https://static.kubevela.net/binary/rke/rke_linux-amd64 -O /usr/bin/rke
chmod +x /usr/bin/rke
(3)安装 Kubernetes 集群:
mkdir ~/rkeinit && cd ~/rkeinit
# 引导式配置,可参考 [RKE集群配置说明文档](https://rancher.com/docs/rke/latest/en/example-yamls/)。
rke config
# 安装集群
rke up
# 安装 Kubectl 命令行工具
mkdir ~/.kube
cp kube_config_cluster.yml ~/.kube/config
docker cp kubelet:/usr/local/bin/kubectl /usr/local/bin/kubectl
安装 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
注意: 请确保云厂商的集群已安装或启用 ingress-nginx 以保证路由访问功能可正常使用。
2. 安装 KubeVela
在安装之前,请确保 helm 工具是可用的,如未安装,请参考 安装说明 安装完成。
如果你的网络受限无法下载(特别是中国用户),可直接使用下述方式安装:
wget https://static.kubevela.net/binary/helm/helm-v3.7.0-linux-amd64 -O /usr/bin/helm
chmod +x /usr/bin/helm
该安装方式仅适用于 linux-amd64
添加并更新 KubeVela helm chart 仓库
helm repo add kubevela https://charts.kubevela.net/core
helm repo update
安装 KubeVela
helm install --create-namespace -n vela-system kubevela kubevela/vela-core --set multicluster.enabled=true --wait
你可以参考
自定义安装
获取更多安装模式和功能。验证 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 的方式来安装,或者通过二进制文件.
- Script
- Homebrew
- Download directly from releases
macOS/Linux
curl -fsSl https://kubevela.io/script/install.sh | bash
Windows
powershell -Command "iwr -useb https://kubevela.io/script/install.ps1 | iex"
macOS/Linux
先更新下你的 brew
brew update
紧接着安装 KubeVela
brew install kubevela
- 通过发布日志下载最新的
vela
二进制文件。 - 解压二进制文件,并且在
$PATH
中配好环境变量,就搞定啦。
sudo mv ./vela /usr/local/bin/vela
安装提示: 如果你使用的是 Mac 系统,它会弹出 “vela” 无法打开的警告,因为来自开发者的包无法验证。
MacOS 对能够在系统中运行的软件,采取了更加严格的限制。你暂时可以通过打开 ‘System Preference’ -> ‘Security & Privacy’ -> General 并点击 ‘Allow Anyway’ 来解决这个问题。
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>
5. 查看已安装能力
如果没安装 vela 命令行工具,你也可以通过
kubectl get comp -A
和kubectl 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 从一开始就被设计成可编程的,你可以按玩乐高积木一样,添加任何你需要的功能。