Update deployment (#960)
diff --git a/README.md b/README.md
index 4948e01..ab096a2 100644
--- a/README.md
+++ b/README.md
@@ -123,7 +123,7 @@
But before you can apply the manifests, override the default value defined in [application.properties](./dubbo-admin-server/src/main/resources/application.properties) by adding items in `configmap.yaml`.
```sh
-$ cd /dubbo-admin/deploy/k8s
+$ cd /dubbo-admin/deploy/kubernetes
```
**2. Deploy Dubbo Admin**
diff --git a/README_ZH.md b/README_ZH.md
index 42c0b71..e9a5f33 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -120,7 +120,7 @@
切换到 `deploy/k8s` 目录可以看到 Admin kubernetes 资源文件
```sh
-$ cd /dubbo-admin/deploy/k8s
+$ cd /dubbo-admin/deploy/kubernetes
```
**2. 部署 Dubbo Admin**
diff --git a/deploy/k8s/configmap.yaml b/deploy/k8s/configmap.yaml
deleted file mode 100644
index dba952d..0000000
--- a/deploy/k8s/configmap.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-apiVersion: v1
-kind: ConfigMap
-metadata:
- name: dubbo-admin
-data:
- # Set the properties you want to override, properties not set here will be using the default values
- # check application.properties inside dubbo-admin project for the keys supported
- application.properties: |
- admin.registry.address=zookeeper://127.0.0.1:2181
- admin.config-center=zookeeper://127.0.0.1:2181
- admin.metadata-report.address=zookeeper://127.0.0.1:2181
diff --git a/deploy/k8s/deployment.yaml b/deploy/k8s/deployment.yaml
deleted file mode 100644
index 2b8f572..0000000
--- a/deploy/k8s/deployment.yaml
+++ /dev/null
@@ -1,28 +0,0 @@
-apiVersion: apps/v1
-kind: Deployment
-metadata:
- labels:
- app: dubbo-admin
- name: dubbo-admin
-spec:
- replicas: 2
- selector:
- matchLabels:
- app: dubbo-admin
- template:
- metadata:
- labels:
- app: dubbo-admin
- spec:
- containers:
- - image: apache/dubbo-admin:latest
- name: dubbo-admin
- ports:
- - containerPort: 38080
- volumeMounts:
- - mountPath: /config
- name: application-properties
- volumes:
- - name: application-properties
- configMap:
- name: dubbo-admin
\ No newline at end of file
diff --git a/deploy/k8s/service.yaml b/deploy/k8s/service.yaml
deleted file mode 100644
index bdcc445..0000000
--- a/deploy/k8s/service.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-apiVersion: v1
-kind: Service
-metadata:
- name: dubbo-admin
-spec:
- selector:
- app: dubbo-admin
- ports:
- - protocol: TCP
- port: 38080
- targetPort: 38080
-
diff --git a/deploy/kubernetes/configmap.yaml b/deploy/kubernetes/configmap.yaml
new file mode 100644
index 0000000..1e84c9d
--- /dev/null
+++ b/deploy/kubernetes/configmap.yaml
@@ -0,0 +1,54 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: dubbo-admin
+ namespace: default
+data:
+ application.properties: |
+ admin.registry.address=zookeeper://zookeeper:2181
+ admin.config-center=zookeeper://zookeeper:2181
+ admin.metadata-report.address=zookeeper://zookeeper:2181
+ admin.root.user.name=root
+ admin.root.user.password=root
+ admin.check.sessionTimeoutMilli=3600000
+ server.compression.enabled=true
+ server.compression.mime-types=text/css,text/javascript,application/javascript
+ server.compression.min-response-size=10240
+ admin.check.tokenTimeoutMilli=3600000
+ admin.check.signSecret=86295dd0c4ef69a1036b0b0c15158d77
+ dubbo.application.name=dubbo-admin
+ dubbo.registry.address=${admin.registry.address}
+ spring.datasource.url=jdbc:h2:mem:~/dubbo-admin;MODE=MYSQL;
+ spring.datasource.username=sa
+ spring.datasource.password=
+ mybatis-plus.global-config.db-config.id-type=none
+ dubbo.application.logger=slf4j
+
+ # nacos config, add parameters to url like username=nacos&password=nacos
+ # admin.registry.address=nacos://127.0.0.1:8848?group=DEFAULT_GROUP&namespace=public
+ # admin.config-center=nacos://127.0.0.1:8848?group=dubbo
+ # admin.metadata-report.address=nacos://127.0.0.1:8848?group=dubbo
+
+
+ # group (Deprecated it is recommended to use URL to add parameters,will be removed in the future)
+ # admin.registry.group=dubbo
+ # admin.config-center.group=dubbo
+ # admin.metadata-report.group=dubbo
+
+ # namespace used by nacos.(Deprecated it is recommended to use URL to add parameters,will be removed in the future)
+ # admin.registry.namespace=public
+ # admin.config-center.namespace=public
+ # admin.metadata-report.namespace=public
+
+ # apollo config
+ # admin.config-center = apollo://localhost:8070?token=e16e5cd903fd0c97a116c873b448544b9d086de9&app.id=test&env=dev&cluster=default&namespace=dubbo
+ # admin.apollo.token=e16e5cd903fd0c97a116c873b448544b9d086de9
+ # admin.apollo.appId=test
+ # admin.apollo.env=dev
+ # admin.apollo.cluster=default
+
+ # mysql
+ # spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+ # spring.datasource.url=jdbc:mysql://localhost:3306/dubbo-admin?characterEncoding=utf8&connectTimeout=1000&socketTimeout=10000&autoReconnect=true
+ # spring.datasource.username=root
+ # spring.datasource.password=mysql
\ No newline at end of file
diff --git a/deploy/kubernetes/deployment.yaml b/deploy/kubernetes/deployment.yaml
new file mode 100644
index 0000000..3fea33a
--- /dev/null
+++ b/deploy/kubernetes/deployment.yaml
@@ -0,0 +1,54 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ labels:
+ app: dubbo-admin
+ name: dubbo-admin
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ app: dubbo-admin
+ template:
+ metadata:
+ labels:
+ app: dubbo-admin
+ spec:
+ serviceAccountName: dubbo-admin
+ containers:
+ - name: dubbo-admin
+ image: apache/dubbo-admin:0.5.0
+ imagePullPolicy: IfNotPresent
+ ports:
+ - containerPort: 8080
+ name: http
+ volumeMounts:
+ - mountPath: /config
+ name: application-properties
+ livenessProbe:
+ httpGet:
+ path: /
+ port: 8080
+ initialDelaySeconds: 10
+ periodSeconds: 10
+ successThreshold: 1
+ timeoutSeconds: 15
+ readinessProbe:
+ httpGet:
+ path: /
+ port: 8080
+ initialDelaySeconds: 10
+ periodSeconds: 10
+ successThreshold: 1
+ timeoutSeconds: 15
+ resources:
+ limits: {}
+ requests:
+ cpu: 500m
+ memory: 1Gi
+ securityContext:
+ runAsUser: 0
+ volumes:
+ - name: application-properties
+ configMap:
+ name: dubbo-admin
\ No newline at end of file
diff --git a/deploy/kubernetes/rbac.yaml b/deploy/kubernetes/rbac.yaml
new file mode 100644
index 0000000..072b376
--- /dev/null
+++ b/deploy/kubernetes/rbac.yaml
@@ -0,0 +1,48 @@
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: dubbo-admin
+ namespace: default
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRole
+metadata:
+ name: dubbo-admin
+rules:
+ - apiGroups:
+ - ""
+ resources:
+ - pods
+ verbs:
+ - get
+ - list
+ - watch
+ - apiGroups:
+ - "extensions"
+ resources:
+ - ingresses
+ verbs:
+ - get
+ - apiGroups:
+ - "apps"
+ resources:
+ - configmaps
+ - deployments
+ - services
+ verbs:
+ - get
+ - list
+ - watch
+---
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+ name: dubbo-admin
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: ClusterRole
+ name: dubbo-admin
+subjects:
+ - kind: ServiceAccount
+ name: dubbo-admin
+ namespace: default
\ No newline at end of file
diff --git a/deploy/kubernetes/service.yaml b/deploy/kubernetes/service.yaml
new file mode 100644
index 0000000..439027c
--- /dev/null
+++ b/deploy/kubernetes/service.yaml
@@ -0,0 +1,14 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: dubbo-admin
+ namespace: default
+spec:
+ type: NodePort
+ ports:
+ - name: dubbo-admin
+ port: 38080
+ targetPort: http
+ protocol: TCP
+ selector:
+ app: dubbo-admin
\ No newline at end of file