在kind中部署kubevela目前最新版本(v1.3.0)

  1. 1. 准备集群
    1. 1.1. 下载kind
    2. 1.2. 创建kind集群
    3. 1.3. 安装ingress-nginx
      1. 1.3.0.1. 解决国内无法下载镜像问题
  • 2. 安装kubevela

  • 准备集群

    下载kind

    1
    2
    3
    curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.12.0/kind-linux-amd64
    chmod +x ./kind
    mv ./kind /usr/local/bin/kind

    创建kind集群

    旧版本的node安装ingress-nginx时会找不到networking.k8s.io/v1 ,选择node版本为1.22.7,也可使用旧版nginx-ingress

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    cat <<EOF | kind create cluster --image=kindest/node:v1.22.7 --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-nginx

    目前最新版本为1.1.3,所以使用该版本

    1
    2
    3
    4
    wget  https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml
    # 此处为最新版(1.1.3)
    # 等于如下版本:
    # wget https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.3/deploy/static/provider/kind/deploy.yaml
    解决国内无法下载镜像问题

    由于ingress-nginx在gcr.io中,国内无法直接下载,此处我们使用docker hub上的镜像。

    没有的镜像可通过向此仓库提交issue实现

    修改一下deploy.yaml的镜像版本

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    ...           
    417 image: anjia0532/google-containers.ingress-nginx.controller:v1.1.3
    418 imagePullPolicy: IfNotPresent
    419 lifecycle:
    420 preStop:.

    ...

    521 image: anjia0532/google-containers.ingress-nginx.kube-webhook-certgen:v1.1.1
    522 imagePullPolicy: IfNotPresent

    ...

    570 image: anjia0532/google-containers.ingress-nginx.kube-webhook-certgen:v1.1.1
    571 imagePullPolicy: IfNotPresent
    ...

    直接apply即可

    1
    kubectl apply -f deploy.yaml

    安装kubevela

    使用脚本一键部署KubeVela CLI

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

    安装 KubeVela Core

    1
    vela install

    安装velaUX 可视化操作界面

    1
    vela addon enable velaux serviceType=ClusterIp repo=acr.kubevela.net

    给velaUX启用ingress(当前版本无法直接启用,velaUX的ingress清单为旧版networking.k8s.io/v1beta1)

    1
    vela addon enable velaux repo=acr.kubevela.net domain=example.doamin.com

    推荐自己写一个资源清单

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
    name: vela-ingress
    namespace: vela-system
    spec:
    tls:
    - hosts:
    - velaux.test.com # 改为自己的域名
    rules:
    - host: velaux.test.com # 改为自己的域名
    http:
    paths:
    - path: /
    pathType: Prefix
    backend:
    service:
    name: velaux
    port:
    number: 80

    获取velaUX的账号密码

    1
    vela logs -n vela-system --name apiserver addon-velaux | grep "initialized admin username"

    另一种获取密码的方式:

    1
    kubectl get secret admin  -n vela-system -o jsonpath="{.data.admin}" |base64 --decode

    注:密码为数字+字母的8位组合,如果你不幸随机到了一个全是字母的密码登录不上webui,最快的方法还是重新部署。