当前位置:网站首页>Kubernetes cluster builds ZABBIX monitoring platform
Kubernetes cluster builds ZABBIX monitoring platform
2022-07-06 06:56:00 【Fate in the Jianghu】
kubernetes Cluster building Zabbix Monitoring platform
- One 、zabbix Introduce
- Two 、 Check local k8s Environmental Science
- 3、 ... and 、 To configure nfs Shared memory
- Four 、 install zabbix-mysql
- 5、 ... and 、 Check zabbix Database service domain name
- 6、 ... and 、 install zabbix-server
- 7、 ... and 、 Deploy zabbix-web
- 8、 ... and 、 Deploy zabbix-agent
- Nine 、 visit zabbix Of web
One 、zabbix Introduce
1.zabbix brief introduction
Zabbix It's based on Web Enterprise level open source software for distributed system monitoring of interface . It can monitor the parameters of various systems and equipment , Ensure the safe operation of servers and equipment .
2.zabbix characteristic
(1) Simple installation and configuration .
(2) visualization web Management interface .
(3) Free and open source .
(4) Support Chinese .
(5) Auto discovery .
(6) Distributed monitoring .
(7) Real time drawing .
3.zabbix The main function of
1. Hardware monitoring . Such as switch 、 Router 、 Printers, etc .
2. System monitoring . Such as CPU, Memory , disk . Hard disk IO, System load, etc .
3. Service monitoring . Such as apache,nginx,tomcat,redis,TCP Number of connections, etc .
4. Performance monitoring . Such as website performance , Server performance , Database performance .
5. Log monitoring . Such as access log , Error log .
6. Safety monitoring . Such as the number of user logins , Local file changes ,passwd Document changes .
7. network monitoring . Such as port ,SMTP, Network usage , Network traffic , Network traffic .
4.zabbix Architecture diagram

Two 、 Check local k8s Environmental Science
1. Check the system pod Running state
[[email protected]-master ~]# kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-kube-controllers-7bc6547ffb-2nf66 1/1 Running 1 (9m28s ago) 2d16h
kube-system calico-node-8c4pn 1/1 Running 1 (9m16s ago) 2d16h
kube-system calico-node-f28qq 1/1 Running 1 (9m10s ago) 2d16h
kube-system calico-node-wmc2j 1/1 Running 1 (9m29s ago) 2d16h
kube-system coredns-6d8c4cb4d-6gm4x 1/1 Running 1 (9m28s ago) 2d16h
kube-system coredns-6d8c4cb4d-7vxlz 1/1 Running 1 (9m29s ago) 2d16h
kube-system etcd-k8s-master 1/1 Running 1 (9m30s ago) 2d16h
kube-system kube-apiserver-k8s-master 1/1 Running 1 (9m29s ago) 2d16h
kube-system kube-controller-manager-k8s-master 1/1 Running 1 (9m30s ago) 2d16h
kube-system kube-proxy-8dfw8 1/1 Running 1 (9m29s ago) 2d16h
kube-system kube-proxy-ghzrv 1/1 Running 1 (9m9s ago) 2d16h
kube-system kube-proxy-j867z 1/1 Running 1 (9m15s ago) 2d16h
kube-system kube-scheduler-k8s-master 1/1 Running 1 (9m28s ago) 2d16h
2. Check node Node status
[[email protected]-master ~]# kubectl get nodes -owide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
k8s-master Ready control-plane,master 2d16h v1.23.1 192.168.3.201 <none> CentOS Linux 7 (Core) 3.10.0-957.el7.x86_64 containerd://1.6.6
k8s-node01 Ready <none> 2d16h v1.23.1 192.168.3.202 <none> CentOS Linux 7 (Core) 3.10.0-957.el7.x86_64 containerd://1.6.6
k8s-node02 Ready <none> 2d16h v1.23.1 192.168.3.203 <none> CentOS Linux 7 (Core) 3.10.0-957.el7.x86_64 containerd://1.6.6
3、 ... and 、 To configure nfs Shared memory
1. install nfs
yum install -y nfs-utils
2. Create shared directory
mkdir -p /nfs/data
3. Configure shared directory
echo "/nfs/data/ *(insecure,rw,sync,no_root_squash)" > /etc/exports
4… Start related services
systemctl enable rpcbind
systemctl enable nfs-server
systemctl start rpcbind
5. Make configuration effective
exportfs -r
1
6. see nfs
[[email protected]-master ~]# exportfs
/nfs/data <world>
7. Other node inspection nfs share
[[email protected]-node01 ~]# showmount -e 192.168.3.201
Export list for 192.168.3.201:
/nfs/data *
Four 、 install zabbix-mysql
1. To write zabbix-mysql Of yaml file
[[email protected]-master zabbix]# cat zabbix_mysql.yaml
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: zabbixdb-pv
spec:
capacity: # Create storage size
storage: 10Gi
volumeMode: Filesystem # Type of storage
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Recycle
nfs:
path: /nfs/data/zabbix
server: 192.168.3.201
mountOptions:
- hard
- nfsvers=4.1
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: zabbixdb-pvc
namespace: zabbix
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem # Storage type , Block storage Block
resources:
requests:
storage: 8Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: zabbixdb
name: zabbixdb
namespace: zabbix
spec:
replicas: 1
selector:
matchLabels:
app: zabbixdb
strategy: {
}
template:
metadata:
labels:
app: zabbixdb
spec:
volumes:
- name: zabbixdb-data
persistentVolumeClaim:
claimName: zabbixdb-pvc
containers:
- image: mysql:8.0
name: mysql
ports:
- name: mysql
containerPort: 3306
protocol: TCP
volumeMounts:
- name: zabbixdb-data
mountPath: /var/lib/mysql
env:
- name: MYSQL_DATABASE
value: 'zabbix'
- name: MYSQL_USER
value: 'zabbix'
- name: MYSQL_PASSWORD
value: 'zabbix'
- name: MYSQL_ROOT_PASSWORD
value: 'zabbix'
resources:
requests:
cpu: 0.1
memory: 128Mi
limits:
cpu: 0.3
memory: 512Mi
---
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app: zabbixdb
name: zabbixdb
namespace: zabbix
spec:
clusterIP: 10.96.1.99
ports:
- name: 3306-3306
port: 3306
protocol: TCP
targetPort: 3306
selector:
app: zabbixdb
type: ClusterIP
status:
loadBalancer: {
}
2. Create a namespace
[[email protected]-master zabbix]# kubectl create namespace zabbix
namespace/zabbix created
3. establish zabbix database
kubectl apply -f zabbix_mysql.yaml
4. Check pod state
[[email protected]-master zabbix]# kubectl get pods -n zabbix
NAME READY STATUS RESTARTS AGE
zabbixdb-69b7cd8dff-jnpjd 1/1 Running 0 11m
5、 ... and 、 Check zabbix Database service domain name
1. Run the test pod
[[email protected]-master ~]# kubectl run busybox --image=busybox:1.28 -- sleep 3600
pod/busybox created
2. Get into busybox Of pod
[[email protected]-master ~]# kubectl exec -it busybox -- /bin/sh
/ #
3. See domain name resolution
[[email protected]-master ~]# kubectl exec -it busybox -- /bin/sh
/ # nslookup zabbixdb.zabbix.svc.cluster.local
Server: 10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local
Name: zabbixdb.zabbix.svc.cluster.local
Address 1: 10.96.1.99 zabbixdb.zabbix.svc.cluster.local
/ #
6、 ... and 、 install zabbix-server
1. To write zabbix_server.yaml file
[[email protected]-master zabbix]# cat zabbix_server.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: zabbix-server
name: zabbix-server
namespace: zabbix
spec:
replicas: 1
selector:
matchLabels:
app: zabbix-server
strategy: {
}
template:
metadata:
creationTimestamp: null
labels:
app: zabbix-server
spec:
volumes:
- name: zabbix-scripts
hostPath:
path: /usr/lib/zabbix/
- name: zabbix-file
hostPath:
path: /var/lib/zabbix
nodeSelector:
zabbix-server: "true"
hostNetwork: true
containers:
- image: zabbix/zabbix-server-mysql:6.0-ubuntu-latest
name: zabbix-server-mysql
env:
- name: DB_SERVER_HOST
value: 10.96.1.99
- name: MYSQL_USER
value: zabbix
- name: MYSQL_PASSWORD
value: zabbix
resources: {
}
status: {
}
2. to node02 Label nodes
[[email protected]-master zabbix]# kubectl label nodes k8s-node02 zabbix-server=true
node/k8s-node02 labeled
3. install zabbix-server
[[email protected]-master zabbix]# kubectl apply -f zabbix_server.yaml
deployment.apps/zabbix-server created
4. Check pod state
[[email protected]-master zabbix]# kubectl get pods -n zabbix
NAME READY STATUS RESTARTS AGE
zabbix-server-5f48d9d57d-rkr5p 1/1 Running 0 66s
zabbixdb-69b7cd8dff-krt2w 1/1 Running 0 4m22s
7、 ... and 、 Deploy zabbix-web
1. To write zabbix_web.yaml file
[[email protected]-master zabbix]# cat zabbix_web.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: zabbix-web
name: zabbix-web
namespace: zabbix
spec:
replicas: 1
selector:
matchLabels:
app: zabbix-web
strategy: {
}
template:
metadata:
creationTimestamp: null
labels:
app: zabbix-web
spec:
containers:
- image: zabbix/zabbix-web-nginx-mysql:6.0-ubuntu-latest
name: zabbix-web-nginx-mysql
env:
- name: DB_SERVER_HOST
value: zabbixdb.zabbix.svc.cluster.local
- name: MYSQL_USER
value: zabbix
- name: MYSQL_PASSWORD
value: zabbix
- name: ZBX_SERVER_HOST
value: 192.168.3.201
- name: PHP_TZ
value: Asia/shanghai
resources: {
}
status: {
}
---
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app: zabbix-web
name: zabbix-web
namespace: zabbix
spec:
ports:
- name: 8080-8080
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: zabbix-web
type: NodePort
status:
loadBalancer: {
}
2. install zabbix-web
[[email protected]-master zabbix]# kubectl apply -f zabbix_web.yaml
deployment.apps/zabbix-web created
service/zabbix-web created
3. see pod state
[[email protected]-master zabbix]# kubectl get pods -n zabbix
NAME READY STATUS RESTARTS AGE
zabbix-server-5f48d9d57d-rkr5p 1/1 Running 0 2m36s
zabbix-web-55cd66f74f-9f284 1/1 Running 0 18s
zabbixdb-69b7cd8dff-krt2w 1/1 Running 0 5m52s
8、 ... and 、 Deploy zabbix-agent
1. edit zabbix_agent.yaml
[[email protected]-master zabbix]# cat zabbix_agent.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: zabbix-agent
name: zabbix-agent
namespace: zabbix
spec:
selector:
matchLabels:
app: zabbix-agent
template:
metadata:
creationTimestamp: null
labels:
app: zabbix-agent
spec:
hostNetwork: true
containers:
- image: zabbix/zabbix-agent:6.0-ubuntu-latest
name: zabbix-agent
env:
- name: ZBX_SERVER_HOST
value: 192.168.3.201
resources: {
}
2. install zabbix-agent
kubectl apply -f zabbix_agent.yaml
3. see pod state
[[email protected]-master zabbix]# kubectl get pods -n zabbix
NAME READY STATUS RESTARTS AGE
zabbix-agent-h2qwf 1/1 Running 0 3s
zabbix-agent-plnbd 1/1 Running 0 3s
zabbix-server-5f48d9d57d-rkr5p 1/1 Running 0 3m2s
zabbix-web-55cd66f74f-9f284 1/1 Running 0 44s
zabbixdb-69b7cd8dff-krt2w 1/1 Running 0 6m18s
Nine 、 visit zabbix Of web
1. see svc
[[email protected]-master zabbix]# kubectl get svc -n zabbix
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
zabbix-web NodePort 10.100.50.7 <none> 8080:30775/TCP 59s
zabbixdb ClusterIP 10.96.1.99 <none> 3306/TCP 6m33s
2. Sign in web
http://192.168.3.202:30775
3. Sign in zabbix
Initial account number admin/zabbix

4. Inquire about zabbix-server Monitoring item chart of

边栏推荐
- Delete external table source data
- GET 和 POST 请求类型的区别
- Misc of BUU (update from time to time)
- PCL realizes frame selection and clipping point cloud
- [server data recovery] case of offline data recovery of two hard disks of IBM server RAID5
- WPF之MVVM
- Due to high network costs, arbitrum Odyssey activities are suspended, and nitro release is imminent
- A method to measure the similarity of time series: from Euclidean distance to DTW and its variants
- Office doc add in - Online CS
- Monotonic stack
猜你喜欢

Proteus -- Serial Communication parity flag mode

ROS learning_ Basics

WPF之MVVM

Apache dolphin scheduler source code analysis (super detailed)

19. Actual memory management of segment page combination

18. Multi level page table and fast table

Windows Server 2016 standard installing Oracle

AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models. common‘ from ‘/home/yolov5/models/comm

leetcode35. 搜索插入位置(简单,找插入位置,不同写法)

Lesson 7 tensorflow realizes convolutional neural network
随机推荐
Three methods of adding color to latex text
Pallet management in SAP SD delivery process
Introduction and underlying analysis of regular expressions
Leetcode daily question (1870. minimum speed to arrive on time)
软件测试外包到底要不要去?三年真实外包感受告诉你
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
GET 和 POST 请求类型的区别
Delete external table source data
The difference between get and post request types
[English] Verb Classification of grammatical reconstruction -- English rabbit learning notes (2)
SAP SD发货流程中托盘的管理
Supporting title of the book from 0 to 1: ctfer's growth road (Zhou Geng)
3. Business and load balancing of high architecture
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Every API has its foundation when a building rises from the ground
Hydra common commands
云上有AI,让地球科学研究更省力
L'Ia dans les nuages rend la recherche géoscientifique plus facile
Blue Bridge Cup zero Foundation National Championship - day 20
[brush questions] how can we correctly meet the interview?
