[root@manager ~]# git clone https://github.com/kubernetes/heapster.git

[root@manager ~]# cd heapster/deploy/kube-config/influxdb/
[root@manager influxdb]# ll
total 12
-rw-r--r-- 1 root root 2276 Jan 31 16:21 grafana.yaml
-rw-r--r-- 1 root root 1100 Jan 31 16:21 heapster.yaml
-rw-r--r-- 1 root root 960 Jan 31 16:21 influxdb.yaml

[root@manager influxdb]# cat influxdb.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: monitoring-influxdb
namespace: kube-system
spec:
replicas:
template:
metadata:
labels:
task: monitoring
k8s-app: influxdb
spec:
containers:
- name: influxdb
image: registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-influxdb-amd64:v1.3.3
volumeMounts:
- mountPath: /data
name: influxdb-storage
volumes:
- name: influxdb-storage
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
labels:
task: monitoring
# For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)
# If you are NOT using this as an addon, you should comment out this line.
kubernetes.io/cluster-service: 'true'
kubernetes.io/name: monitoring-influxdb
name: monitoring-influxdb
namespace: kube-system
spec:
ports:
- port:
targetPort:
selector:
k8s-app: influxdb

[root@manager influxdb]# kubectl create -f influxdb.yaml
deployment "monitoring-influxdb" created
service "monitoring-influxdb" created
[root@manager influxdb]#
[root@manager influxdb]# kubectl get pods --namespace=kube-system -o wide
NAME READY STATUS RESTARTS AGE IP NODE
kube-dns-56d46f58f-6hhsl 3/3 Running 3 2h 10.0.71.3 192.168.10.222
kube-dns-56d46f58f-lnr86 3/3 Running 3 2h 10.0.91.4 192.168.10.221
kube-dns-56d46f58f-nbbxp 3/3 Running 3 2h 10.0.91.3 192.168.10.221
kubernetes-dashboard-7cbd9bccdc-g2kbc 1/1 Running 1 1h 10.0.71.4 192.168.10.222
monitoring-influxdb-577c9dbddb-tpdp9 1/1 Running 0 10s 10.0.71.5 192.168.10.222

[root@manager influxdb]# cat grafana.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: monitoring-grafana
namespace: kube-system
spec:
replicas:
template:
metadata:
labels:
task: monitoring
k8s-app: grafana
spec:
containers:
- name: grafana
image: registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-grafana-amd64:v4.4.3
ports:
- containerPort:
protocol: TCP
volumeMounts:
- mountPath: /etc/ssl/certs
name: ca-certificates
readOnly: true
- mountPath: /var
name: grafana-storage
env:
- name: INFLUXDB_HOST
value: monitoring-influxdb
- name: GF_SERVER_HTTP_PORT
value: ""
# The following env variables are required to make Grafana accessible via
# the kubernetes api-server proxy. On production clusters, we recommend
# removing these env variables, setup auth for grafana, and expose the grafana
# service using a LoadBalancer or a public IP.
- name: GF_AUTH_BASIC_ENABLED
value: "false"
- name: GF_AUTH_ANONYMOUS_ENABLED
value: "true"
- name: GF_AUTH_ANONYMOUS_ORG_ROLE
value: Admin
- name: GF_SERVER_ROOT_URL
# If you're only using the API Server proxy, set this value instead:
# value: /api/v1/namespaces/kube-system/services/monitoring-grafana/proxy
value: /
volumes:
- name: ca-certificates
hostPath:
path: /etc/ssl/certs
- name: grafana-storage
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
labels:
# For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)
# If you are NOT using this as an addon, you should comment out this line.
kubernetes.io/cluster-service: 'true'
kubernetes.io/name: monitoring-grafana
name: monitoring-grafana
namespace: kube-system
spec:
# In a production setup, we recommend accessing Grafana through an external Loadbalancer
# or through a public IP.
# type: LoadBalancer
# You could also use NodePort to expose the service at a randomly-generated port
# type: NodePort
ports:
- port:
targetPort:
selector:
k8s-app: grafana
[root@manager influxdb]#

[root@manager influxdb]# kubectl create -f grafana.yaml
deployment "monitoring-grafana" created
service "monitoring-grafana" created

[root@manager influxdb]# kubectl get pods --namespace=kube-system -o wide
NAME READY STATUS RESTARTS AGE IP NODE
kube-dns-56d46f58f-6hhsl 3/3 Running 3 2h 10.0.71.3 192.168.10.222
kube-dns-56d46f58f-lnr86 3/3 Running 3 2h 10.0.91.4 192.168.10.221
kube-dns-56d46f58f-nbbxp 3/3 Running 3 2h 10.0.91.3 192.168.10.221
kubernetes-dashboard-7cbd9bccdc-g2kbc 1/1 Running 1 1h 10.0.71.4 192.168.10.222
monitoring-grafana-74b966d696-rwgbn 1/1 Running 0 40s 10.0.71.6 192.168.10.222
monitoring-influxdb-577c9dbddb-tpdp9 1/1 Running 0 2m 10.0.71.5 192.168.10.222

[root@manager influxdb]# cat heapster.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: heapster
namespace: kube-system
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: heapster
namespace: kube-system
spec:
replicas:
template:
metadata:
labels:
task: monitoring
k8s-app: heapster
spec:
serviceAccountName: heapster
containers:
- name: heapster
image: registry.cn-hangzhou.aliyuncs.com/outman_google_containers/heapster-amd64:v1.4.0
imagePullPolicy: IfNotPresent
command:
- /heapster
- --source=kubernetes:http://192.168.10.220:8080?inClusterConfig=false&useServiceAccount=true&auth=
- --sink=influxdb:http://monitoring-influxdb.kube-system.svc:8086
---
apiVersion: v1
kind: Service
metadata:
labels:
task: monitoring
# For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)
# If you are NOT using this as an addon, you should comment out this line.
kubernetes.io/cluster-service: 'true'
kubernetes.io/name: Heapster
name: heapster
namespace: kube-system
spec:
ports:
- port:
targetPort:
selector:
k8s-app: heapster
[root@manager influxdb]# kubectl create -f heapster.yaml
serviceaccount "heapster" created
deployment "heapster" created
service "heapster" created
[root@manager influxdb]#
[root@manager influxdb]# kubectl get pods --namespace=kube-system -o wide
NAME READY STATUS RESTARTS AGE IP NODE
heapster-69cb687966-9s45g / Running 14s 10.0.71.7 192.168.10.222
kube-dns-56d46f58f-6hhsl / Running 2h 10.0.71.3 192.168.10.222
kube-dns-56d46f58f-lnr86 / Running 2h 10.0.91.4 192.168.10.221
kube-dns-56d46f58f-nbbxp / Running 2h 10.0.91.3 192.168.10.221
kubernetes-dashboard-7cbd9bccdc-g2kbc / Running 1h 10.0.71.4 192.168.10.222
monitoring-grafana-74b966d696-rwgbn / Running 6m 10.0.71.6 192.168.10.222
monitoring-influxdb-577c9dbddb-tpdp9 / Running 8m 10.0.71.5 192.168.10.222

kubernetes 之容器监控的更多相关文章

  1. 使用 Prometheus + Grafana 对 Kubernetes 进行性能监控的实践

    1 什么是 Kubernetes? Kubernetes 是 Google 开源的容器集群管理系统,其管理操作包括部署,调度和节点集群间扩展等. 如下图所示为目前 Kubernetes 的架构图,由 ...

  2. 三小时学会Kubernetes:容器编排详细指南

    三小时学会Kubernetes:容器编排详细指南 如果谁都可以在三个小时内学会Kubernetes,银行为何要为这么简单的东西付一大笔钱? 如果你心存疑虑,我建议你不妨跟着我试一试!在完成本文的学习后 ...

  3. [5.19 线下活动]Docker Meetup杭州站—拥抱Kubernetes,容器深度实践

    对本次线下活动感兴趣的朋友,欢迎点击此处报名,领取免费票. 今年3月,Docker刚刚过完5岁生日,五年期间,Docker也逐渐在技术和实践方面趋于成熟,更是在去年年底主动拥抱Kubernetes. ...

  4. IBM基于Kubernetes的容器云全解析

    基于Kubernetes的容器云 容器云最主要的功能是以应用为中心,帮助用户把所有的应用以容器的形式在分布式里面跑起来,最后把应用以服务的形式呈现给用户.容器云里有两个关键点,一是容器编排,二是资源调 ...

  5. 你必须知道的容器监控 (1) Docker自带子命令与Weave Scope

    本篇已加入<.NET Core on K8S学习实践系列文章索引>,可以点击查看更多容器化技术相关系列文章.本篇会介绍几个目前比较常用且流行的容器监控工具,首先我们来看看Docker自带的 ...

  6. 你必须知道的容器监控 (3) Prometheus

    本篇已加入<.NET Core on K8S学习实践系列文章索引>,可以点击查看更多容器化技术相关系列文章.上一篇介绍了Google开发的容器监控工具cAdvisor,但是其提供的操作界面 ...

  7. docker容器监控:cadvisor+influxdb+grafana

    cadvisor+influxdb+grafana可以实现容器信息获取.存储.显示等容器监控功能,是目前流行的docker监控开源方案. 方案介绍 cadvisor Google开源的用于监控基础设施 ...

  8. DevOps与Kubernetes 、容器的关系

    近两年,随着容器.Kubernetes 等技术的兴起,DevOps 这个概念被广泛提及并被大量使用. 本文将会从以下几个方面着手,结合实验展现的方式,让读者真正理解 DevOps 的含义. DevOp ...

  9. 使用 Elastic 技术栈构建 Kubernetes全栈监控

    以下我们描述如何使用 Elastic 技术栈来为 Kubernetes 构建监控环境.可观测性的目标是为生产环境提供运维工具来检测服务不可用的情况(比如服务宕机.错误或者响应变慢等),并且保留一些可以 ...

随机推荐

  1. Activiti学习记录(五)

    1.排他网关 说明: 1) 一个排他网关对应一个以上的顺序流 2) 由排他网关流出的顺序流都有个conditionExpression元素,在内部维护返回boolean类型的决策结果. 3) 决策网关 ...

  2. AngularJS 数字

    AngularJS数字就像JavaScript数字 AngularJS实例: <!DOCTYPE html><html><head><meta http-eq ...

  3. Java 替换word文档文字,指定位置插入图片

    先说下 需要的依赖包 <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ex ...

  4. 背景透明度处理 兼容IE

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. c#:无限极树形结构

    最近一直在研究树形结构菜单,无意中让我弄了出来.先上代码: 首先需要这个的一个类 public class Tree { public int id { get; set; } public stri ...

  6. Python9-MySQL-Homework-day43

    表结构 SET NAMES utf8; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure f ...

  7. 最小生成树:POJ1251-Jungle Roads(最小生成树的模板)

    POJ 1251 Jungle Roads >[poj原址:http://poj.org/problem?id=1251](http://poj.org/problem?id=1251) Des ...

  8. billard:桌球的走位路线图解

    这些是桌球的一些基础知识,记得刚学会桌球那会儿很强烈的想找到类似图片或资料,好久都找不到,最严重的时候只要一闭上眼睛,满脑子就是桌球的路线,线路图几乎是无处不在,痛苦的是经常能理解过来的很多路线因为杆 ...

  9. Curl之解决中文乱码

    利用iconv命令 curl http://www.baidu.com | iconv -f gb2312 -t utf-8 iconv命令可以将一种已知的字符集文件转换成另一种已知的字符集文件.它的 ...

  10. Django 三—— Form组件

    内容概要: 1.Django Form如何自定义验证字段 2.Django Form如何动态的显示数据库中新插入的数据 3.Tyrion Django的Form(用于验证用户请求合法性的一个组件) D ...