Kubernetes环境部署Knowage

栏目: 编程工具 · 发布时间: 5年前

内容简介:本文说明在Kubernetes环境部署mysql-5.6.38及Knowage,前提打镜像及docker直接部署过程见另一文章:

Kubernetes环境部署Knowage

本文说明在Kubernetes环境部署mysql-5.6.38及Knowage,前提打镜像及 docker 直接部署过程见另一文章:

Docker环境安装Knowage

knowage-mysql.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: knowage-mysql
    provider: kavenran
    version: "5.6.38"
  name: knowage-mysql
  namespace: apps
spec:
  replicas: 1
  selector:
    matchLabels:
      app: knowage-mysql
  template:
    metadata:
      labels:
        app: knowage-mysql
    spec:
      containers:
      - name: knowage-mysql
        image: "kr.io/db/mysql:5.6.38"
        imagePullPolicy: IfNotPresent
        env:
        - name: MYSQL_DATABASE
          value: "knowagedb"
        - name: MYSQL_ROOT_PASSWORD
          value: "xxxxxx"
        - name: MYSQL_USER
          value: "knowageuser"
        - name: MYSQL_PASSWORD
          value: "xxxxxx"
        ports:
        - containerPort: 3306
          protocol: TCP
          name: http
        volumeMounts:
        - name: knowage-mysql-data
          mountPath: /var/lib/mysql
      volumes:
      - name: knowage-mysql-data
        persistentVolumeClaim:
          claimName: knowage-mysql-data-pv

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: knowage-mysql-data-pv
  namespace: apps
  annotations:
    volume.beta.kubernetes.io/storage-class: standard
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 2Gi
      
---
apiVersion: v1
kind: Service
metadata:
  name: knowage-mysql
  namespace: apps
  labels: 
    app: knowage-mysql
    provider: kavenran
    version: '5.6.38'
spec:
  type: ClusterIP
  ports:
  - port: 3306
    protocol: TCP
    targetPort: 3306
    name: http
  sessionAffinity: ClientIP
  selector:
    app: knowage-mysql

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kwnowage-mysql
  namespace: apps
spec:
  rules:
  - host: kwdata.kr.io
    http:
      paths:
      - path: /
        backend:
          serviceName: knowage-mysql
          servicePort: 3306

创建后,为了可远程访问需要登录 mysql 执行:

grant all on *.* to root@'%' identified by 'xxxxxx' with grant option; 
grant all on *.* to knowageuser@'%' identified by 'xxxxxx' with grant option; 
flush privileges;

knowage-server.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: knowage-server
    provider: kavenran
    version: "6.1.8"
  name: knowage-server
  namespace: apps
spec:
  replicas: 1
  selector:
    matchLabels:
      app: knowage-server
  template:
    metadata:
      labels:
        app: knowage-server
    spec:
      containers:
      - name: knowage-server
        image: "kr.io/bi/knowage:6.1.8"
        imagePullPolicy: IfNotPresent
        env:
        - name: DB_ENV_MYSQL_DATABASE
          value: "knowagedb"
        - name: DB_ENV_MYSQL_USER
          value: "knowageuser"
        - name: DB_ENV_MYSQL_PASSWORD
          value: "xxxxxx"
        - name: DB_PORT_3306_TCP_ADDR
          value: "knowage-mysql"
        - name: DB_PORT_3306_TCP_PORT
          value: "3306"
        - name: PUBLIC_ADDRESS
          value: "kw.kr.io"
        - name: PUBLIC_PROT
          value: "80"  //此处我修改过,官方镜像只支持8080
        - name: WAIT_MYSQL
          value: "true"
        ports:
        - containerPort: 8080
          protocol: TCP
          name: http
        volumeMounts:
        - name: knowage-server-data
          mountPath: /home/knowage/apache-tomcat-7.0.57/attachments
      volumes:
      - name: knowage-server-data
        persistentVolumeClaim:
          claimName: knowage-server-data-pv

---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: knowage-server-data-pv
  namespace: apps
  annotations:
    volume.beta.kubernetes.io/storage-class: standard
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 2Gi
      
---
apiVersion: v1
kind: Service
metadata:
  name: knowage-server
  namespace: apps
  labels: 
    app: knowage-server
    provider: kavenran
    version: '6.1.8'
spec:
  type: ClusterIP
  ports:
  - port: 8080
    protocol: TCP
    targetPort: 8080
    name: http
  sessionAffinity: ClientIP
  selector:
    app: knowage-server

---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kwnowage-ingress
  namespace: apps
spec:
  rules:
  - host: bi.kr.io
    http:
      paths:
      - path: /
        backend:
          serviceName: knowage-server
          servicePort: 8080

创建后,可使用 bi.kr.io来访问knowage。

使用过程中遇到任何问题欢迎留言或加入Knowage开源BI中国社区:QQ 158245788

Kubernetes环境部署Knowage

谢谢你请我吃糖果


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Software Engineering for Internet Applications

Software Engineering for Internet Applications

Eve Andersson、Philip Greenspun、Andrew Grumet / The MIT Press / 2006-03-06 / USD 35.00

After completing this self-contained course on server-based Internet applications software, students who start with only the knowledge of how to write and debug a computer program will have learned ho......一起来看看 《Software Engineering for Internet Applications》 这本书的介绍吧!

html转js在线工具
html转js在线工具

html转js在线工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具