kubernetes dashboard 二次开发

Kubernetes Dashboard 二次开发

官方源码:https://github.com/kubernetes/dashboard

开发文档:https://github.com/kubernetes/dashboard/wiki/Getting-started

1.    环境安装

1)     操作系统安装

操作系统:CentOS-7-x86_64-Minimal-1708

mac也可以,但在mac生成的镜像好像不能放在centos下运行,有报错,以下以centos安装为例,可以在mac下运行dashboard但是好像登录认证是假的,而且只有英文版。

2)     相关依赖安装

可以使用cnpm下载包的速度更快:

#npm install -g cnpm --registry=https://registry.npm.taobao.org

#cnpm install --global gulp-cli

#cnmp install --global gulp

3编译

如果本机环境不是k8s结点,那需要设置环境变量:export KUBE_DASHBOARD_APISERVER_HOST="http://<APISERVER_IP>:<APISERVER_PORT>"  

把GOPATH目录设置好

把源码解压到这个目录下:$GOPATH/src/github.com/kubernetes/dashboard

进入项目

cnpm install 安装模块 

如果有包下载不下来,或有权限问题用:npm i –unsafe-perm

如果有遇到错误,注意要把node_mdule文件夹删除再试,还不行,再把packeage.lock.son删除再试

gulp build  工程编译

运行 gulp serve

浏览器访问:localhost:9090

如果需要生成镜像:运行命令

gulp docker-image:head 生成tag为head的镜像

注意:Failed to load external module @babel/register  这个报错可以忽略

原文地址:https://www.cnblogs.com/hankuikui/p/10113729.html