当前位置:首页 » Mysql技术教程

分享几个自己写的zabbix server web agent mysql的k8s daemonset文件

2017-12-06 11:40 本站整理 浏览(8)

现在docker做的越来越方便了,我今天就是部署了一整套zabbix

包括 zabbix-web、zabbix-server、zabbix-agent、mysql

 

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: common-zabbix-server
spec:
  template:
    metadata:
      labels:
        name: zabbix-server
    spec:
      nodeSelector:
        common3: zabbix-server
      hostNetwork: true
      containers:
      - name: zabbix-server
        image: zabbix/zabbix-server-mysql
        #command: ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]
        env:
        - name: DB_SERVER_HOST
          value: 192.168.2.208
        - name: MYSQL_USER
          value: root
        - name: MYSQL_PASSWORD
          value: Nbs
        #livenessProbe:
        #  httpGet:
        #    path: /static/6b7854a5/images/16x16/help.png
        #    port: 8080
        #  initialDelaySeconds: 30
        #  timeoutSeconds: 5
        #volumeMounts:
        #- name: varjenkinshome
        #  mountPath: /var/jenkins_home
      #volumes:
      #- name: varjenkinshome
       # hostPath:
       #   path: /opt/tingyun/common/jenkins

 

 

 

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: common-zabbix-web
spec:
  template:
    metadata:
      labels:
        name: zabbix-web
    spec:
      nodeSelector:
        common4: zabbix-web
      hostNetwork: true
      containers:
      - name: zabbix-web
        image: zabbix/zabbix-web-nginx-mysql
        #command: ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]
        env:
        - name: DB_SERVER_HOST
          value: 192.168.2.208
        - name: MYSQL_USER
          value: root
        - name: MYSQL_PASSWORD
          value: Nbs
        - name: ZBX_SERVER_HOST
          value: k8s-node-001
        - name: PHP_TZ
          value: Asia/Shanghai
        #livenessProbe:
        #  httpGet:
        #    path: /static/6b7854a5/images/16x16/help.png
        #    port: 8080
        #  initialDelaySeconds: 30
        #  timeoutSeconds: 5
        #volumeMounts:
        #- name: varjenkinshome
        #  mountPath: /var/jenkins_home
      #volumes:
      #- name: varjenkinshome
       # hostPath:
       #   path: /opt/tingyun/common/jenkins

 

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: common-zabbix-agent
spec:
  template:
    metadata:
      labels:
        name: zabbix-agent
    spec:
      nodeSelector:
        common5: zabbix-agent
      hostNetwork: true
      containers:
      - name: zabbix-agent
        image: zabbix/zabbix-agent
        #command: ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]
        env:
        #- name: ZBX_HOSTNAME
        #  value: k8s-node-001
        - name: ZBX_SERVER_HOST
          value: k8s-node-001
        #livenessProbe:
        #  httpGet:
        #    path: /static/6b7854a5/images/16x16/help.png
        #    port: 8080
        #  initialDelaySeconds: 30
        #  timeoutSeconds: 5
        #volumeMounts:
        #- name: varjenkinshome
        #  mountPath: /var/jenkins_home
      #volumes:
      #- name: varjenkinshome
       # hostPath:
       #   path: /opt/tingyun/common/jenkins

 

 

apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: common-mysql-server
spec:
  template:
    metadata:
      labels:
        name: mysql-server
    spec:
      volumes:
      - name: data
        hostPath:
          path: "/opt/tingyun/mysql"
      - name: localtime
        hostPath:
          path: "/etc/localtime"
      nodeSelector:
        common6: mysql-server
      hostNetwork: true
      containers:
      - name: mysql-server
        image: mysql
        #command: ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"]
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: Nbs
        #- name: MYSQL_DATABASE
        #  value: zabbix
        - name: MYSQL_USER
          value: root
        - name: MYSQL_PASSWORD
          value: Nbs@2010
        #livenessProbe:
        #  httpGet:
        #    path: /static/6b7854a5/images/16x16/help.png
        #    port: 8080
        #  initialDelaySeconds: 30
        #  timeoutSeconds: 5
        #volumeMounts:
        #- name: varjenkinshome
        #  mountPath: /var/jenkins_home

        volumeMounts:
        - name: data
          mountPath: /var/lib/mysql
        - name: localtime
          mountPath: /etc/localtime

 看懂的点个赞

 


 这里我 配置了自动发现规则,在每个node上都起了一个agent