Kubernetes环境部署Knowage


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

Docker环境安装Knowage

knowage-mysql.yaml

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
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执行:

1
2
3
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

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
100
101
102
103
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


文章作者: KavenRan
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 KavenRan !
 上一篇
如何画好架构图 如何画好架构图
当我们想用一张或几张图来描述我们的系统时,是不是经常遇到以下情况: 对着画布无从下手、删了又来? 用一张图描述我的系统,并且让产品、运营、开发都能看明白? 画了一半的图还不清楚受众是谁? 画出来的图到底是产品图功能图还是技术图又或是大杂烩
2019-03-02
下一篇 
Docker环境安装Knowage Docker环境安装Knowage
What is Knowage?Knowage is the professional open source suite for modern business analytics over traditional sources an
2019-02-24
  目录