IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 网络协议 -> dashboard -> 正文阅读

[网络协议]dashboard

dashboard安装

web页面访问k8s集群

将软件包上传到master上

[root@ecs-proxy ~]# cd 5/kubernetes/v1.17.6/

[root@ecs-proxy v1.17.6]# scp -r dashboard/ 192.168.1.21:/root

[root@master ~]# cd dashboard/

[root@master dashboard]# docker load -i dashboard.tar.gz 导入镜像

69e42300d7b5: Loading layer 224.6MB/224.6MB Loaded image: kubernetesui/dashboard:v2.0.0 [root@master dashboard]# docker tag kubernetesui/dashboard:v2.0.0 #打标签192.168.1.100:5000/dashboard:v2.0.0

[root@master dashboard]# docker push 192.168.1.100:5000/dashboard:v2.0.0

The push refers to repository

[192.168.1.100:5000/dashboard] 69e42300d7b5: Pushed v2.0.0: digest: sha256:b05326def4ecdfa9380f43b2ebc1642cc213958c8b014298e60d90ad85257a95 size: 529 [root@master dashboard]# docker load -i metrics-scraper.tar.gz

57757cd7bb95: Loading layer 238.6kB/238.6kB 14f2e8fb1e35: Loading layer 36.7MB/36.7MB 52b345e4c8e0: Loading layer 2.048kB/2.048kB Loaded image: kubernetesui/metrics-scraper:v1.0.4

[root@master dashboard]# docker tag kubernetesui/metrics-scraper:v1.0.4 192.168.1.100:5000/metrics-scraper:v1.0.4 打标签

[root@master dashboard]# docker push 192.168.1.100:5000/metrics-scraper:v1.0.4 上传到私有仓库

The push refers to repository [192.168.1.100:5000/metrics-scraper] 52b345e4c8e0: Pushed 14f2e8fb1e35: Pushed 57757cd7bb95: Pushed v1.0.4: digest: sha256:d78f995c07124874c2a2e9b404cffa6bc6233668d63d6c6210574971f3d5914b size: 946 [root@master dashboard]# kubectl apply -f recommended.yaml

[root@master dashboard]# kubectl -n kubernetes-dashboard get pod

NAME READY STATUS RESTARTS AGE

dashboard-metrics-scraper-57bf85fcc9-znlxq 1/1 Running 0 9s

kubernetes-dashboard-7b7f78bcf9-wmhjb 1/1 Running 0 9s

[root@master dashboard]# vim recommended.yaml

[root@master dashboard]# vim service.yaml 修改资源文件 190,174设置镜像地址 [root@master dashboard]# kubectl apply -f service.yaml service/kubernetes-dashboard configured

[root@master dashboard]# kubectl -n kubernetes-dashboard get service

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE dashboard-metrics-scraper ClusterIP 10.254.72.204 <none> 8000/TCP 11m

kubernetes-dashboard NodePort 10.254.242.176 <none> 443:30443/TCP 11m

购买弹性公网IP绑定node节点任意一台主机

访问测试 浏览器输入 https://弹性公网IP:30443

?

获取token

[root@master dashboard]# kubectl apply -f admin-token.yaml

serviceaccount/admin-user created clusterrolebinding.rbac.authorization.k8s.io/admin-user created

[root@master dashboard]# kubectl -n kubernetes-dashboard get secrets

NAME TYPE DATA AGE admin-user-token-xnsp2 kubernetes.io/service-account-token 3 16s default-token-2qkwp kubernetes.io/service-account-token 3 25m

kubernetes-dashboard-certs Opaque 0 25m kubernetes-dashboard-csrf Opaque 1 25m kubernetes-dashboard-key-holder Opaque 2 25m kubernetes-dashboard-token-2njkp kubernetes.io/service-account-token 3 25m

[root@master dashboard]# kubectl -n kubernetes-dashboard describe secrets

admin-user-token-bxjlz Error from server (NotFound): secrets "admin-user-token-bxjlz" not found [root@master dashboard]# kubectl -n kubernetes-dashboard describe secrets

admin-user-token-xnsp2 Name: admin-user-token-xnsp2 Namespace: kubernetes-dashboard Labels: <none> Annotations: kubernetes.io/service-account.name: admin-user kubernetes.io/service-account.uid: 32abeb95-10d6-4f9f-96e5-bbc6db6b3bb9

Type: kubernetes.io/service-account-token

Data

ca.crt: 1025 bytes namespace: 20 bytes

token: ........... # 此处就是需要的token

输入token登录web页面

?

?

Prometheus

prom-server 核心数据库

1、导入镜像

将Prometheus包从跳板机拷贝到master上

[root@ecs-proxy ~]# cd 5/kubernetes/v1.17.6/

[root@ecs-proxy v1.17.6]# scp -r prometheus/ 192.168.1.21:/root

[root@master ~]# cd prometheus/

[root@master prometheus]# ls alertmanager grafana-json metrics-state prom-adapter setup grafana images node-exporter prom-server

[root@master prometheus]# cd images/

[root@master images]# for i in *.gz;do docker load -i ${i};done? ? #导入镜像

[root@master images]# img="prom/node-exporter v1.0.0? ? ? ? ? ? ?#打标签 quay.io/coreos/prometheus-config-reloader v0.35.1 quay.io/coreos/prometheus-operator v0.35.1 quay.io/coreos/kube-state-metrics v1.9.2 grafana/grafana 6.4.3 jimmidyson/configmap-reload v0.3.0 quay.io/prometheus/prometheus v2.11.0 quay.io/prometheus/alertmanager v0.18.0 quay.io/coreos/k8s-prometheus-adapter-amd64 v0.5.0 quay.io/coreos/kube-rbac-proxy v0.4.1"

[root@master images]# while read f _v;do read读取变量,可以给多个变量赋值 f镜像名称 v 镜像标签

docker tag ${f}:${v} 192.168.1.100:5000/${f##/}:${v}? ? ? ? ?#将镜像上传到私有仓库 docker push 192.168.1.100:5000/${f##/}:${v} docker rmi ${f}:${_v} done <<<"${img}"

[root@master images]# curl http://192.168.1.100:5000/v2/_catalog #查看

{"repositories":["alertmanager","configmap-reload","coredns","dashboard","etcd","flannel","grafana","k8s-prometheus-adapter-amd64","kube-apiserver","kube-controller-manager","kube-proxy","kube-rbac-proxy","kube-scheduler","kube-state-metrics","metrics-scraper","metrics-server","myos","nginx-ingress-controller","node-exporter","pause","prometheus","prometheus-config-reloader","prometheus-operator"]}

operator安装(核心数据库)

拷贝prometheus/setup 目录到 master 下

[root@master ~]# cd prometheus/

[root@master prometheus]# curl http://192.168.1.100:5000/v2/configmap-reload/tags/list #查看镜像 {"name":"configmap-reload","tags":["v0.3.0"]}

[root@master prometheus]# curl http://192.168.1.100:5000/v2/configmap-reload/tags/list #查看镜像 {"name":"configmap-reload","tags":["v0.3.0"]}

[root@master prometheus]# curl http://192.168.1.100:5000/v2/prometheus-config-reloader/tags/list #查看镜像

{"name":"prometheus-config-reloader","tags":["v0.35.1"]}

[root@master prometheus]# curl http://192.168.1.100:5000/v2/prometheus-operator/tags/list #查看镜像

{"name":"prometheus-operator","tags":["v0.35.1"]}

[root@master prometheus]# vim setup/prometheus-operator-deployment.yaml #修改配置文件

27: - --config-reloader-image=192.168.1.100:5000/configmap-reload:v0.3.0

28: - --prometheus-config-reloader=192.168.1.100:5000/prometheus-config-reloader:v0.35.1

29: image: 192.168.1.100:5000/prometheus-operator:v0.35.1

[root@master prometheus]# kubectl apply -f setup/ #验证安装

[root@master prometheus]# kubectl -n monitoring get pod #查看安装

NAME READY STATUS RESTARTS AGE

prometheus-operator-75b4b59b74-wfcc4 1/1 Running 0 8s

prometheus server 安装

[root@master prometheus]# curl http://192.168.1.100:5000/v2/prometheus/tags/list #查看镜像是否存在

{"name":"prometheus","tags":["v2.11.0"]}

[root@master prometheus]# vim prom-server/prometheus-prometheus.yaml #修改配置文件

14: baseImage: 192.168.1.100:5000/prometheus 34: version: v2.11.0

[root@master prometheus]# kubectl apply -f prom-server/

[root@master prometheus]# kubectl -n monitoring get pod #查看安装

NAME READY STATUS RESTARTS AGE

prometheus-k8s-0 3/3 Running 1 8s

prometheus-k8s-1 3/3 Running 1 8s

prometheus-operator-75b4b59b74-wfcc4 1/1 Running 0 2m13s

安装数据收集插件(3)

拷贝 prometheus/prom-adapter 目录到 master 下

[root@master prometheus]# curl http://192.168.1.100:5000/v2/k8s-prometheus-adapter-amd64/tags/list #查看镜像

{"name":"k8s-prometheus-adapter-amd64","tags":["v0.5.0"]}

[root@master prometheus]# vim prom-adapter/prometheus-adapter-deployment.yaml #修改配置文件

28: image: 192.168.1.100:5000/k8s-prometheus-adapter-amd64:v0.5.0

[root@master prometheus]# kubectl apply -f prom-adapter #安装

[root@master prometheus]# kubectl -n monitoring get pod #查看

NAME READY STATUS RESTARTS AGE

prometheus-adapter-856854f9f6-knqtq 1/1 Running 0 6s

拷贝 prometheus/metrics-state 目录到 master 下

[root@master prometheus]# curl http://192.168.1.100:5000/v2/kube-state-metrics/tags/list #查看镜像

{"name":"kube-state-metrics","tags":["v1.9.2"]}

[root@master prometheus]# curl http://192.168.1.100:5000/v2/kube-rbac-proxy/tags/list #查看镜像

{"name":"kube-rbac-proxy","tags":["v0.4.1"]}

[root@master prometheus]# vim metrics-state/kube-state-metrics-deployment.yaml #修改配置文件

24: image: 192.168.1.100:5000/kube-rbac-proxy:v0.4.1

41: image: 192.168.1.100:5000/kube-rbac-proxy:v0.4.1

58: image: 192.168.1.100:5000/kube-state-metrics:v1.9.2

[root@master prometheus]# kubectl apply -f metrics-state/ #安装

[root@master prometheus]# kubectl -n monitoring get pod #查看

NAME READY STATUS RESTARTS AGE

kube-state-metrics-5894f64799-krvn6 3/3 Running 0 4s

拷贝 prometheus/node-exporter 目录到 master 下

[root@master prometheus]# curl http://192.168.1.100:5000/v2/node-exporter/tags/list {"name":"node-exporter","tags":["v1.0.0"]}

[root@master prometheus]# curl http://192.168.1.100:5000/v2/kube-rbac-proxy/tags/list {"name":"kube-rbac-proxy","tags":["v0.4.1"]}

[root@master prometheus]# vim node-exporter/node-exporter-daemonset.yaml

27: image: 192.168.1.100:5000/node-exporter:v1.0.0 57: image: 192.168.1.100:5000/kube-rbac-proxy:v0.4.1

[root@master prometheus]# kubectl apply -f node-exporter/ #安装

[root@master prometheus]# kubectl -n monitoring get pod #查看

NAME READY STATUS RESTARTS AGE

node-exporter-7h4l9 2/2 Running 0 7s

node-exporter-7vxmx 2/2 Running 0 7s

node-exporter-mr6lw 2/2 Running 0 7s

node-exporter-zg2j8 2/2 Running 0 7s

告警模块 baseImage

拷贝 prometheus/alertmanager 目录到 master 下

[root@master prometheus]# curl http://192.168.1.100:5000/v2/alertmanager/tags/list #查看镜像 {"name":"alertmanager","tags":["v0.18.0"]}

[root@master prometheus]# vim alertmanager/alertmanager-alertmanager.yaml #修改配置文件 09: baseImage: 192.168.1.100:5000/alertmanager

18: version: v0.18.0

[root@master prometheus]# kubectl apply -f alertmanager/ #安装

[root@master prometheus]# kubectl -n monitoring get pod #查看

NAME READY STATUS RESTARTS AGE

alertmanager-main-0 2/2 Running 0 16s

alertmanager-main-1 2/2 Running 0 16s

alertmanager-main-2 2/2 Running 0 16s

grafana模块

拷贝 prometheus/grafana 目录到 master 下

[root@master prometheus]# curl http://192.168.1.100:5000/v2/grafana/tags/list #查看镜像 {"name":"grafana","tags":["6.4.3"]}

[root@master prometheus]# vim grafana/grafana-deployment.yaml #修改配置文件

19: - image: 192.168.1.100:5000/grafana:6.4.3

[root@master prometheus]# kubectl apply -f grafana/ #安装

[root@master prometheus]# kubectl -n monitoring get pod #查看

NAME READY STATUS RESTARTS AGE

grafana-647d948b69-d2hv9 1/1 Running 0 19s

插件安装完成,查看

[root@master prometheus]# kubectl -n monitoring get pod #查看安装的插件

NAME READY STATUS RESTARTS AGE

alertmanager-main-0 2/2 Running 0 60s

alertmanager-main-1 2/2 Running 0 105s

alertmanager-main-2 2/2 Running 0 2m43s

grafana-647d948b69-4dg69 1/1 Running 0 6m12s

kube-state-metrics-5894f64799-58hsh 3/3 Running 0 17m

node-exporter-7lv4m 2/2 Running 0 15m

node-exporter-g4rd6 2/2 Running 0 15m

node-exporter-tzrlm 2/2 Running 0 15m

node-exporter-wnng8 2/2 Running 0 15m

prometheus-adapter-856854f9f6-lrknp 1/1 Running 0 19m

prometheus-k8s-0 3/3 Running 1 166m

prometheus-k8s-1 3/3 Running 1 166m

prometheus-operator-75b4b59b74-wfcc4 1/1 Running 0 168m

[root@master prometheus]# kubectl -n monitoring get service #查看服务

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE

alertmanager-main ClusterIP 10.254.40.49 <none> 9093/TCP 6m28s

alertmanager-operated ClusterIP None <none> 9093/TCP,9094/TCP,9094/UDP 6m28s

grafana ClusterIP 10.254.88.197 <none> 3000/TCP 5m19s

kube-state-metrics ClusterIP None <none> 8443/TCP,9443/TCP 16m

node-exporter ClusterIP None <none> 9100/TCP 14m

prometheus-adapter ClusterIP 10.254.114.100 <none> 443/TCP 18m

prometheus-k8s ClusterIP 10.254.194.227 <none> 9090/TCP 165m

prometheus-operated ClusterIP None <none> 9090/TCP 165m

prometheus-operator ClusterIP None <none> 8080/TCP 167m

发布服务

[root@master prometheus]# vim grafana-service.yaml

[root@master prometheus]# kubectl apply -f grafana-service.yaml service/grafana configured [root@master prometheus]# kubectl -n monitoring get service

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE

alertmanager-main ClusterIP 10.254.40.49 <none> 9093/TCP 19m

alertmanager-operated ClusterIP None <none> 9093/TCP,9094/TCP,9094/UDP 19m

grafana NodePort 10.254.88.197 <none> 3000:30000/TCP 18m

kube-state-metrics ClusterIP None <none> 8443/TCP,9443/TCP 29m

node-exporter ClusterIP None <none> 9100/TCP 27m

prometheus-adapter ClusterIP 10.254.114.100 <none> 443/TCP 31m

prometheus-k8s ClusterIP 10.254.194.227 <none> 9090/TCP 178m

prometheus-operated ClusterIP None <none> 9090/TCP 178m

prometheus-operator ClusterIP None <none> 8080/TCP

浏览器访问 http://公网IP:30000 (公网IP是之前绑定node节点的IP)?

导入数据源,配置监控节点

导入数据源

?配置监控节点

?查看配置

?

?

  网络协议 最新文章
使用Easyswoole 搭建简单的Websoket服务
常见的数据通信方式有哪些?
Openssl 1024bit RSA算法---公私钥获取和处
HTTPS协议的密钥交换流程
《小白WEB安全入门》03. 漏洞篇
HttpRunner4.x 安装与使用
2021-07-04
手写RPC学习笔记
K8S高可用版本部署
mySQL计算IP地址范围
上一篇文章      下一篇文章      查看所有文章
加:2021-08-12 17:02:27  更:2021-08-12 17:03:28 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/25 19:46:26-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码