Commit 996e0c1e authored by wangzhengkun's avatar wangzhengkun
Browse files
parents 24c5dc12 b41687cb
Showing with 134 additions and 606 deletions
+134 -606
......@@ -15,7 +15,7 @@ KubeOperator 提供可视化的 Web UI,支持离线环境,支持物理机、
KubeOperator 使用 Terraform 在 IaaS 平台上自动创建主机(用户也可以自行准备主机,比如物理机或者虚机),通过 Ansible 完成自动化部署和变更操作,支持 Kubernetes 集群 从 Day 0 规划,到 Day 1 部署,到 Day 2 运营的全生命周期管理。
### 组件项目
KubeOperator 的两个子项目(可独立部署使用):
- **[KubePi](https://github.com/KubeOperator/KubePi)**: 简单易用的开源 Kubernetes 可视化管理面板
- **[Web Kubectl](https://github.com/KubeOperator/webkubectl)**: 在 Web 浏览器中运行 kubectl 命令
......@@ -70,239 +70,10 @@ curl -sSL https://github.com/KubeOperator/KubeOperator/releases/latest/download/
- [演示视频](https://www.bilibili.com/video/BV1jT4y1L7Ur/)
- [PPT 介绍](https://kubeoperator.io/download/KubeOperator_Intro.pdf)
### 功能列表
<table class="subscription-level-table">
<tr class="subscription-level-tr-border">
<td class="features-first-td-background-style" rowspan="17">Day 0 规划</td>
</td>
<td class="features-third-td-background-style" rowspan="2">集群模式
</td>
<td class="features-third-td-background-style">1 个 Master 节点 n 个 Worker 节点模式:适合开发测试用途
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">3 个 Master 节点 n 个 Worker 节点模式:适合生产用途
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style" rowspan="4">计算方案
</td>
<td class="features-third-td-background-style">独立主机:支持自行准备的虚机、公有云主机和物理机
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">vSphere 平台:支持自动创建主机(使用 Terraform)
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">Openstack 平台:支持自动创建主机 (使用 Terraform)
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">FusionCompute 平台:支持自动创建主机 (使用 Terraform)
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style" rowspan="4">存储方案
</td>
<td class="features-third-td-background-style">独立主机:支持 NFS / Ceph RBD / Rook Ceph / Local Volume
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">vSphere 平台:支持 vSphere Datastore (vSAN 及 vSphere 兼容的集中存储)
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">Openstack 平台:支持 Openstack Cinder (Ceph 及 Cinder 兼容的集中存储)
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">FusionCompute 平台:支持 OceanStor
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style" rowspan="4">网络方案
</td>
<td class="features-third-td-background-style">支持 CoreDNS
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持 Flannel / Calico / Cilium 网络插件
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持 ingress-nginx / traefik
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持通过 F5 Big IP 对外暴露服务(X-PACK)
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">GPU 方案
</td>
<td class="features-third-td-background-style">支持 NVIDIA GPU
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">操作系统
</td>
<td class="features-third-td-background-style">支持 RHEL / CentOS / Ubuntu / EulerOS 操作系统
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">容器运行时
</td>
<td class="features-third-td-background-style">支持 Docker / Containerd
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-first-td-background-style" rowspan="6">Day 1 部署
</td>
<td class="features-third-td-background-style" rowspan="6">部署
</td>
<td class="features-third-td-background-style">支持在线和离线安装模式
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持 Kubeadm 部署
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持 x86_64 和 arm64 CPU 架构
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持可视化方式展示部署过程
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持一键自动化部署(使用 Ansible)
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持已有集群导入
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-first-td-background-style" rowspan="22">Day 2 运营
</td>
<td class="features-third-td-background-style" rowspan="9">管理
</td>
<td class="features-third-td-background-style">支持以项目为核心的分级授权管理
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持系统管理员、项目管理员和集群管理员三种角色
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持多集群配置管理(X-PACK)
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持对接 LDAP/AD(X-PACK)
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持自定义 Logo 和 配色(X-PACK)
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">对外开放 REST API
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持国际化 i18n
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">提供 Web Kubectl 界面
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">内置 Helm
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style" rowspan="4">可观察性
</td>
<td class="features-third-td-background-style">内置 Prometheus,支持对集群、节点、Pod、Container 的全方位监控和告警
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">内置 EFK、Loki 日志方案
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">内置 Grafana 作为监控和日志展示
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持消息中心,通过钉钉、微信通知各种集群异常事件(X-PACK)
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">升级
</td>
<td class="features-third-td-background-style">支持集群升级
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">伸缩
</td>
<td class="features-third-td-background-style">支持增加或者减少 Worker 节点
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">备份
</td>
<td class="features-third-td-background-style">支持 etcd 定期备份和立即备份
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">恢复
</td>
<td class="features-third-td-background-style">支持 etcd 备份策略文件恢复和本地文件恢复
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style" rowspan="2">安全合规
</td>
<td class="features-third-td-background-style">支持集群健康评分(X-PACK)
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">支持 CSI 安全扫描
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style" rowspan="2">应用商店
</td>
<td class="features-third-td-background-style">提供 GitLab、Jenkins、Harbor、Argo CD、Sonarqube 等 DevOps 工具
</td>
</tr>
<tr class="subscription-level-tr-border">
<td class="features-third-td-background-style">提供深度学习AI 应用,比如 TensorFlow
</td>
</tr>
</table>
### 微信交流群
![wechat-group](https://kubeoperator.io/docs/img/wechat-group.png)
### 版本说明
KubeOperator 版本号命名规则为:v大版本.功能版本.Bug修复版本。比如:
```
v1.0.1 是 v1.0.0 之后的Bug修复版本;
v1.1.0 是 v1.0.0 之后的功能版本。
```
像其它优秀开源项目一样,KubeOperator 将每月发布一个功能版本。
### 致谢
......
......@@ -58,7 +58,6 @@ require (
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
github.com/lestrrat-go/strftime v1.0.4 // indirect
github.com/mailru/easyjson v0.7.1 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/microcosm-cc/bluemonday v1.0.6 // indirect
github.com/mitchellh/mapstructure v1.4.1
github.com/mojocn/base64Captcha v1.3.1
......@@ -70,6 +69,7 @@ require (
github.com/qri-io/jsonpointer v0.1.1 // indirect
github.com/robfig/cron v1.1.0
github.com/robfig/cron/v3 v3.0.1
github.com/russross/blackfriday v2.0.0+incompatible // indirect
github.com/ryanuber/columnize v2.1.2+incompatible // indirect
github.com/satori/go.uuid v1.2.0
github.com/sirupsen/logrus v1.8.1
......@@ -83,17 +83,12 @@ require (
github.com/yudai/gojsondiff v1.0.0 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
github.com/yudai/pp v2.0.1+incompatible // indirect
gitlab.com/golang-commonmark/linkify v0.0.0-20200225224916-64bca66f6ad3 // indirect
gitlab.com/golang-commonmark/markdown v0.0.0-20191127184510-91b5b3c99c19 // indirect
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
golang.org/x/text v0.3.6
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.4.2
k8s.io/api v0.22.0
k8s.io/apiextensions-apiserver v0.19.4
......
This diff is collapsed.
INSERT INTO
`ko`.`ko_cluster_tool_detail`(
`id`,
`name`,
`version`,
`chart_version`,
`architecture`,
`describe`,
`vars`,
`created_at`,
`updated_at`
)
VALUES
(
UUID(),
'kubepi',
'v1.1.0',
'0.1.0',
'all',
NULL,
'{\"kubepi_image_name\":\"kubeoperator/kubepi-server\",\"kubepi_image_tag\":\"v1.1.0\"}',
date_add(now(), interval 8 HOUR),
date_add(now(), interval 8 HOUR)
);
UPDATE
`ko`.`ko_cluster_tool`
SET
`higher_version` = "v1.1.0"
WHERE
`name` = "kubepi"
AND `status` != "Waiting";
UPDATE
`ko`.`ko_cluster_tool`
SET
`version` = "v1.1.0"
WHERE
`name` = "kubepi"
AND `status` = "Waiting";
UPDATE
ko_cluster_manifest
SET
`tool_vars` = '[{"name":"kubepi","version":"v1.1.0"},{"name":"loki","version":"v2.0.0"},{"name":"kubeapps","version":"v1.10.2"},{"name":"prometheus","version":"v2.18.1"},{"name":"chartmuseum","version":"v0.12.0"},{"name":"registry","version":"v2.7.1"},{"name":"grafana","version":"v7.3.3"},{"name":"logging","version":"v7.6.2"}]'
WHERE
`name` in (
'v1.18.4-ko1',
'v1.18.6-ko1',
'v1.18.8-ko1',
'v1.18.10-ko1',
'v1.18.12-ko1',
'v1.18.14-ko1'
);
UPDATE
ko_cluster_manifest
SET
`tool_vars` = '[{"name":"kubepi","version":"v1.1.0"},{"name":"loki","version":"v2.1.0"},{"name":"kubeapps","version":"v2.0.1"},{"name":"prometheus","version":"v2.20.1"},{"name":"chartmuseum","version":"v0.12.0"},{"name":"registry","version":"v2.7.1"},{"name":"grafana","version":"v7.3.3"},{"name":"logging","version":"v7.6.2"}]'
WHERE
`name` in (
'v1.18.15-ko1',
'v1.18.18-ko1',
'v1.18.20-ko1',
'v1.20.4-ko1',
'v1.20.6-ko1',
'v1.20.8-ko1',
'v1.20.10-ko1'
);
UPDATE
ko_cluster_manifest
set
storage_vars = '[{\"name\":\"external-ceph\",\"version\":\"v2.1.1-k8s1.11\"}, {\"name\":\"nfs\",\"version\":\"v3.1.0-k8s1.11\"}, {\"name\":\"vsphere\",\"version\":\"v1.0.3\"}, {\"name\":\"rook-ceph\",\"version\":\"v1.3.6\"}, {\"name\":\"oceanstor\",\"version\":\"v2.2.9\"}, {\"name\":\"cinder\",\"version\":\"v1.20.0\"}]'
WHERE
`name` in (
'v1.18.18-ko1',
'v1.18.20-ko1',
'v1.20.6-ko1',
'v1.20.8-ko1',
'v1.20.10-ko1'
);
\ No newline at end of file
UPDATE
ko_cluster_spec
JOIN ko_cluster ON ko_cluster_spec.id = ko_cluster.spec_id
SET
ko_cluster_spec.kube_router = (
SELECT
ip
FROM
ko_host
WHERE
id = (
SELECT
host_id
FROM
ko_cluster_node
WHERE
ko_cluster_node.cluster_id = ko_cluster.id
AND ko_cluster_node.role = "master"
LIMIT
1
)
);
\ No newline at end of file
......@@ -258,7 +258,7 @@ func (c Cluster) PrepareTools() []ClusterTool {
return []ClusterTool{
{
Name: "kubepi",
Version: "v1.0.1",
Version: "v1.1.0",
Describe: "仪表盘|Dashboard",
Status: constant.ClusterWaiting,
Logo: "kubepi.png",
......
......@@ -33,6 +33,7 @@ func (k KubePi) setDefaultValue(toolDetail model.ClusterToolDetail) {
_ = json.Unmarshal([]byte(k.Tool.Vars), &values)
values["image.repository"] = fmt.Sprintf("%s:%d/%s", k.LocalHostName, k.LocalRepositoryPort, imageMap["kubepi_image_name"])
values["image.tag"] = imageMap["kubepi_image_tag"]
values["securityContext.privileged"] = true
str, _ := json.Marshal(&values)
k.Tool.Vars = string(str)
}
......
......@@ -112,9 +112,9 @@ func (c clusterImportService) Import(clusterImport dto.ClusterImport) error {
SupportGpu: clusterImport.KoClusterInfo.SupportGpu,
YumOperate: clusterImport.KoClusterInfo.YumOperate,
LbMode: constant.ClusterSourceInternal,
LbKubeApiserverIp: address,
KubeApiServerPort: port,
LbMode: clusterImport.KoClusterInfo.LbMode,
LbKubeApiserverIp: clusterImport.KoClusterInfo.LbKubeApiserverIp,
KubeApiServerPort: clusterImport.KoClusterInfo.KubeApiServerPort,
Architectures: clusterImport.Architectures,
KubeRouter: clusterImport.Router,
......@@ -419,12 +419,10 @@ func (c clusterImportService) LoadClusterInfo(loadInfo *dto.ClusterLoad) (dto.Cl
}
loadInfo.ApiServer = strings.Replace(loadInfo.ApiServer, "http://", "", -1)
loadInfo.ApiServer = strings.Replace(loadInfo.ApiServer, "https://", "", -1)
clusterInfo.LbMode = constant.ClusterSourceInternal
if !strings.Contains(loadInfo.ApiServer, ":") {
return clusterInfo, fmt.Errorf("check whether apiserver(%s) has no ports", loadInfo.ApiServer)
}
clusterInfo.LbKubeApiserverIp = strings.Split(loadInfo.ApiServer, ":")[0]
clusterInfo.KubeApiServerPort, _ = strconv.Atoi(strings.Split(loadInfo.ApiServer, ":")[1])
clusterInfo.Architectures = loadInfo.Architectures
kubeClient, err := kubeUtil.NewKubernetesClient(&kubeUtil.Config{
......@@ -466,6 +464,19 @@ func (c clusterImportService) LoadClusterInfo(loadInfo *dto.ClusterLoad) (dto.Cl
if err := json.Unmarshal(kk, &data); err != nil {
return clusterInfo, fmt.Errorf("kubeadm-config json unmarshall failed: %s", err.Error())
}
if strings.Contains(data.ControlPlaneEndpoint, ":") {
apiServerInCM := strings.Split(data.ControlPlaneEndpoint, ":")[0]
if apiServerInCM == "127.0.0.1" {
clusterInfo.LbKubeApiserverIp = strings.Split(loadInfo.ApiServer, ":")[0]
clusterInfo.LbMode = constant.ClusterSourceInternal
} else {
clusterInfo.LbKubeApiserverIp = apiServerInCM
clusterInfo.LbMode = constant.ClusterSourceExternal
}
clusterInfo.KubeApiServerPort, _ = strconv.Atoi(strings.Split(data.ControlPlaneEndpoint, ":")[1])
} else {
return clusterInfo, fmt.Errorf("err controlPlaneEndpoint from cluster configmap")
}
clusterInfo.KubeServiceNodePortRange = data.ApiServer.ExtraArgs.ServiceNodePortRange
mask, _ := strconv.Atoi(data.Controller.ExtraArgs.NodeCidrMaskSize)
clusterInfo.KubeNetworkNodePrefix = mask
......@@ -522,9 +533,10 @@ func (c clusterImportService) LoadClusterInfo(loadInfo *dto.ClusterLoad) (dto.Cl
}
type admConfigStruct struct {
ApiServer apiServerStruct `json:"apiServer"`
Controller ControllerStruct `json:"controllerManager"`
Network networkStruct `json:"networking"`
ApiServer apiServerStruct `json:"apiServer"`
ControlPlaneEndpoint string `json:"controlPlaneEndpoint"`
Controller ControllerStruct `json:"controllerManager"`
Network networkStruct `json:"networking"`
}
type proxyConfigStruct struct {
......
......@@ -519,12 +519,15 @@ func (h *hostService) GetHostMem(host *model.Host) error {
if err != nil {
return err
}
if len(result) == 0 {
if len(strings.Trim(result, "\n")) == 0 {
result, _, _, err = client.Exec("sudo dmidecode -t 17 | grep \"Size.*GB\" | awk '{s+=$2} END {print s}'")
if err != nil {
return err
}
me, _ := strconv.Atoi(strings.Trim(result, "\n"))
me, err := strconv.Atoi(strings.Trim(result, "\n"))
if err != nil {
return err
}
host.Memory = me * 1024
} else {
me, err := strconv.Atoi(strings.Trim(result, "\n"))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment