Helm/Zabbix: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| (28 intermediate revisions by the same user not shown) | |||
| Line 63: | Line 63: | ||
|} | |} | ||
== | ==Data== | ||
{|class='wikitable' | |||
!scope='col' style='text-align:left'| | |||
Data | |||
|- | |||
|valign='top'| | |||
{|class='wikitable mw-collapsible' | {|class='wikitable mw-collapsible' | ||
!scope='col' style='text-align:left' colspan='2'| | !scope='col' style='text-align:left' colspan='2'| | ||
Data » HostPath | |||
|- | |- | ||
|valign='top' style='width:50%'| | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash | |||
cat <<'EXE'| sudo bash | |||
mkdir -p /var/minikube/pvc/zabbix/data-postgresql-0/ | |||
chown -R 1001:1001 /var/minikube/pvc/zabbix/data-postgresql-0/ | |||
sh -c 'ls -alh /var/minikube/pvc/zabbix/' | |||
EXE | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|valign='top' style='width:50%'| | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang='bash'> | |||
# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash | |||
cat <<'EXE'| sudo bash | |||
mkdir -p /var/minikube/pvc/zabbix/data-zabbix-server-0/ | |||
chown -R 1997:1995 /var/minikube/pvc/zabbix/data-zabbix-server-0/ | |||
sh -c 'ls -alh /var/minikube/pvc/zabbix/' | |||
EXE | |||
</syntaxhighlight> | |||
|} | |} | ||
{|class='wikitable mw-collapsible mw-collapsed' | |||
== | !scope='col' style='text-align:left'| | ||
{|class='wikitable mw-collapsible' | Data » PostgreSQL | ||
!scope='col' style='text-align:left | |- | ||
|valign='top'| | |||
{|class='wikitable mw-collapsible mw-collapsed' | |||
!scope='col' style='text-align:left'| | |||
PostgreSQL » Create | |||
|- | |- | ||
|valign='top | |valign='top'| | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash | |||
echo -n 'Password: ';read -s ZABBIX_PASSWORD;export ZABBIX_PASSWORD;echo | |||
echo "${ZABBIX_PASSWORD}" | |||
# Password: sadaqah! | |||
</syntaxhighlight> | |||
<syntaxhighlight lang='sql'> | |||
cat <<'SQL'| sudo -i -u postgres psql | |||
SELECT usename AS "user" FROM pg_catalog.pg_user WHERE usename LIKE '%zabbix%' ORDER BY 1 ASC; -- \du+ | |||
SELECT datname as "database" FROM pg_database WHERE datname LIKE '%zabbix%' ORDER BY 1 ASC; -- \l+ | |||
SQL | |||
</syntaxhighlight> | |||
<syntaxhighlight lang='sql'> | |||
cat << DDL | sudo -i -u postgres psql | |||
\! printf '\n' | |||
SELECT 'CREATE DATABASE shahed_tool_zabbix' | |||
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'shahed_tool_zabbix')\gexec | |||
CREATE USER shahed_tool_zabbix WITH ENCRYPTED PASSWORD '${ZABBIX_PASSWORD}'; | |||
GRANT ALL PRIVILEGES ON DATABASE shahed_tool_zabbix TO shahed_tool_zabbix; | |||
ALTER DATABASE shahed_tool_zabbix OWNER TO shahed_tool_zabbix; | |||
DDL | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |||
{|class='wikitable mw-collapsible' | |||
!scope='col' style='text-align:left'| | |||
PostgreSQL » Debug | |||
|- | |- | ||
|valign='top | |valign='top'| | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
export | echo -n 'Password: ';read -s PGPASSWORD; export PGPASSWORD; echo | ||
echo "${PGPASSWORD}" | |||
# Password: sadaqah! | |||
sudo -i -u postgres \ | |||
psql -d shahed_tool_zabbix | |||
psql -d shahed_tool_zabbix -U shahed_tool_zabbix | |||
psql -d shahed_tool_zabbix -U shahed_tool_zabbix -p 5432 -h 10.20.0.1 | |||
psql -d shahed_tool_zabbix -U shahed_tool_zabbix -p 5432 -h 10.20.13.1 | |||
psql -d shahed_tool_zabbix -U shahed_tool_zabbix -p 5432 -h 192.168.49.1 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |} | ||
!scope='col' | {|class='wikitable mw-collapsible mw-collapsed' | ||
!scope='col' style='text-align:left'| | |||
PostgreSQL » Backup | |||
|- | |- | ||
|valign='top'| | |valign='top'| | ||
<syntaxhighlight lang=' | <syntaxhighlight lang='bash'> | ||
# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash | |||
# cd ~/Downloads | |||
-- | |||
function quarter() { | |||
local month this_quarter | |||
month=$(date +%m) | |||
case $month in | |||
01|02|03) this_quarter="$(date +'%Y-01-01')" ;; | |||
04|05|06) this_quarter="$(date +'%Y-04-01')" ;; | |||
07|08|09) this_quarter="$(date +'%Y-07-01')" ;; | |||
10|11|12) this_quarter="$(date +'%Y-10-01')" ;; | |||
esac | |||
echo -n "${this_quarter}" | |||
} | |||
echo -n 'Password: ';read -s PGPASSWORD; export PGPASSWORD; echo | |||
echo "${PGPASSWORD}" | |||
# Password: sadaqah! | |||
BKP_DATE_N_TIME="$(date +'%Y-%m-%dT%H%M')";\ | |||
pg_dump -p5432 -h10.20.13.1 -U shahed_tool_zabbix shahed_tool_zabbix | gzip > shahed_tool_zabbix.data.${BKP_DATE_N_TIME}.sql.gz | |||
gunzip -c shahed_tool_zabbix.data.${BKP_DATE_N_TIME}.sql.gz | more | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |||
{|class='wikitable mw-collapsible mw-collapsed' | |||
!scope='col' style='text-align:left'| | |||
PostgreSQL » Restore | |||
|- | |||
|valign='top'| | |valign='top'| | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
# ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash | |||
# mc cp s3_minio_shahed_shahed_biz_admin/shahed-bkp/tool/zabbix/daily/2026/M01/2026-01-27/data/shahed_tool_zabbix.data.2026-01-27T1704.sql.gz ${HOME}/Downloads/ | |||
echo "$ | echo -n 'Password: ';read -s PGPASSWORD; export PGPASSWORD; echo | ||
echo "${PGPASSWORD}" | |||
# Password: sadaqah! | |||
psql -p5432 -h10.20.13.1 -U shahed_tool_zabbix -d shahed_tool_zabbix | |||
gunzip -c shahed_tool_zabbix.data.2026-01-27T1704.sql.gz | psql -p5432 -h10.20.13.1 -U shahed_tool_zabbix -d shahed_tool_zabbix | |||
# gunzip -c ${HOME}/Downloads/shahed_tool_zabbix.data.2026-01-27T1704.sql.gz | psql -p5432 -h10.20.13.1 -U shahed_tool_zabbix -d shahed_tool_zabbix | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |} | ||
!scope='col' | {|class='wikitable mw-collapsible mw-collapsed' | ||
!scope='col' style='text-align:left'| | |||
PostgreSQL » Destroy | |||
|- | |- | ||
|valign='top'| | |valign='top'| | ||
<syntaxhighlight lang=' | <syntaxhighlight lang='sql'> | ||
cat <<' | # ssh -qt shahed@shahed-ab.local.or.tunnel.ip bash | ||
cat <<'DDL'| sudo -i -u postgres psql | |||
\! printf '\n' | |||
REVOKE ALL PRIVILEGES ON DATABASE shahed_tool_zabbix FROM shahed_tool_zabbix; | |||
DROP OWNED BY shahed_tool_zabbix; | |||
DROP DATABASE IF EXISTS shahed_tool_zabbix; | |||
DROP USER IF EXISTS shahed_tool_zabbix; | |||
DDL | |||
</syntaxhighlight> | |||
|} | |||
|} | |||
|} | |||
==Config== | |||
{|class='wikitable' | |||
!scope='col' style='text-align:left'| | |||
Config | |||
|- | |||
|valign='top'| | |valign='top'| | ||
{|class='wikitable mw-collapsible' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
Config » Context | |||
|- | |- | ||
|valign='top' style='width:50%'| | |||
<syntaxhighlight lang='bash'> | |||
export KUBECONFIG="${HOME}/.kube/aws-kubeconfig.yaml" | |||
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml" | |||
export KUBECONFIG="${HOME}/.kube/lke-kubeconfig.yaml" | |||
export KUBECONFIG="${HOME}/.kube/config" | |||
</syntaxhighlight> | |||
|valign='top' style='width:50%'| | |||
|- | |- | ||
|valign='top'| | |valign='top'| | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
export KUBECONFIG=${HOME}/.kube/shahed-ab-kubeconfig.yaml | |||
kubectl config get-contexts | |||
kubectl config view | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|valign='top'| | |valign='top'| | ||
<syntaxhighlight lang='bash'> | |||
kubectl config view -o=yaml|yq '.contexts[0].name' | |||
kubectl create ns zabbix-monitoring-system || true | |||
kubectl get ns|grep zabbix-monitoring-system | |||
</syntaxhighlight> | |||
|} | |} | ||
{|class='wikitable mw-collapsible' | |||
== | !scope='col' style='text-align:left'| | ||
Config » Zabbix | |||
|- | |||
|valign='top'| | |||
{|class='wikitable mw-collapsible mw-collapsed' | {|class='wikitable mw-collapsible mw-collapsed' | ||
!scope='col' style='text-align:left' colspan='2'| | !scope='col' style='text-align:left' colspan='2'| | ||
Zabbix » Certificate | |||
|- | |- | ||
|valign='top' style='width:50%'| | |valign='top' style='width:50%'| | ||
| Line 226: | Line 300: | ||
|valign='top' style='width:50%'| | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang='bash'> | <syntaxhighlight lang='bash'> | ||
cat <<'CRT' | \ | cat <<'CRT' | \ | ||
| Line 267: | Line 323: | ||
sudo update-ca-certificates | sudo update-ca-certificates | ||
</syntaxhighlight> | </syntaxhighlight> | ||
'''Shahed_ECC_Root_CA_2025''' » Firefox » Settings » Certificates » View Certificates » Import | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n cert-manager rollout restart deployment cert-manager-webhook | |||
kubectl get ValidatingWebhookConfiguration cert-manager-webhook | |||
</syntaxhighlight> | |||
* [[Helm/Cert_Manager#Cert Manager » Webhook » Fixes|Skipped » Find More 👉 Webhook » Fixes]] | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n zabbix-monitoring-system get Secret zabbix-cert -o=yaml | |||
kubectl -n zabbix-monitoring-system get Certificate zabbix-cert -o=yaml | |||
</syntaxhighlight> | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n zabbix-monitoring-system delete Secret zabbix-cert -o=yaml | |||
kubectl -n zabbix-monitoring-system delete Certificate zabbix-cert -o=yaml | |||
</syntaxhighlight> | |||
|} | |||
{|class='wikitable mw-collapsible' | |||
!scope='col' style='text-align:left'| | |||
Zabbix » Secrect | |||
|- | |||
|valign='top'| | |||
{|class='wikitable mw-collapsible mw-collapsed' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
Secrect » PostgreSQL | |||
|- | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight lang='ini'> | |||
cat <<'ENV' | \ | |||
kubectl -n zabbix-monitoring-system create secret generic postgres \ | |||
--from-env-file=/dev/stdin --dry-run=client -o=yaml | kubectl apply -f - | |||
host=zabbix-postgresql.zabbix-monitoring-system | |||
dbname=shahed_tool_zabbix | |||
user=shahed_tool_zabbix | |||
password=sadaqah! | |||
port=5432 | |||
ENV | |||
</syntaxhighlight> | |||
|valign='top' style='width:50%'| | |||
|} | |||
|} | |||
{|class='wikitable mw-collapsible mw-collapsed' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
Zabbix » Volume | |||
|- | |||
|valign='top' style='width:50%'| | |||
{|class='wikitable' | |||
|valign='top'| | |||
* [[K8s/Storage#Storage » Mount|Skipped » Find More 👉 Storage » Mount]] | |||
---- | |||
* [[K8s/Storage#Storage » Class » Hostpath|Skipped » Find More 👉 Storage » Class » Hostpath]] | |||
---- | |||
* [[K8s/Storage#Storage » Persistent Volume|Skipped » Find More 👉 Storage » Persistent Volume]] | |||
|} | |||
|valign='top' style='width:50%'| | |||
|- | |||
!scope='col'| zabbix-data-postgresql-0 | |||
!scope='col'| data-postgresql-0 | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='yaml' highlight='13-15'> | |||
cat <<'YML'| \ | |||
kubectl apply -f - | |||
--- | |||
apiVersion: v1 | |||
kind: PersistentVolume | |||
metadata: | |||
name: zabbix-data-postgresql-0 | |||
spec: | |||
capacity: | |||
storage: 1Gi | |||
accessModes: | |||
- ReadWriteOnce | |||
persistentVolumeReclaimPolicy: Retain | |||
storageClassName: hostpath | |||
hostPath: | |||
path: /var/hostpath_pv/zabbix/data-postgresql-0 | |||
type: DirectoryOrCreate | |||
YML | |||
</syntaxhighlight> | |||
|valign='top'| | |||
<syntaxhighlight lang='yaml' highlight='8,9,16,17'> | |||
cat << YML | \ | |||
kubectl apply -f - | |||
--- | |||
apiVersion: v1 | |||
kind: PersistentVolumeClaim | |||
metadata: | |||
labels: | |||
app.kubernetes.io/name: zabbix | |||
name: data-postgresql-0 | |||
namespace: zabbix-monitoring-system | |||
spec: | |||
accessModes: | |||
- ReadWriteOnce | |||
resources: | |||
requests: | |||
storage: 1Gi | |||
storageClassName: hostpath | |||
volumeName: zabbix-data-postgresql-0 | |||
YML | |||
</syntaxhighlight> | |||
|- | |||
!scope='col'| zabbix-data-zabbix-server-0 | |||
!scope='col'| data-zabbix-server-0 | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='yaml' highlight='13-15'> | |||
cat <<'YML'| \ | |||
kubectl apply -f - | |||
--- | |||
apiVersion: v1 | |||
kind: PersistentVolume | |||
metadata: | |||
name: zabbix-data-zabbix-server-0 | |||
spec: | |||
capacity: | |||
storage: 1Gi | |||
accessModes: | |||
- ReadWriteOnce | |||
persistentVolumeReclaimPolicy: Retain | |||
storageClassName: hostpath | |||
hostPath: | |||
path: /var/hostpath_pv/zabbix/data-zabbix-server-0 | |||
type: DirectoryOrCreate | |||
YML | |||
</syntaxhighlight> | |||
|valign='top'| | |||
<syntaxhighlight lang='yaml' highlight='8,9,16,17'> | |||
cat << YML | \ | |||
kubectl apply -f - | |||
--- | |||
apiVersion: v1 | |||
kind: PersistentVolumeClaim | |||
metadata: | |||
labels: | |||
app.kubernetes.io/name: zabbix | |||
name: data-zabbix-server-0 | |||
namespace: zabbix-monitoring-system | |||
spec: | |||
accessModes: | |||
- ReadWriteOnce | |||
resources: | |||
requests: | |||
storage: 1Gi | |||
storageClassName: hostpath | |||
volumeName: zabbix-data-zabbix-server-0 | |||
YML | |||
</syntaxhighlight> | |||
|} | |||
|} | |||
|} | |||
==Helm » Upgrade== | |||
{|class='wikitable mw-collapsible' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
Helm » Install | |||
|- | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight lang='bash'> | |||
helm show values zabbix-community/zabbix --version=7.0.11|less | |||
helm show values zabbix-community/zabbix --version=7.0.12|less | |||
</syntaxhighlight> | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight lang='bash'> | |||
export KUBECONFIG="${HOME}/.kube/shahed-ab-kubeconfig.yaml" | |||
kubectl create ns zabbix-monitoring-system || true | |||
</syntaxhighlight> | |||
|- | |||
!scope='col'| Install | |||
!scope='col'| Notes | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='yaml'> | |||
cat <<'YML' | \ | |||
helm --history-max=5 \ | |||
-n=zabbix-monitoring-system upgrade \ | |||
-i zabbix zabbix-community/zabbix --version=7.0.12 -f - | |||
--- | |||
nameOverride: zabbix | |||
fullnameOverride: zabbix | |||
zabbixImageTag: ubuntu-7.0.16 | |||
postgresAccess: | |||
existingSecretName: postgres | |||
zabbixServer: | |||
enabled: true | |||
zabbixServerHA: | |||
enabled: false | |||
dbCreateUpgradeJob: | |||
image: | |||
repository: ghcr.io/zabbix-community/zabbix-server-create-upgrade-db | |||
replicaCount: 1 | |||
image: | |||
repository: zabbix/zabbix-server-pgsql | |||
ingress: | |||
enabled: true | |||
annotations: | |||
kubernetes.io/ingress.class: nginx | |||
hosts: | |||
- host: zabbix.shahed.biz.ops | |||
paths: | |||
- path: / | |||
pathType: ImplementationSpecific | |||
YML | |||
</syntaxhighlight> | |||
|valign='top'| | |||
|- | |- | ||
!scope='col'| Status | |||
!scope='col'| Verify | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
helm -n=zabbix-monitoring-system status zabbix | |||
helm -n=zabbix-monitoring-system get manifest zabbix | |||
</syntaxhighlight> | |||
|valign='top'| | |valign='top'| | ||
telnet zabbix.shahed.biz.ops 80 | |||
setsid open http://zabbix.shahed.biz.ops >/dev/null 2>&1 & | |||
|} | |||
==Helm » Patch== | |||
{|class='wikitable mw-collapsible mw-collapsed' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
Helm » Patch | |||
|- | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight lang='yaml'> | <syntaxhighlight lang='yaml'> | ||
cat <<'YML' | \ | cat <<'YML' | \ | ||
| Line 284: | Line 573: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|valign='top'| | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang='yaml'> | <syntaxhighlight lang='yaml'> | ||
cat <<'YML' | \ | cat <<'YML' | \ | ||
| Line 304: | Line 593: | ||
|- | |- | ||
|valign='top'| | |valign='top'| | ||
telnet zabbix.shahed.biz.ops 80 | |||
telnet zabbix.shahed.biz.ops 443 | |||
|valign='top'| | |||
setsid open http://zabbix.shahed.biz.ops >/dev/null 2>&1 & | |||
setsid open https://zabbix.shahed.biz.ops >/dev/null 2>&1 & | |||
|} | |||
==Helm » Scale== | |||
{|class='wikitable mw-collapsible mw-collapsed' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
Helm » Scale | |||
|- | |||
!scope='col' style='width:50%'| Scale » Down | |||
!scope='col' style='width:50%'| Scale » Up | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system \ | |||
scale deploy/zabbix-zabbix-webservice --replicas=0 | |||
</syntaxhighlight> | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system \ | |||
scale deploy/zabbix-zabbix-webservice --replicas=1 | |||
</syntaxhighlight> | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system \ | |||
scale deploy/zabbix-zabbix-server --replicas=0 | |||
</syntaxhighlight> | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system \ | |||
scale deploy/zabbix-zabbix-server --replicas=1 | |||
</syntaxhighlight> | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system \ | |||
scale deploy/zabbix-zabbix-web --replicas=0 | |||
</syntaxhighlight> | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system \ | |||
scale deploy/zabbix-zabbix-web --replicas=1 | |||
</syntaxhighlight> | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system \ | |||
scale sts/zabbix-postgresql --replicas=0 | |||
</syntaxhighlight> | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system \ | |||
scale sts/zabbix-postgresql --replicas=1 | |||
</syntaxhighlight> | |||
|} | |||
==Helm » Debug== | |||
{|class='wikitable mw-collapsible' | |||
!scope='col' style='text-align:left'| | |||
Helm » Debug | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-postgresql -- psql -p5432 -U shahed_tool_zabbix -d shahed_tool_zabbix | |||
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-postgresql -- bash -c 'printenv|grep -i postgres_' | |||
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-postgresql -- bash -c 'cat /etc/hosts' | |||
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-postgresql -- bash | |||
psql -hzabbix-postgresql-0 -p5432 -U shahed_tool_zabbix | |||
</syntaxhighlight> | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-zabbix-webservice -c zabbix-webservice -- bash | |||
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-webservice -c zabbix-webservice | |||
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-zabbix-server -c zabbix-server -- bash | |||
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-server -c zabbix-server | |||
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-postgresql -c postgresql -- bash | |||
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-postgresql -c postgresql | |||
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-zabbix-web -c zabbix-web -- bash | |||
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-web -c zabbix-web | |||
</syntaxhighlight> | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system get Pod -o=yaml|yq -P '.items[].spec.containers[].name' | |||
kubectl -n=zabbix-monitoring-system get Pod -o=yaml|yq -P '.items[].metadata.labels' | |||
kubectl -n=zabbix-monitoring-system get Ingress -o=yaml|yq -P '.items[].metadata.name' | |||
kubectl -n=zabbix-monitoring-system get Service -o=yaml|yq -P '.items[].metadata.name' | |||
kubectl -n=zabbix-monitoring-system get deploy -o=yaml|yq -P '.items[].metadata.name' | |||
kubectl -n=zabbix-monitoring-system get sts -o=yaml|yq -P '.items[].metadata.name' | |||
kubectl -n=zabbix-monitoring-system get Pod --show-labels | |||
kubectl -n=zabbix-monitoring-system get Service | |||
</syntaxhighlight> | |||
|- | |- | ||
|valign='top'| | |valign='top'| | ||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-webservice | |||
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-server | |||
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-postgresql | |||
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-web | |||
</syntaxhighlight> | |||
|} | |||
==Helm » Uninstall== | |||
{|class='wikitable mw-collapsible mw-collapsed' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
Helm » Uninstall | |||
|- | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight lang='bash'> | |||
helm -n=zabbix-monitoring-system status zabbix | |||
helm -n=zabbix-monitoring-system get all zabbix | |||
helm -n=zabbix-monitoring-system uninstall zabbix | |||
</syntaxhighlight> | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system delete pvc --all | |||
kubectl delete ns zabbix-monitoring-system | |||
kubectl delete pv zabbix-data-postgresql-0 | |||
</syntaxhighlight> | |||
|} | |||
==Playground== | |||
{|class='wikitable mw-collapsible mw-collapsed' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
Playground | |||
|- | |||
|valign='top' colspan='2'| | |||
<syntaxhighlight lang='bash'> | |||
helm -n=zabbix-monitoring-system install zabbix zabbix-community/zabbix --version=7.0.12 | |||
helm -n=zabbix-monitoring-system upgrade -i zabbix zabbix-community/zabbix --version=7.0.12 | |||
helm show values zabbix-community/zabbix --version=7.0.12|less | |||
</syntaxhighlight> | |||
|- | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system delete all --all | |||
kubectl -n=zabbix-monitoring-system delete ing --all | |||
kubectl -n=zabbix-monitoring-system delete sts --all | |||
</syntaxhighlight> | |||
|valign='top' style='width:50%'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl delete pv zabbix-data-postgresql-0 | |||
kubectl -n=zabbix-monitoring-system delete svc --all | |||
kubectl -n=zabbix-monitoring-system delete pvc --all | |||
</syntaxhighlight> | |||
|- | |||
|valign='top' colspan='2'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system rollout history deploy/zabbix-zabbix-web | |||
kubectl -n=zabbix-monitoring-system rollout restart deploy/zabbix-zabbix-web | |||
kubectl -n=zabbix-monitoring-system rollout status deploy/zabbix-zabbix-web | |||
</syntaxhighlight> | |||
|- | |||
|valign='top' colspan='2'| | |||
<syntaxhighlight lang='bash'> | |||
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-postgresql -- psql -p5432 -U shahed_tool_zabbix | |||
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-postgresql | |||
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-web | |||
</syntaxhighlight> | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
git clone --depth=1 --single-branch --branch 'release/7.4' \ | |||
https://git.zabbix.com/scm/zt/kubernetes-helm.git 2>/dev/null || \ | |||
git -C kubernetes-helm pull | |||
cd ./kubernetes-helm | |||
kubectl get namespaces | |||
kubectl create namespace monitoring || true | |||
</syntaxhighlight> | |||
|valign='top'| | |valign='top'| | ||
|} | |} | ||
Latest revision as of 13:19, 27 January 2026
helm repo add zabbix-community https://zabbix-community.github.io/helm-zabbix
helm repo update && helm repo list
kubectl config get-contexts
|
|||
| |||
Data
|
Data | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||||
Config
|
Config | |||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||||||
Helm » Upgrade
|
Helm » Install | |
|---|---|
helm show values zabbix-community/zabbix --version=7.0.11|less
helm show values zabbix-community/zabbix --version=7.0.12|less
|
export KUBECONFIG="${HOME}/.kube/shahed-ab-kubeconfig.yaml"
kubectl create ns zabbix-monitoring-system || true
|
| Install | Notes |
cat <<'YML' | \
helm --history-max=5 \
-n=zabbix-monitoring-system upgrade \
-i zabbix zabbix-community/zabbix --version=7.0.12 -f -
---
nameOverride: zabbix
fullnameOverride: zabbix
zabbixImageTag: ubuntu-7.0.16
postgresAccess:
existingSecretName: postgres
zabbixServer:
enabled: true
zabbixServerHA:
enabled: false
dbCreateUpgradeJob:
image:
repository: ghcr.io/zabbix-community/zabbix-server-create-upgrade-db
replicaCount: 1
image:
repository: zabbix/zabbix-server-pgsql
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
hosts:
- host: zabbix.shahed.biz.ops
paths:
- path: /
pathType: ImplementationSpecific
YML
|
|
| Status | Verify |
helm -n=zabbix-monitoring-system status zabbix
helm -n=zabbix-monitoring-system get manifest zabbix
|
telnet zabbix.shahed.biz.ops 80 setsid open http://zabbix.shahed.biz.ops >/dev/null 2>&1 & |
Helm » Patch
|
Helm » Patch | |
|---|---|
cat <<'YML' | \
kubectl -n zabbix-monitoring-system patch ingress/zabbix --patch-file=/dev/stdin
---
metadata:
annotations:
cert-manager.io/cluster-issuer: shahed-ecc-sub-ca-2025-k8s
spec:
tls:
- hosts:
- zabbix.shahed.biz.ops
secretName: zabbix-cert
YML
|
cat <<'YML' | \
kubectl -n zabbix-monitoring-system patch ingress/zabbix --patch-file=/dev/stdin
---
metadata:
annotations:
cert-manager.io/cluster-issuer: null
spec:
tls: null
YML
|
| Telnet | Browse |
telnet zabbix.shahed.biz.ops 80 telnet zabbix.shahed.biz.ops 443 |
setsid open http://zabbix.shahed.biz.ops >/dev/null 2>&1 & setsid open https://zabbix.shahed.biz.ops >/dev/null 2>&1 & |
Helm » Scale
|
Helm » Scale | |
|---|---|
| Scale » Down | Scale » Up |
kubectl -n=zabbix-monitoring-system \
scale deploy/zabbix-zabbix-webservice --replicas=0
|
kubectl -n=zabbix-monitoring-system \
scale deploy/zabbix-zabbix-webservice --replicas=1
|
kubectl -n=zabbix-monitoring-system \
scale deploy/zabbix-zabbix-server --replicas=0
|
kubectl -n=zabbix-monitoring-system \
scale deploy/zabbix-zabbix-server --replicas=1
|
kubectl -n=zabbix-monitoring-system \
scale deploy/zabbix-zabbix-web --replicas=0
|
kubectl -n=zabbix-monitoring-system \
scale deploy/zabbix-zabbix-web --replicas=1
|
kubectl -n=zabbix-monitoring-system \
scale sts/zabbix-postgresql --replicas=0
|
kubectl -n=zabbix-monitoring-system \
scale sts/zabbix-postgresql --replicas=1
|
Helm » Debug
|
Helm » Debug |
|---|
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-postgresql -- psql -p5432 -U shahed_tool_zabbix -d shahed_tool_zabbix
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-postgresql -- bash -c 'printenv|grep -i postgres_'
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-postgresql -- bash -c 'cat /etc/hosts'
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-postgresql -- bash
psql -hzabbix-postgresql-0 -p5432 -U shahed_tool_zabbix
|
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-zabbix-webservice -c zabbix-webservice -- bash
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-webservice -c zabbix-webservice
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-zabbix-server -c zabbix-server -- bash
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-server -c zabbix-server
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-postgresql -c postgresql -- bash
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-postgresql -c postgresql
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-zabbix-web -c zabbix-web -- bash
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-web -c zabbix-web
|
kubectl -n=zabbix-monitoring-system get Pod -o=yaml|yq -P '.items[].spec.containers[].name'
kubectl -n=zabbix-monitoring-system get Pod -o=yaml|yq -P '.items[].metadata.labels'
kubectl -n=zabbix-monitoring-system get Ingress -o=yaml|yq -P '.items[].metadata.name'
kubectl -n=zabbix-monitoring-system get Service -o=yaml|yq -P '.items[].metadata.name'
kubectl -n=zabbix-monitoring-system get deploy -o=yaml|yq -P '.items[].metadata.name'
kubectl -n=zabbix-monitoring-system get sts -o=yaml|yq -P '.items[].metadata.name'
kubectl -n=zabbix-monitoring-system get Pod --show-labels
kubectl -n=zabbix-monitoring-system get Service
|
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-webservice
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-server
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-postgresql
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-web
|
Helm » Uninstall
|
Helm » Uninstall | |
|---|---|
helm -n=zabbix-monitoring-system status zabbix
helm -n=zabbix-monitoring-system get all zabbix
helm -n=zabbix-monitoring-system uninstall zabbix
|
kubectl -n=zabbix-monitoring-system delete pvc --all
kubectl delete ns zabbix-monitoring-system
kubectl delete pv zabbix-data-postgresql-0
|
Playground
|
Playground | |
|---|---|
helm -n=zabbix-monitoring-system install zabbix zabbix-community/zabbix --version=7.0.12
helm -n=zabbix-monitoring-system upgrade -i zabbix zabbix-community/zabbix --version=7.0.12
helm show values zabbix-community/zabbix --version=7.0.12|less
| |
kubectl -n=zabbix-monitoring-system delete all --all
kubectl -n=zabbix-monitoring-system delete ing --all
kubectl -n=zabbix-monitoring-system delete sts --all
|
kubectl delete pv zabbix-data-postgresql-0
kubectl -n=zabbix-monitoring-system delete svc --all
kubectl -n=zabbix-monitoring-system delete pvc --all
|
kubectl -n=zabbix-monitoring-system rollout history deploy/zabbix-zabbix-web
kubectl -n=zabbix-monitoring-system rollout restart deploy/zabbix-zabbix-web
kubectl -n=zabbix-monitoring-system rollout status deploy/zabbix-zabbix-web
| |
kubectl -n=zabbix-monitoring-system exec -it svc/zabbix-postgresql -- psql -p5432 -U shahed_tool_zabbix
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-postgresql
kubectl -n=zabbix-monitoring-system logs -f svc/zabbix-zabbix-web
| |
git clone --depth=1 --single-branch --branch 'release/7.4' \
https://git.zabbix.com/scm/zt/kubernetes-helm.git 2>/dev/null || \
git -C kubernetes-helm pull
cd ./kubernetes-helm
kubectl get namespaces
kubectl create namespace monitoring || true
|
|
References
|
References | ||
|---|---|---|