Add Glances deployment and configuration for Debian and Kubernetes
This commit is contained in:
parent
2ca03d622b
commit
03cdf9f355
13
ansible/playbooks/setup-glances-debian.yaml
Normal file
13
ansible/playbooks/setup-glances-debian.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
# Run: ansible-playbook ansible/playbooks/setup-glances-debian.yaml
|
||||
#
|
||||
# What this does:
|
||||
# - Deploys Glances on Debian as a Docker container
|
||||
# - Accessible at http://192.168.7.183:61208
|
||||
|
||||
- name: Deploy Glances on Debian
|
||||
hosts: debian
|
||||
gather_facts: true
|
||||
|
||||
roles:
|
||||
- glances
|
||||
6
ansible/roles/glances/handlers/main.yaml
Normal file
6
ansible/roles/glances/handlers/main.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: Restart Glances container
|
||||
community.docker.docker_container:
|
||||
name: glances
|
||||
state: started
|
||||
restart: true
|
||||
35
ansible/roles/glances/tasks/main.yaml
Normal file
35
ansible/roles/glances/tasks/main.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
- name: Create Glances config directory
|
||||
ansible.builtin.file:
|
||||
path: /etc/glances
|
||||
state: directory
|
||||
mode: "0755"
|
||||
become: true
|
||||
|
||||
- name: Write Glances config
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/glances/glances.conf
|
||||
content: |
|
||||
[fs]
|
||||
hide=/etc/.*,/boot.*
|
||||
mode: "0644"
|
||||
become: true
|
||||
notify: Restart Glances container
|
||||
|
||||
- name: Run Glances container
|
||||
community.docker.docker_container:
|
||||
name: glances
|
||||
image: nicolargo/glances:latest-full
|
||||
state: started
|
||||
restart_policy: unless-stopped
|
||||
pid_mode: host
|
||||
network_mode: host
|
||||
privileged: true
|
||||
env:
|
||||
GLANCES_OPT: "-w --config /etc/glances/glances.conf"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
- /proc:/proc:ro
|
||||
- /sys:/sys:ro
|
||||
- /mnt:/mnt:ro
|
||||
- /etc/glances:/etc/glances:ro
|
||||
@ -75,53 +75,50 @@ sections:
|
||||
cols: 2
|
||||
collapsed: false
|
||||
hideForGuests: false
|
||||
- name: System
|
||||
- name: System — Minisforum
|
||||
icon: mdi-server
|
||||
widgets:
|
||||
- type: gl-current-cpu
|
||||
label: CPU (current)
|
||||
label: CPU
|
||||
options:
|
||||
hostname: http://nik4nao.home.arpa:61208
|
||||
hostname: https://glances.home.arpa
|
||||
apiVersion: 4
|
||||
id: 0_645_glcurrentcpu
|
||||
- type: gl-current-mem
|
||||
label: Memory (current)
|
||||
label: Memory
|
||||
options:
|
||||
hostname: http://nik4nao.home.arpa:61208
|
||||
hostname: https://glances.home.arpa
|
||||
apiVersion: 4
|
||||
id: 1_645_glcurrentmem
|
||||
- type: gl-cpu-history
|
||||
label: CPU (history)
|
||||
label: CPU History
|
||||
options:
|
||||
hostname: http://nik4nao.home.arpa:61208
|
||||
hostname: https://glances.home.arpa
|
||||
apiVersion: 4
|
||||
limit: 60
|
||||
id: 2_645_glcpuhistory
|
||||
- type: gl-mem-history
|
||||
label: Memory (history)
|
||||
label: Memory History
|
||||
options:
|
||||
hostname: http://nik4nao.home.arpa:61208
|
||||
hostname: https://glances.home.arpa
|
||||
apiVersion: 4
|
||||
limit: 80
|
||||
id: 3_645_glmemhistory
|
||||
displayData:
|
||||
sortBy: default
|
||||
rows: 10
|
||||
cols: 1
|
||||
collapsed: false
|
||||
hideForGuests: false
|
||||
- name: Storage
|
||||
limit: 60
|
||||
|
||||
- name: System — Debian
|
||||
icon: mdi-harddisk
|
||||
widgets:
|
||||
- type: gl-disk-space
|
||||
label: Storage Pool (/mnt/storage)
|
||||
- type: gl-current-cpu
|
||||
label: CPU
|
||||
options:
|
||||
hostname: http://nik4nao.home.arpa:61208
|
||||
hostname: https://glances-debian.home.arpa
|
||||
apiVersion: 4
|
||||
- type: gl-current-mem
|
||||
label: Memory
|
||||
options:
|
||||
hostname: https://glances-debian.home.arpa
|
||||
apiVersion: 4
|
||||
- type: gl-disk-space
|
||||
label: Debian Storage
|
||||
options:
|
||||
hostname: https://glances-debian.home.arpa
|
||||
apiVersion: 4
|
||||
id: 0_725_gldiskspace
|
||||
displayData:
|
||||
rows: 1
|
||||
cols: 1
|
||||
- name: Shortcuts
|
||||
icon: mdi-bookmark-outline
|
||||
items:
|
||||
|
||||
49
manifests/glances-debian-ingress.yaml
Normal file
49
manifests/glances-debian-ingress.yaml
Normal file
@ -0,0 +1,49 @@
|
||||
# Glances — Debian node, proxied via Traefik
|
||||
# Apply: kubectl apply -f manifests/glances-debian-ingress.yaml
|
||||
apiVersion: v1
|
||||
kind: Endpoints
|
||||
metadata:
|
||||
name: glances-debian
|
||||
namespace: glances
|
||||
subsets:
|
||||
- addresses:
|
||||
- ip: 192.168.7.183
|
||||
ports:
|
||||
- port: 61208
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: glances-debian
|
||||
namespace: glances
|
||||
spec:
|
||||
ports:
|
||||
- port: 61208
|
||||
targetPort: 61208
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: glances-debian
|
||||
namespace: glances
|
||||
annotations:
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
cert-manager.io/cluster-issuer: internal-ca-issuer
|
||||
spec:
|
||||
ingressClassName: traefik
|
||||
tls:
|
||||
- secretName: glances-debian-tls
|
||||
hosts:
|
||||
- glances-debian.home.arpa
|
||||
rules:
|
||||
- host: glances-debian.home.arpa
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: glances-debian
|
||||
port:
|
||||
number: 61208
|
||||
94
manifests/glances.yaml
Normal file
94
manifests/glances.yaml
Normal file
@ -0,0 +1,94 @@
|
||||
# Glances — system monitoring
|
||||
# Apply: kubectl apply -f manifests/glances.yaml
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: glances
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: glances
|
||||
namespace: glances
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: glances
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: glances
|
||||
spec:
|
||||
nodeSelector:
|
||||
node-role: primary
|
||||
hostPID: true
|
||||
hostNetwork: true
|
||||
containers:
|
||||
- name: glances
|
||||
image: nicolargo/glances:latest-full
|
||||
ports:
|
||||
- containerPort: 61208
|
||||
env:
|
||||
- name: GLANCES_OPT
|
||||
value: "-w"
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- name: host-proc
|
||||
mountPath: /proc
|
||||
readOnly: true
|
||||
- name: host-sys
|
||||
mountPath: /sys
|
||||
readOnly: true
|
||||
- name: host-etc
|
||||
mountPath: /etc/glances
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: host-proc
|
||||
hostPath:
|
||||
path: /proc
|
||||
- name: host-sys
|
||||
hostPath:
|
||||
path: /sys
|
||||
- name: host-etc
|
||||
hostPath:
|
||||
path: /etc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: glances
|
||||
namespace: glances
|
||||
spec:
|
||||
selector:
|
||||
app: glances
|
||||
ports:
|
||||
- port: 61208
|
||||
targetPort: 61208
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: glances
|
||||
namespace: glances
|
||||
annotations:
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
cert-manager.io/cluster-issuer: internal-ca-issuer
|
||||
spec:
|
||||
ingressClassName: traefik
|
||||
tls:
|
||||
- secretName: glances-tls
|
||||
hosts:
|
||||
- glances.home.arpa
|
||||
rules:
|
||||
- host: glances.home.arpa
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: glances
|
||||
port:
|
||||
number: 61208
|
||||
@ -77,3 +77,5 @@ dnsmasq:
|
||||
- address=/jellyfin.home.arpa/192.168.7.77
|
||||
- address=/qbittorrent.home.arpa/192.168.7.77
|
||||
- address=/jdownloader.home.arpa/192.168.7.77
|
||||
- address=/glances.home.arpa/192.168.7.77
|
||||
- address=/glances-debian.home.arpa/192.168.7.77
|
||||
Loading…
x
Reference in New Issue
Block a user