乐维产品包具体打包为4个镜像包,分别为:mysql5.7.36.tar、zabbix_server.tar、itops_v1_4_x86_64.tar、bpm0.1.tar,对应的配置文件分别为:data.tar、conf.tar、nginx-v1.3.tar.gz、bpm12.zip。
K8s yaml文件具体打包为strogeclass、pv、pvc、deployment、service,执行时也请按照这个顺序进行执行。
具体安装如下所示。
1、 上传文件
上传yaml-pvc.tar至master节点根目录下并解压
2、 创建namespace(测试环境的namespace名称为lw-server)
kubectl create namespace lw-server
ps:如客户现场给的namespace为其他名称,所有yaml文件的namespace都需要进行修改
上传mysql5.7.36.tar到k8s镜像仓库,上传data.tar文件到存储节点(测试环境存储节点为ceph03)
mkdir -p /itops/
tar -xf data.tar -C /itops/
chown mysql.mysql /itops/mysql -R
kubectl apply -f yaml-pvc/mysql-pvc/storage_mysql.yaml
kubectl apply -f yaml-pvc/mysql-pvc/storage_mysql-data.yaml
可通过 :kubectl get storageclass查看是否创建成功
kubectl apply -f yaml-pvc/mysql-pvc/pv-mysql.yaml
kubectl apply -f yaml-pvc/mysql-pvc/pv-mysql-data.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server pv
kubectl apply -f yaml-pvc/mysql-pvc/pvc-mysql.yaml
kubectl apply -f yaml-pvc/mysql-pvc/pvc-mysql.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server pvc
kubectl apply -f yaml-pvc/lw-mysql.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server deployment
kubectl apply -f yaml-pvc/lw-mysql-service.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server svc
账号:root
密码:ITIM_p@ssw0rd
账号:zabbix
密码:zabbix
上传zabbix_server.tar到k8s镜像仓库,上传conf.tar文件到存储节点(测试环境存储节点为ceph03)
mkdir -p /itops/zabbix_server
tar -xf conf.tar -C /itops/zabbix_server
sed -i 's/DBHost=192.168.229.17/DBHost=mysql-proxy/g' /itops/zabbix_server/etc/zabbix_server.conf
sed -i 's/JavaGateway=192.168.229.17/JavaGateway=zabbix-proxy/g' /itops/zabbix_server/etc/zabbix_server.conf
kubectl apply -f yaml-pvc/zabbix-pvc/storage_zabbix.yaml
可通过 :kubectl get storageclass查看是否创建成功
kubectl apply -f yaml-pvc/zabbix-pvc/pv-zabbix.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server pv
kubectl apply -f yaml-pvc/zabbix-pvc/pvc-zabbix.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server pvc
kubectl apply -f yaml-pvc/lw-zabbix.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server deployment
kubectl apply -f yaml-pvc/lw-zabbix-service.yam
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server svc
上传itops_v1_4_x86_64.tar到k8s镜像仓库,上传nginx-v1.3.tar.gz文件到存储节点(测试环境存储节点为ceph03)
mkdir -p /itops/
tar -xf nginx-v1.3.tar.gz -C /itops/
vi /itops/nginx/html/zabbix/conf/zabbix.conf.php
vi /itops/nginx/html/lwjk_v3/web/z/conf/zabbix.conf.php
vi /itops/nginx/html/lwjk_v3/config/db.php
4、执行yaml文件创建storageclass(在master节点执行)
kubectl apply -f yaml-pvc/nginx-pvc/storage_nginx.yaml
kubectl apply -f yaml-pvc/nginx-pvc/storage_nginx-data.yaml
可通过 :kubectl get storageclass查看是否创建成功
kubectl apply -f yaml-pvc/nginx-pvc/pv-nginx.yaml
kubectl apply -f yaml-pvc/nginx-pvc/pv-nginx-data.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server pv
kubectl apply -f yaml-pvc/nginx-pvc/pvc-nginx.yaml
kubectl apply -f yaml-pvc/nginx-pvc/pvc-nginx-data.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server pvc
kubectl apply -f yaml-pvc/lw-nginx.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server deployment
kubectl apply -f yaml-pvc/lw-nginx-service.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server svc
此方法php在宿主机执行任务
crontab -e
50 23 * * * mysql -h mysql-proxy -uzabbix -pzabbix 'zabbix' -e "CALL partition_maintenance_all('zabbix')" >/dev/null
0 1 * * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run report/daily-report &
0 8 * * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run report/send-daily-mail &
0 3 * * 1 echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run report/weekly-report &
0 8 * * 1 echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run report/send-weekly-mail &
50 1 1 * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run report/monthly-report &
0 8 1 * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run report/send-monthly-mail &
*/1 * * * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run bsmlist &
*/30 * * * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run kitty/create-reportdata-queue &
*/20 * * * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run kitty/create-subscribe-queue &
0 */1 * * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run flowreport-trends-data/index &
*/5 * * * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run hosts/profile-renew &
*/1 * * * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run queue/run &
*/1 * * * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/runalert/history &
*/1 * * * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/runalert/r-history &
0 2 * * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run logger/flush &
*/1 * * * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run hosts &
*/5 * * * * echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run threshold-task/index &
清除定时任务:
0 0 * * 0 /usr/bin/rm /itops/zabbix_server/logs/zabbix_traps.tmp >/dev/null
此方法php脚本在pod内部执行
crontab -e
50 23 * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- mysql -h mysql-proxy -uzabbix -pzabbix 'zabbix' -e "CALL partition_maintenance_all('zabbix')"
0 1 * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- php /itops/nginx/html/lwjk_v3/run report/daily-report &
0 8 * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run report/send-daily-mail &
0 3 * * 1 kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run report/weekly-report &
0 8 * * 1 kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run report/send-weekly-mail &
50 1 1 * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run report/monthly-report &
0 8 1 * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run report/send-monthly-mail &
*/1 * * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run bsmlist &
*/30 * * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run kitty/create-reportdata-queue &
*/20 * * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run kitty/create-subscribe-queue &
0 */1 * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run flowreport-trends-data/index &
*/5 * * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run hosts/profile-renew &
*/1 * * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run queue/run &
*/1 * * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/runalert/history &
*/1 * * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run alert/r-history &
0 2 * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run logger/flush &
*/1 * * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run hosts &
*/5 * * * * kubectl exec -it $(kubectl get pods -n lw-server | grep nginx | awk '{print $1}') -n lw-server -- echo 'LW_ID_PUBLIC_DEFAULT_TASK' | php /itops/nginx/html/lwjk_v3/run threshold-task/index &
清除定时任务配置在文件服务器上:
0 0 * * 0 /usr/bin/rm /itops/zabbix_server/logs/zabbix_traps.tmp >/dev/null
上传bpm0.1.tar到k8s镜像仓库,上传bpm12.zip文件到存储节点(测试环境存储节点为ceph03)
vi /itops/mysql/etc/my.cnf
于[mysqld]下追加一行: lower_case_table_names = 1
1.2、远程连接数据库并按顺序执行一下SQL语句
//创建bpm数据库
CREATE DATABASE bpm DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
//创建bpm用户
CREATE USER 'bpm'@'%' IDENTIFIED BY '123456';
//授权
grant all privileges on bpm.* to 'bpm'@'%';
//刷新权限
flush privileges;
//切换数据库
use bpm;
//导入数据库
source /root/bpm12.sql;
// bpm跳转地址更新,把IP修改为bpm IP
update bpm_devdefaultcode set DefaultCode='<script>location.href = \'http://node地址:30080\';</script>' whereWF_OrUnid='41B5701B0EE2904D0E0835D0D27ACB8B9D49';
kubectl delete -f yaml-pvc/lw-mysql.yaml
kubectl apply -f yaml-pvc/lw-mysql.yaml
tar -xvf bpm12.tar -C /itops
vi /itops/bpm/bpm12/apache-tomcat-8.5.58/conf/Catalina/localhost
3、监控平台调整
上传params.php文件至/itops/nginx/html/lwjk_v3/local/
vi /itops/nginx/html/lwjk_v3/local/params.php
IP修改为实际node IP
cd /itops/nginx/html/lwjk_v3/
php run mm/i bpm
unzip ext.zip -d /itops/nginx/html/lwjk_v3/
kubectl apply -f yaml-pvc/bpm-pvc/storage_bpm.yaml
可通过 :kubectl get storageclass查看是否创建成功
kubectl apply -f yaml-pvc/bpm-pvc/pv-bpm.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server pv
kubectl apply -f yaml-pvc/bpm-pvc/pvc-bpm.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server pvc
kubectl apply -f yaml-pvc/lw-bpm.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server deployment
执行yaml文件创建service(在master节点执行)
kubectl apply -f yaml-pvc/lw-bpm-service.yaml
可通过(这是挂载成功的情况,仅供参考):kubectl get -n lw-server svc
访问http://nodeip:30800/dev
1、上传文件
上传ansiblemodule.tar文件到存储节点(测试环境存储节点为ceph03)
mv ansiblemodule.tar /itops/nginx/html/
tar -xvf /itops/nginx/html/ansiblemodule.tar
2、进入nginx pod内部执行安装脚本
cd /itops/nginx/html/ansiblemodule
sh ansiblemodule_install.sh web
执行结束就可以在web看到自动化运维界面
错误信息