Think Deep,Work Lean

KubeVela安装及实践

Posted on By zack

安装

helm repo add kubevela https://kubevelacharts.oss-cn-hangzhou.aliyuncs.com/core
helm repo update
helm install --create-namespace -n vela-system kubevela kubevela/vela-core

下载vela 命令行

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

部署应用

➜  ~ kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/examples/vela-app.yaml
application.core.oam.dev/first-vela-app created

➜  ~ kubectl get application first-vela-app -o yaml
...
spec:
  components:
  - name: express-server
    properties:
      image: crccheck/hello-world
      port: 8000
    traits:
    - properties:
        domain: testsvc.example.com
        http:
          /: 8000
      type: ingress
    type: webservice

# 说入口的traits,其实本质是使用了k8s的ingress
➜  ~ k get ing
NAME             CLASS    HOSTS                 ADDRESS        PORTS   AGE
express-server   <none>   testsvc.example.com   192.168.64.6   80      4m47s

# 访问
➜  ~ curl 192.168.64.6 -Hhost:testsvc.example.com
<xmp>
Hello World


                                       ##         .
                                 ## ## ##        ==
                              ## ## ## ## ##    ===
                           /""""""""""""""""\___/ ===
                      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
                           \______ o          _,/
                            \      \       _,'
                             `'--.._\..--''
</xmp>

# 来看下这个app有哪些资源
➜  ~ k get po
NAME                             READY   STATUS    RESTARTS   AGE
express-server-65cdc68ff-btmzh   1/1     Running   0          5m26s
➜  ~ k get svc
NAME             TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
express-server   ClusterIP   10.106.193.194   <none>        8000/TCP   5m32s

注意事项

  1. 安装完后,要卸载test app
kubectl -n vela-system delete app first-vela-app

或是用 upgrade –install 就不会装 test 下的资源

  1. 在使用helm升级时,不会自动更新crds文件。如果升级时有crds的变化,需要手动apply。

即使使用helm卸载chart时,crds也不会删除。因为这是个高危动作,删除crd后,其cr会被自动删除。

kubectl replace -f crd.yaml –force的操作是先删除,然后应用,因此相关cr会删除。