-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcluster.yml
99 lines (93 loc) · 4.35 KB
/
cluster.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
version: "3"
tasks:
kubeconfig:
desc: Remotely fetch kubeconfig from Kubernetes
cmds:
- rsync --verbose --progress --partial --rsync-path="sudo rsync" {{.K3S_PRIMARY_MASTER_NODE_USERNAME}}@{{.K3S_PRIMARY_MASTER_NODE_ADDR}}:/etc/rancher/k3s/k3s.yaml "{{.CLUSTER_DIR}}/kubeconfig"
- sed -i '' 's/127.0.0.1/{{.K3S_LB_ADDR}}/g' "{{.CLUSTER_DIR}}/kubeconfig"
- chmod go-r "{{.CLUSTER_DIR}}/kubeconfig"
- cp "{{.CLUSTER_DIR}}/kubeconfig" ~/.kube/config
clean-images:
desc: Clean up stale container images
dir: ansible
cmds:
- "ansible all -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml --one-line -a 'k3s crictl rmi --prune' --become"
silent: true
purge-manifests:
desc: Delete all manifests under /var/lib/rancher/k3s/server/manifests
dir: ansible
cmds:
- "ansible master-nodes -i {{.ANSIBLE_INVENTORY_DIR}}/hosts.yml --one-line -a 'rm /var/lib/rancher/k3s/server/manifests/*' --become"
restart-pods:
desc: Restart all pods
cmds:
- kubectl rollout restart ds -n kube-system
- kubectl rollout restart deploy -n kube-system
- kubectl rollout restart deploy -n networking
- kubectl rollout restart ds -n networking
- kubectl rollout restart ds -n openebs
- kubectl rollout restart statefulset -n openebs
- kubectl rollout restart deploy -n flux-system
- kubectl rollout restart statefulset -n databases
- kubectl rollout restart deploy -n home
- kubectl rollout restart deploy -n system-upgrade
- kubectl rollout restart deploy -n media
- kubectl rollout restart deploy -n default
- kubectl rollout restart ds -n monitoring
- kubectl rollout restart deploy -n monitoring
- kubectl rollout restart statefulset -n monitoring
- kubectl rollout restart deploy -n discord
silent: true
pause:
desc: Pause all Helm Releases that rely on ZFS storage
cmds:
# - flux suspend hr -n minio minio
# - kubectl scale -n minio deploy/minio --replicas 0
- flux suspend hr -n home homebridge
- kubectl scale -n home deploy/homebridge --replicas 0
- flux suspend hr -n media lidarr
- kubectl scale -n media deploy/lidarr --replicas 0
- flux suspend hr -n media plex
- kubectl scale -n media deploy/plex --replicas 0
- flux suspend hr -n media qbittorrent
- kubectl scale -n media deploy/qbittorrent --replicas 0
- flux suspend hr -n media radarr
- kubectl scale -n media deploy/radarr --replicas 0
- flux suspend hr -n media prowlarr
- kubectl scale -n media deploy/prowlarr --replicas 0
- flux suspend hr -n media sonarr
- kubectl scale -n media deploy/sonarr --replicas 0
- flux suspend hr -n media overseerr
- kubectl scale -n media deploy/overseerr --replicas 0
- flux suspend hr -n media tautulli
- kubectl scale -n media deploy/tautulli --replicas 0
- flux suspend hr -n monitoring loki
- kubectl scale -n monitoring statefulset/loki --replicas 0
- flux suspend hr -n monitoring thanos
- kubectl scale -n monitoring deploy/thanos-query --replicas 0
- kubectl scale -n monitoring deploy/thanos-bucketweb --replicas 0
- kubectl scale -n monitoring deploy/thanos-compactor --replicas 0
- kubectl scale -n monitoring statefulset/thanos-storegateway --replicas 0
- flux suspend hr -n monitoring kube-prometheus-stack
- kubectl scale -n monitoring statefulset/alertmanager-prometheus-alertmanager --replicas 0
- kubectl scale -n monitoring statefulset/prometheus-prometheus-prometheus --replicas 0
- kubectl scale -n monitoring deploy/prometheus-operator --replicas 0
resume:
desc: Resume all Helm Releases that rely on ZFS storage
cmds:
# - flux resume hr -n minio minio
- flux resume hr -n databases mongodb-community-operator
- flux resume hr -n home homebridge
- flux resume hr -n home hajimari
- flux resume hr -n monitoring loki
- flux resume hr -n monitoring kube-prometheus-stack
- flux resume hr -n monitoring thanos
- flux resume hr -n media lidarr
- flux resume hr -n media plex
- flux resume hr -n media qbittorrent
- flux resume hr -n media radarr
- flux resume hr -n media prowlarr
- flux resume hr -n media sonarr
- flux resume hr -n media overseerr
- flux resume hr -n media tautulli