当前位置: 首页 > news >正文

环境安装篇 之 安装kubevela

云原生学习路线导航页(持续更新中)

  • 本文是 环境安装 系列文章,介绍 oam规范标准实施项目 kubevela 的安装详细步骤
  • kubevela 官方安装文档:https://kubevela.io/zh/docs/installation/kubernetes/

1.CentOS 安装kubevela

1.1.前提:已安装docker

  • 要求已经安装了docker,没有安装的可以参考:
    • 环境安装篇 之 docker安装

1.2.安装kubevela

  • 安装kubevela
    • kubevela会内置一个kubernetes环境,所以你不需要实现安装 kubernetes
    curl -fsSl https://kubevela.io/script/install.sh | bash
    vela install
    

1.3.安装kubectl

  • 虽然kubevela会内置一个kubernetes环境,但是没有安装kubectl,需要手动安装
    $ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
    $ curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
    $ echo "$(cat kubectl.sha256)  kubectl" | sha256sum --check
    $ install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
    
  • kubevela内置的集群,集群kubeconfig文件是 /etc/rancher/k3s/k3s.yaml
  • 如果你的kubectl无法找到集群,就将该文件复制一份为 ~/.kube/config
    cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
    

1.4.可能遇到的问题

  • 安装过程如果报错:
    [ERROR]  Failed to find the k3s-selinux policy, please install:yum install -y container-selinuxyum install -y https://rpm.rancher.io/k3s/stable/common/centos/7/noarch/Error: Fail to set up cluster: fail to setup k3s: K3s install script failed: exit status 1
    
    • 按照提示执行两条yum命令,安装 container-selinuxk3s-selinux
    • 从上面的报错看,第二条yum命令,日志其实没有打印全(我也不知道为啥),https://rpm.rancher.io/k3s/stable/common/centos/7/noarch/ 是错误的,直接执行会提示找不到包
    • centos7,可以执行这个命令
      yum install -y https://rpm.rancher.io/k3s/stable/common/centos/7/noarch/k3s-selinux-1.2-2.el8.noarch.rpm
      
    • 解决问题后,重新执行 vela install 即可

1.5.安装velaux:kubevela UI控制台

1.5.1.根据kubevela安装成功提示安装velaux

  • 安装成功的提示信息如下:
    [root@kubevela go]# velad install
    Preparing cluster setup script...
    Saving temporary file: k3s-setup-*.sh
    Preparing k3s binary...
    Saving k3s binary to /usr/local/bin/k3s
    Successfully place k3s binary to /usr/local/bin/k3s
    Preparing k3s images
    Making directory /var/lib/rancher/k3s/agent/images/
    Saving K3s air-gap install images to /var/lib/rancher/k3s/agent/images/k3s-airgap-images.tar.gz
    Successfully prepare k3s image
    Setting up cluster
    /bin/bash /root/.vela/tmp/k3s-setup-445017089.sh --node-name=default
    [INFO]  Skipping k3s download and verify
    [INFO]  Skipping installation of SELinux RPM
    [INFO]  Skipping /usr/local/bin/kubectl symlink to k3s, already exists
    [INFO]  Creating /usr/local/bin/crictl symlink to k3s
    [INFO]  Skipping /usr/local/bin/ctr symlink to k3s, command exists in PATH at /usr/bin/ctr
    [INFO]  Creating killall script /usr/local/bin/k3s-killall.sh
    [INFO]  Creating uninstall script /usr/local/bin/k3s-uninstall.sh
    [INFO]  env: Creating environment file /etc/systemd/system/k3s.service.env
    [INFO]  systemd: Creating service file /etc/systemd/system/k3s.service
    [INFO]  systemd: Enabling k3s unit
    Created symlink from /etc/systemd/system/multi-user.target.wants/k3s.service to /etc/systemd/system/k3s.service.
    [INFO]  systemd: Starting k3s
    Successfully setup cluster
    Checking and installing vela CLI...
    vela CLI is not installed, installing...
    Installing vela CLI at:  /usr/local/bin/vela
    Successfully install vela CLI
    Saving and temporary image file: vela-image-cluster-gateway-*.tar
    Importing image to cluster using temporary file: vela-image-cluster-gateway-*.tar
    unpacking docker.io/oamdev/cluster-gateway:v1.9.0-alpha.2 (sha256:a9baa41c62762dea9cccefeed0ef1a479b695f7af847ecf7df0ab6b6ecf4e8c5)...done
    Successfully import image /root/.vela/tmp/vela-image-cluster-gateway-2792909328.tar
    Saving and temporary image file: vela-image-kube-webhook-certgen-*.tar
    Importing image to cluster using temporary file: vela-image-kube-webhook-certgen-*.tar
    unpacking docker.io/oamdev/kube-webhook-certgen:v2.4.1 (sha256:089374ef23e1d268f138d742b8af056ee1af51bb4863f6a19cde0634068eaa91)...done
    Successfully import image /root/.vela/tmp/vela-image-kube-webhook-certgen-4078663359.tar
    Saving and temporary image file: vela-image-vela-core-*.tar
    Importing image to cluster using temporary file: vela-image-vela-core-*.tar
    unpacking docker.io/oamdev/vela-core:v1.9.5 (sha256:fbff76625847c1183dd371f5fc9acbbd3c33c348faf12984eaae433b1244f454)...done
    Successfully import image /root/.vela/tmp/vela-image-vela-core-222878440.tar
    Saving and temporary image file: vela-image-velaux-*.tar
    Importing image to cluster using temporary file: vela-image-velaux-*.tar
    unpacking docker.io/oamdev/velaux:v1.9.2 (sha256:9e1a8810c429fb651807efde0542778143fb5428732d9c9839310eb949d5d97d)...done
    Successfully import image /root/.vela/tmp/vela-image-velaux-3157703049.tar
    Saving and temporary helm chart file: vela-core-*.tgz
    open the tar to tmpDir /root/.vela/tmp
    Copy velaux-v1.9.2.tgz file to /root/.vela/addons/velaux-v1.9.2.tgz
    Extracting /root/.vela/addons/velaux-v1.9.2.tgz to /root/.vela/addons/velaux
    Installing vela-core Helm chart...
    Executing "vela install --file /root/.vela/tmp/vela-core --detail=false --version v1.9.5 --set= --namespace=vela-system "Check Requirements ...
    Installing KubeVela Core ...
    Helm Chart used for KubeVela control plane installation: /root/.vela/tmp/vela-core
    I0320 23:26:51.273741   19017 apply.go:126] "creating object" name="applicationrevisions.core.oam.dev" resource="apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
    I0320 23:26:51.324160   19017 apply.go:126] "creating object" name="applications.core.oam.dev" resource="apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
    I0320 23:26:51.347480   19017 apply.go:126] "creating object" name="componentdefinitions.core.oam.dev" resource="apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
    I0320 23:26:51.384335   19017 apply.go:126] "creating object" name="definitionrevisions.core.oam.dev" resource="apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
    I0320 23:26:51.410499   19017 apply.go:126] "creating object" name="policies.core.oam.dev" resource="apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
    I0320 23:26:51.474147   19017 apply.go:126] "creating object" name="policydefinitions.core.oam.dev" resource="apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
    I0320 23:26:51.503579   19017 apply.go:126] "creating object" name="resourcetrackers.core.oam.dev" resource="apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
    I0320 23:26:51.518233   19017 apply.go:126] "creating object" name="traitdefinitions.core.oam.dev" resource="apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
    I0320 23:26:51.539290   19017 apply.go:126] "creating object" name="workflows.core.oam.dev" resource="apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
    I0320 23:26:51.559766   19017 apply.go:126] "creating object" name="workflowstepdefinitions.core.oam.dev" resource="apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
    I0320 23:26:51.581942   19017 apply.go:126] "creating object" name="workloaddefinitions.core.oam.dev" resource="apiextensions.k8s.io/v1, Kind=CustomResourceDefinition"
    Start upgrading Helm Chart kubevela in namespace vela-systemKubeVela control plane has been successfully set up on your cluster.
    If you want to enable dashboard, please run "vela addon enable /root/.vela/addons/velaux"
    Modifying the built-in gateway definition...Keep the token below if you want to restart the control plane
    K10753a9d09167f265c6f72e2cf3d453da9df7099d9e8fad7002a4b397f843491e0::server:4548ddd54b195c9d4f85e85e9d81d87a🚀 Successfully install KubeVela control plane
    💻 When using gateway trait, you can access with 127.0.0.1
    🔭 See available commands with `vela help`
    💡 To enable dashboard, run `vela addon enable /root/.vela/addons/velaux`
    🔑 To access the cluster, set KUBECONFIG:export KUBECONFIG=$(velad kubeconfig --name default --host)
    
  • 根据提示,可知道,执行 vela addon enable /root/.vela/addons/velaux 可以安装velaux,即kubevela的UI控制台
    [root@kubevela go]# vela addon enable /root/.vela/addons/velaux
    enabling addon by local dir: /root/.vela/addons/velaux
    Addon velaux enabled successfully.
    Please access addon-velaux from the following endpoints:
    +---------+---------------+-----------------------------------+--------------------------------+-------+
    | CLUSTER |   COMPONENT   |     REF(KIND/NAMESPACE/NAME)      |            ENDPOINT            | INNER |
    +---------+---------------+-----------------------------------+--------------------------------+-------+
    | local   | velaux-server | Service/vela-system/velaux-server | velaux-server.vela-system:8000 | true  |
    +---------+---------------+-----------------------------------+--------------------------------+-------+To open the dashboard directly by port-forward:vela port-forward -n vela-system addon-velaux 8000:8000Please refer to https://kubevela.io/docs/reference/addons/velaux for more VelaUX addon installation and visiting method.
    

1.5.2.使用NodePort方式安装velaux

  • 如果是在虚拟机中,使用1.4.1中安装的velaux,外界机器上是无法访问的,可以使用NodePort方式安装velaux

    [root@kubevela go]# vela addon enable velaux serviceType=NodePort
    Addon velaux enabled successfully.
    Please access addon-velaux from the following endpoints:
    +---------+---------------+-----------------------------------+-----------------------+-------+
    | CLUSTER |   COMPONENT   |     REF(KIND/NAMESPACE/NAME)      |       ENDPOINT        | INNER |
    +---------+---------------+-----------------------------------+-----------------------+-------+
    | local   | velaux-server | Service/vela-system/velaux-server | 192.168.245.151:30000 | false |
    +---------+---------------+-----------------------------------+-----------------------+-------+To open the dashboard directly by port-forward:vela port-forward -n vela-system addon-velaux 8000:8000Please refer to https://kubevela.io/docs/reference/addons/velaux for more VelaUX addon installation and visiting method.
    
  • 根据结果可知,通过 192.168.245.151:30000 可以访问 VelaUX

  • VelaUX,默认账号:admin,密码:VelaUX12345

    在这里插入图片描述

相关文章:

  • Java面试题(Spring篇)
  • python课后习题一
  • echart多折线图堆叠 y轴和实际数据不对应
  • 全量知识系统“全基因序列”程序构想及SmartChat的回复
  • Github: Github actions自动化工作原理与多workflow创建和部署
  • 掌握Go语言:利用Go语言的单向通道和select语句,提升库存管理效率(21)
  • THM学习笔记—Bounty Hacker
  • 游戏客户端面经
  • mysql基础操作
  • 亮数据代理IP轻松解决爬虫数据采集痛点
  • Python BaseModel和dataclass用法和区别
  • Day74:WEB攻防-机制验证篇重定向发送响应状态码跳过步骤验证码回传枚举
  • 【TB作品】MSP430,单片机,Proteus仿真,数字音乐盒,蜂鸣器音乐仿真
  • 智慧安全:守护智慧城市的安全屏障
  • 应急响应-Web2
  • 【跃迁之路】【463天】刻意练习系列222(2018.05.14)
  • create-react-app项目添加less配置
  • ES6 ...操作符
  • IIS 10 PHP CGI 设置 PHP_INI_SCAN_DIR
  • JavaScript学习总结——原型
  • OpenStack安装流程(juno版)- 添加网络服务(neutron)- controller节点
  • PhantomJS 安装
  • Storybook 5.0正式发布:有史以来变化最大的版本\n
  • TiDB 源码阅读系列文章(十)Chunk 和执行框架简介
  • vagrant 添加本地 box 安装 laravel homestead
  • Web标准制定过程
  • 动态魔术使用DBMS_SQL
  • 番外篇1:在Windows环境下安装JDK
  • 基于Volley网络库实现加载多种网络图片(包括GIF动态图片、圆形图片、普通图片)...
  • 简单数学运算程序(不定期更新)
  • 前端面试之CSS3新特性
  • 使用Gradle第一次构建Java程序
  • Nginx实现动静分离
  • 微龛半导体获数千万Pre-A轮融资,投资方为国中创投 ...
  • # Swust 12th acm 邀请赛# [ K ] 三角形判定 [题解]
  • # 达梦数据库知识点
  • #stm32整理(一)flash读写
  • #基础#使用Jupyter进行Notebook的转换 .ipynb文件导出为.md文件
  • (13):Silverlight 2 数据与通信之WebRequest
  • (20050108)又读《平凡的世界》
  • (Java数据结构)ArrayList
  • (LeetCode C++)盛最多水的容器
  • (保姆级教程)Mysql中索引、触发器、存储过程、存储函数的概念、作用,以及如何使用索引、存储过程,代码操作演示
  • (二)fiber的基本认识
  • (二十三)Flask之高频面试点
  • (附源码)ssm高校运动会管理系统 毕业设计 020419
  • (附源码)ssm旅游企业财务管理系统 毕业设计 102100
  • (原)Matlab的svmtrain和svmclassify
  • (转)VC++中ondraw在什么时候调用的
  • .NET Core 实现 Redis 批量查询指定格式的Key
  • .Net Web窗口页属性
  • .net 程序发生了一个不可捕获的异常
  • .net分布式压力测试工具(Beetle.DT)
  • .NET开发不可不知、不可不用的辅助类(一)
  • []AT 指令 收发短信和GPRS上网 SIM508/548