Skip to content

Commit

Permalink
offline
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohq committed Nov 28, 2019
1 parent ef26d62 commit e14c535
Show file tree
Hide file tree
Showing 8 changed files with 893 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .vuepress/config-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module.exports = {
'install-docker-desktop',
['install-k8s', '安装Kubernetes单Master节点'],
'install-kubernetes',
'sealos/',
'install-node-port-range',
'k8s-restart',
]
Expand All @@ -45,6 +46,7 @@ module.exports = {
collapsable: false,
children: [
'install-dashboard',
'install-dashboard-offline',
'install-dashboard-upgrade',
'install-kubectl',
'config-kubectl',
Expand Down
120 changes: 120 additions & 0 deletions .vuepress/public/install-script/kuboard-offline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: kuboard
namespace: kube-system
annotations:
k8s.eip.work/displayName: kuboard
k8s.eip.work/ingress: "false"
k8s.eip.work/service: NodePort
k8s.eip.work/workload: kuboard
labels:
k8s.eip.work/layer: monitor
k8s.eip.work/name: kuboard
spec:
replicas: 1
selector:
matchLabels:
k8s.eip.work/layer: monitor
k8s.eip.work/name: kuboard
template:
metadata:
labels:
k8s.eip.work/layer: monitor
k8s.eip.work/name: kuboard
spec:
nodeName: your-node-name
containers:
- name: kuboard
image: eipwork/kuboard:latest
imagePullPolicy: IfNotPresent
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule

---
apiVersion: v1
kind: Service
metadata:
name: kuboard
namespace: kube-system
spec:
type: NodePort
ports:
- name: http
port: 80
targetPort: 80
nodePort: 32567
selector:
k8s.eip.work/layer: monitor
k8s.eip.work/name: kuboard

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kuboard-user
namespace: kube-system

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kuboard-user
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: kuboard-user
namespace: kube-system

---
apiVersion: v1
kind: ServiceAccount
metadata:
name: kuboard-viewer
namespace: kube-system

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kuboard-viewer
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: view
subjects:
- kind: ServiceAccount
name: kuboard-viewer
namespace: kube-system

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kuboard-viewer-node
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:node
subjects:
- kind: ServiceAccount
name: kuboard-viewer
namespace: kube-system

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kuboard-viewer-pvp
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:persistent-volume-provisioner
subjects:
- kind: ServiceAccount
name: kuboard-viewer
namespace: kube-system
79 changes: 79 additions & 0 deletions install/install-dashboard-offline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
vssueId: 19
description: Kuboard_快速在Kubernetes上落地微服务_本文详细介绍如何离线安装Kuboard
meta:
- name: keywords
content: Kuboard离线安装
---

# 安装Kuboard(离线)

<AdSenseTitle/>

许多公司处于安全的考虑,需要将 Kuboard 离线安装到内网环境。本文描述了如何完成 Kuboard 的离线安装。请确保您已经熟悉了 [安装Kuboard](./install-dashboard),本文只描述离线安装时,与正常安装的过程的差异部分。

## 准备Kuboard镜像

### 获取Kuboard镜像

* 在可以上网的机器上抓取 kuboard 镜像

``` sh
docker pull eipwork/kuboard:latest
```

* 查看 kuboard 镜像的 ID

``` sh
docker images | grep kuboard
```

输出结果如下所示:
```
eipwork/kuboard-press latest 86eaead8421e 3 weeks ago 170MB
```

* 将 Kuboard 镜像导出到文件

``` sh
docker save 86eaead8421e > kuboard.tar
```
::: tip ImageID
请使用上一个步骤中查询到的 image ID
:::

* 将 kuboard.tar 传输到 Kubernetes 集群的某一个节点上

### 加载Kuboard镜像

* 在 Kubernetes 集群的某一个节点上执行

``` sh
docker load < kuboard.tar
```

* 为镜像重新添加标签

``` sh
docker tag 86eaead8421e eipwork/kuboard:latest
```

## 准备kuboard.yaml文件

安装Kuboard的yaml文件如下,将其保存到 kuboard-offline.yaml

::: tip 必要的修改
* 修改该文件中第 26 行的节点名称为上一个步骤中,已经加载了 kuboard 镜像的节点,参考 [将容器组调度到指定节点](/learning/k8s-intermediate/config/assign-pod-node.html)
* 与在线安装不同,此处 `ImagePullPolicy=IfNotPresent` (第30行),参考 [容器镜像](/learning/k8s-intermediate/container/images.html#更新镜像)
:::

<<< .vuepress/public/install-script/kuboard-offline.yaml {26,30}

* 执行命令
``` sh
kubectl apply -f kuboard-offline.yaml
```

## 登录Kuboard

登录 Kuboard 的方式同 [安装Kuboard](./install-dashboard.html)
36 changes: 36 additions & 0 deletions install/sealos/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
vssueId: 171
description: Kuboard_快速在Kubernetes上落地微服务_本文详细介绍如何离线安装Kubernetes
meta:
- name: keywords
content: Kubernetes离线安装
---

# 安装Kubernetes集群(离线)

<AdSenseTitle/>

**离线安装步骤:**

* 在局域网内准备好4台机器,假设:
* 三台 master,IP地址为 192.168.0.2、192.168.0.3、192.168.0.4
* 一台 worker,IP地址为 192.168.0.5
* 在任何一台机器上执行如下两行命令

::: tip 机器要求
* centos 7.6 或 centos 7.7
* 配置不低于2核4G
* 所有机器 root 用户密码一致(如不一致也可以使用 ssh 密钥,可参考 [sealos](https://github.com/fanux/sealos)
:::

``` sh
wget https://github.com/fanux/sealos/releases/download/v2.0.7/sealos && \
chmod +x sealos && mv sealos /usr/bin
sealos init --passwd YOUR_SERVER_PASSWD \
--master 192.168.0.2 --master 192.168.0.3 --master 192.168.0.4 \
--node 192.168.0.5 \
--pkg-url https://sealyun.oss-cn-beijing.aliyuncs.com/37374d999dbadb788ef0461844a70151-1.16.0/kube1.16.0.tar.gz \
--version v1.16.0
```

[了解一下这是怎么做到的](https://github.com/fanux/sealos)
Binary file added install/sealos/sealos.assets/arch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e14c535

Please sign in to comment.