forked from easzlab/kubeasz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
新增metrics-server、cluster-addon文档及相关文档更新
- Loading branch information
Showing
11 changed files
with
85 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# 安装集群主要插件 | ||
|
||
目前挑选一些常用、必要的插件自动集成到安装脚本之中: | ||
- [配置开关](../roles/cluster-addon/defaults/main.yml) | ||
- [自动脚本](../roles/cluster-addon/tasks/main.yml) | ||
|
||
## 脚本介绍 | ||
|
||
- 1.根据hosts文件中配置的`CLUSTER_DNS_SVC_IP` `CLUSTER_DNS_DOMAIN`等参数生成kubedns.yaml和coredns.yaml文件 | ||
- 2.注册变量pod_info,pod_info用来判断现有集群是否已经运行各种插件 | ||
- 3.根据pod_info和[配置开关](../roles/cluster-addon/defaults/main.yml)逐个进行/跳过插件安装 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Metrics Server | ||
|
||
从 v1.8 开始,资源使用情况的度量(如容器的 CPU 和内存使用)可以通过 Metrics API 获取;前提是集群中要部署 Metrics Server,它从Kubelet 公开的Summary API采集指标信息,关于更多的背景介绍请参考如下文档: | ||
- Metrics Server[设计提案](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/instrumentation/metrics-server.md) | ||
|
||
大致是说它符合k8s的监控架构设计,受heapster项目启发,并且比heapster优势在于:访问不需要apiserver的代理机制,提供认证和授权等;很多集群内组件依赖它(HPA,scheduler,kubectl top),因此它应该在集群中默认运行;部分k8s集群的安装工具已经默认集成了Metrics Server的安装,以下概述下它的安装: | ||
|
||
- 1.metric-server是扩展的apiserver,依赖于[kube-aggregator](https://github.com/kubernetes/kube-aggregator),因此需要在apiserver中开启相关参数。 | ||
- 2.需要在集群中运行deploy处理请求 | ||
|
||
从kubeasz 1.0.1 开始,metrics-server已经默认集成在集群安装脚本中,请查看`roles/cluster-addon/defaults/main.yml`中的设置 | ||
|
||
## 安装 | ||
|
||
默认已集成在90.setup.yml中,如果分步请执行`ansible-play /etc/ansible/07.cluster-addon.yml` | ||
|
||
- 1.设置apiserver相关[参数](../../roles/kube-master/templates/kube-apiserver.service.j2) | ||
``` bash | ||
... # 省略 | ||
--requestheader-client-ca-file={{ ca_dir }}/ca.pem \ | ||
--requestheader-allowed-names=aggregator \ | ||
--requestheader-extra-headers-prefix=X-Remote-Extra- \ | ||
--requestheader-group-headers=X-Remote-Group \ | ||
--requestheader-username-headers=X-Remote-User \ | ||
--proxy-client-cert-file={{ ca_dir }}/aggregator-proxy.pem \ | ||
--proxy-client-key-file={{ ca_dir }}/aggregator-proxy-key.pem \ | ||
--enable-aggregator-routing=true \ | ||
``` | ||
- 2.生成[aggregator proxy相关证书](../../roles/kube-master/tasks/main.yml) | ||
|
||
参考1:https://kubernetes.io/docs/tasks/access-kubernetes-api/configure-aggregation-layer/ | ||
参考2:https://kubernetes.io/docs/tasks/access-kubernetes-api/setup-extension-api-server/ | ||
|
||
## 验证 | ||
|
||
- 查看生成的新api:v1beta1.metrics.k8s.io | ||
``` bash | ||
$ kubectl get apiservice|grep metrics | ||
v1beta1.metrics.k8s.io 1d | ||
``` | ||
|
||
- 查看kubectl top命令(无需额外安装heapster) | ||
``` bash | ||
$ kubectl top node | ||
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY% | ||
192.168.1.1 116m 2% 2342Mi 60% | ||
192.168.1.2 79m 1% 1824Mi 47% | ||
192.168.1.3 82m 2% 1897Mi 49% | ||
$ kubectl top pod --all-namespaces # 输出略 | ||
``` | ||
|
||
- 验证基于metrics-server实现的基础hpa自动缩放,请参考[hpa.md](hpa.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ | |
<tr> | ||
<td>基础服务</td> | ||
<td>metrics server</td> | ||
<td>进行中</td> | ||
<td>已完成</td> | ||
</tr> | ||
<tr> | ||
<td>集群部署</td> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters