OCP_export_import

This commit is contained in:
huanqing.shao
2019-10-01 15:03:15 +08:00
parent 926dc7bfd9
commit 6bd2648ef2
28 changed files with 1016 additions and 82 deletions

View File

@ -349,21 +349,43 @@ module.exports = {
},
{
title: 'Open Capacity Platform',
collapsable: false,
collapsable: true,
children: [
['k8s-practice/ocp/', 'OCP介绍'],
'k8s-practice/ocp/prepare',
'k8s-practice/ocp/build',
'k8s-practice/ocp/sequence',
'k8s-practice/ocp/eureka-server',
'k8s-practice/ocp/mysql',
'k8s-practice/ocp/redis',
'k8s-practice/ocp/auth-server',
'k8s-practice/ocp/user-center',
'k8s-practice/ocp/api-gateway',
'k8s-practice/ocp/back-center',
'k8s-practice/ocp/review',
'k8s-practice/ocp/export',
{
title: '准备',
collapsable: false,
path: '/learning/k8s-practice/ocp/',
children: [
['k8s-practice/ocp/', 'OCP介绍'],
'k8s-practice/ocp/prepare',
'k8s-practice/ocp/build',
]
},
{
title: '部署',
collapsable: false,
path: '/learning/k8s-practice/ocp/sequence.html',
children: [
'k8s-practice/ocp/sequence',
'k8s-practice/ocp/eureka-server',
'k8s-practice/ocp/mysql',
'k8s-practice/ocp/redis',
'k8s-practice/ocp/auth-server',
'k8s-practice/ocp/user-center',
'k8s-practice/ocp/api-gateway',
'k8s-practice/ocp/back-center',
'k8s-practice/ocp/review',
]
},
{
title: '多环境',
collapsable: false,
path: '/learning/k8s-practice/ocp/export.html',
children: [
'k8s-practice/ocp/export',
'k8s-practice/ocp/import',
]
},
]
},
]

View File

@ -0,0 +1,733 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
namespace: ocp
name: cloud-eureka
annotations:
k8s.eip.work/workload: cloud-eureka
k8s.eip.work/displayName: 服务注册中心
k8s.eip.work/service: NodePort
k8s.eip.work/ingress: 'true'
labels:
k8s.eip.work/layer: cloud
k8s.eip.work/name: cloud-eureka
spec:
selector:
matchLabels:
k8s.eip.work/layer: cloud
k8s.eip.work/name: cloud-eureka
template:
metadata:
labels:
k8s.eip.work/layer: cloud
k8s.eip.work/name: cloud-eureka
spec:
imagePullSecrets:
- {}
restartPolicy: Always
initContainers: []
containers:
- image: 'ocpsample/eureka-server:latest'
imagePullPolicy: Always
name: eureka-server
volumeMounts: []
resources: {}
env:
- name: eureka.instance.prefer-ip-address
value: 'false'
envFrom:
- configMapRef:
name: ocp-config
volumes: []
replicas: 3
volumeClaimTemplates: []
serviceName: cloud-eureka
---
apiVersion: v1
kind: Service
metadata:
namespace: ocp
name: cloud-eureka
annotations:
k8s.eip.work/workload: cloud-eureka
k8s.eip.work/displayName: 服务注册中心
labels:
k8s.eip.work/layer: cloud
k8s.eip.work/name: cloud-eureka
spec:
selector:
k8s.eip.work/layer: cloud
k8s.eip.work/name: cloud-eureka
type: NodePort
ports:
- port: 1111
targetPort: 1111
protocol: TCP
name: mpqzwr
nodePort: 31111
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
namespace: ocp
name: cloud-eureka
annotations:
k8s.eip.work/workload: cloud-eureka
k8s.eip.work/displayName: 服务注册中心
labels:
k8s.eip.work/layer: cloud
k8s.eip.work/name: cloud-eureka
spec:
rules:
- host: cloud-eureka.ocp.demo.kuboard.cn
http:
paths:
- path: /
backend:
serviceName: cloud-eureka
servicePort: mpqzwr
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
namespace: ocp
name: cloud-redis
annotations:
k8s.eip.work/workload: cloud-redis
k8s.eip.work/displayName: Redis缓存
k8s.eip.work/service: ClusterIP
k8s.eip.work/ingress: 'false'
labels:
k8s.eip.work/layer: cloud
k8s.eip.work/name: cloud-redis
spec:
selector:
matchLabels:
k8s.eip.work/layer: cloud
k8s.eip.work/name: cloud-redis
template:
metadata:
labels:
k8s.eip.work/layer: cloud
k8s.eip.work/name: cloud-redis
spec:
imagePullSecrets:
- {}
restartPolicy: Always
initContainers: []
containers:
- image: 'redis:4.0.14'
imagePullPolicy: Always
name: redis
volumeMounts: []
resources: {}
env: []
volumes: []
replicas: 1
volumeClaimTemplates: []
serviceName: cloud-redis
---
apiVersion: v1
kind: Service
metadata:
namespace: ocp
name: cloud-redis
annotations:
k8s.eip.work/workload: cloud-redis
k8s.eip.work/displayName: Redis缓存
labels:
k8s.eip.work/layer: cloud
k8s.eip.work/name: cloud-redis
spec:
selector:
k8s.eip.work/layer: cloud
k8s.eip.work/name: cloud-redis
type: ClusterIP
ports:
- port: 6379
targetPort: 6379
protocol: TCP
name: xcndrj
nodePort: 0
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
namespace: ocp
name: db-auth-center
annotations:
k8s.eip.work/workload: db-auth-center
k8s.eip.work/displayName: 认证中心数据库
k8s.eip.work/service: ClusterIP
k8s.eip.work/ingress: 'false'
labels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-auth-center
spec:
selector:
matchLabels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-auth-center
template:
metadata:
labels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-auth-center
spec:
imagePullSecrets:
- {}
restartPolicy: Always
initContainers: []
containers:
- image: 'ocpsample/auth-center-mysql:latest'
imagePullPolicy: Always
name: auth-center-mysql
volumeMounts: []
resources: {}
env:
- name: MYSQL_ROOT_PASSWORD
value: root
volumes: []
replicas: 1
volumeClaimTemplates: []
serviceName: db-auth-center
---
apiVersion: v1
kind: Service
metadata:
namespace: ocp
name: db-auth-center
annotations:
k8s.eip.work/workload: db-auth-center
k8s.eip.work/displayName: 认证中心数据库
labels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-auth-center
spec:
selector:
k8s.eip.work/layer: db
k8s.eip.work/name: db-auth-center
type: ClusterIP
ports:
- port: 3306
targetPort: 3306
protocol: TCP
name: hzib57
nodePort: 0
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
namespace: ocp
name: db-log-center
annotations:
k8s.eip.work/workload: db-log-center
k8s.eip.work/displayName: 日志中心数据库
k8s.eip.work/service: ClusterIP
k8s.eip.work/ingress: 'false'
labels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-log-center
spec:
selector:
matchLabels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-log-center
template:
metadata:
labels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-log-center
spec:
imagePullSecrets:
- {}
restartPolicy: Always
initContainers: []
containers:
- image: 'ocpsample/log-center-mysql:latest'
imagePullPolicy: Always
name: log-center-mysql
volumeMounts: []
resources: {}
env:
- name: MYSQL_ROOT_PASSWORD
value: root
volumes: []
replicas: 1
volumeClaimTemplates: []
serviceName: db-log-center
---
apiVersion: v1
kind: Service
metadata:
namespace: ocp
name: db-log-center
annotations:
k8s.eip.work/workload: db-log-center
k8s.eip.work/displayName: 日志中心数据库
labels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-log-center
spec:
selector:
k8s.eip.work/layer: db
k8s.eip.work/name: db-log-center
type: ClusterIP
ports:
- port: 3306
targetPort: 3306
protocol: TCP
name: 4zep27
nodePort: 0
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
namespace: ocp
name: db-user-center
annotations:
k8s.eip.work/workload: db-user-center
k8s.eip.work/displayName: 用户中心数据库
k8s.eip.work/service: ClusterIP
k8s.eip.work/ingress: 'false'
labels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-user-center
spec:
selector:
matchLabels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-user-center
template:
metadata:
labels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-user-center
spec:
imagePullSecrets:
- {}
restartPolicy: Always
initContainers: []
containers:
- image: 'ocpsample/user-center-mysql:latest'
imagePullPolicy: Always
name: user-center-mysql
volumeMounts: []
resources: {}
env:
- name: MYSQL_ROOT_PASSWORD
value: root
volumes: []
replicas: 1
volumeClaimTemplates: []
serviceName: db-user-center
---
apiVersion: v1
kind: Service
metadata:
namespace: ocp
name: db-user-center
annotations:
k8s.eip.work/workload: db-user-center
k8s.eip.work/displayName: 用户中心数据库
labels:
k8s.eip.work/layer: db
k8s.eip.work/name: db-user-center
spec:
selector:
k8s.eip.work/layer: db
k8s.eip.work/name: db-user-center
type: ClusterIP
ports:
- port: 3306
targetPort: 3306
protocol: TCP
name: 2m2tyy
nodePort: 0
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: ocp
name: gateway-api
annotations:
k8s.eip.work/workload: gateway-api
k8s.eip.work/displayName: 接口网关
k8s.eip.work/service: ClusterIP
k8s.eip.work/ingress: 'true'
labels:
k8s.eip.work/layer: gateway
k8s.eip.work/name: gateway-api
spec:
selector:
matchLabels:
k8s.eip.work/layer: gateway
k8s.eip.work/name: gateway-api
template:
metadata:
labels:
k8s.eip.work/layer: gateway
k8s.eip.work/name: gateway-api
spec:
imagePullSecrets:
- {}
restartPolicy: Always
initContainers: []
containers:
- image: 'ocpsample/api-gateway:latest'
imagePullPolicy: Always
name: api-gateway
volumeMounts: []
resources: {}
env:
- name: spring.datasource.druid.core.url
value: >-
jdbc:mysql://db-auth-center:3306/oauth-center?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
envFrom:
- configMapRef:
name: ocp-config
volumes: []
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: ocp
name: gateway-api
annotations:
k8s.eip.work/workload: gateway-api
k8s.eip.work/displayName: 接口网关
labels:
k8s.eip.work/layer: gateway
k8s.eip.work/name: gateway-api
spec:
selector:
k8s.eip.work/layer: gateway
k8s.eip.work/name: gateway-api
type: ClusterIP
ports:
- port: 9200
targetPort: 9200
protocol: TCP
name: zmcdbh
nodePort: 0
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
namespace: ocp
name: gateway-api
annotations:
k8s.eip.work/workload: gateway-api
k8s.eip.work/displayName: 接口网关
labels:
k8s.eip.work/layer: gateway
k8s.eip.work/name: gateway-api
spec:
rules:
- host: api-gateway.ocp.demo.kuboard.cn
http:
paths:
- path: /
backend:
serviceName: gateway-api
servicePort: zmcdbh
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: ocp
name: svc-auth-server
annotations:
k8s.eip.work/workload: svc-auth-server
k8s.eip.work/displayName: 认证中心
k8s.eip.work/service: ClusterIP
k8s.eip.work/ingress: 'true'
labels:
k8s.eip.work/layer: svc
k8s.eip.work/name: svc-auth-server
spec:
selector:
matchLabels:
k8s.eip.work/layer: svc
k8s.eip.work/name: svc-auth-server
template:
metadata:
labels:
k8s.eip.work/layer: svc
k8s.eip.work/name: svc-auth-server
spec:
imagePullSecrets: []
restartPolicy: Always
initContainers: []
containers:
- image: 'ocpsample/auth-server:latest'
imagePullPolicy: Always
name: auth-server
volumeMounts: []
resources: {}
env:
- name: spring.datasource.druid.core.url
value: >-
jdbc:mysql://db-auth-center:3306/oauth-center?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
envFrom:
- configMapRef:
name: ocp-config
volumes: []
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: ocp
name: svc-auth-server
annotations:
k8s.eip.work/workload: svc-auth-server
k8s.eip.work/displayName: 认证中心
labels:
k8s.eip.work/layer: svc
k8s.eip.work/name: svc-auth-server
spec:
selector:
k8s.eip.work/layer: svc
k8s.eip.work/name: svc-auth-server
type: ClusterIP
ports:
- port: 8000
targetPort: 8000
protocol: TCP
name: dzprby
nodePort: 0
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
namespace: ocp
name: svc-auth-server
annotations:
k8s.eip.work/workload: svc-auth-server
k8s.eip.work/displayName: 认证中心
labels:
k8s.eip.work/layer: svc
k8s.eip.work/name: svc-auth-server
spec:
rules:
- host: svc-auth-server.ocp.demo.kuboard.cn
http:
paths:
- path: /
backend:
serviceName: svc-auth-server
servicePort: dzprby
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: ocp
name: svc-user-center
annotations:
k8s.eip.work/workload: svc-user-center
k8s.eip.work/displayName: 用户中心
k8s.eip.work/service: ClusterIP
k8s.eip.work/ingress: 'true'
labels:
k8s.eip.work/layer: svc
k8s.eip.work/name: svc-user-center
spec:
selector:
matchLabels:
k8s.eip.work/layer: svc
k8s.eip.work/name: svc-user-center
template:
metadata:
labels:
k8s.eip.work/layer: svc
k8s.eip.work/name: svc-user-center
spec:
imagePullSecrets:
- {}
restartPolicy: Always
initContainers: []
containers:
- image: 'ocpsample/user-center:latest'
imagePullPolicy: Always
name: user-center
volumeMounts: []
resources: {}
env:
- name: spring.datasource.druid.core.url
value: >-
jdbc:mysql://db-user-center:3306/user-center?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
envFrom:
- configMapRef:
name: ocp-config
volumes: []
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: ocp
name: svc-user-center
annotations:
k8s.eip.work/workload: svc-user-center
k8s.eip.work/displayName: 用户中心
labels:
k8s.eip.work/layer: svc
k8s.eip.work/name: svc-user-center
spec:
selector:
k8s.eip.work/layer: svc
k8s.eip.work/name: svc-user-center
type: ClusterIP
ports:
- port: 7000
targetPort: 7000
protocol: TCP
name: jhaxwk
nodePort: 0
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
namespace: ocp
name: svc-user-center
annotations:
k8s.eip.work/workload: svc-user-center
k8s.eip.work/displayName: 用户中心
labels:
k8s.eip.work/layer: svc
k8s.eip.work/name: svc-user-center
spec:
rules:
- host: svc-user-center.ocp.demo.kuboard.cn
http:
paths:
- path: /
backend:
serviceName: svc-user-center
servicePort: jhaxwk
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: ocp
name: web-back-center
annotations:
k8s.eip.work/workload: web-back-center
k8s.eip.work/displayName: 后台中心
k8s.eip.work/service: ClusterIP
k8s.eip.work/ingress: 'true'
labels:
k8s.eip.work/layer: web
k8s.eip.work/name: web-back-center
spec:
selector:
matchLabels:
k8s.eip.work/layer: web
k8s.eip.work/name: web-back-center
template:
metadata:
labels:
k8s.eip.work/layer: web
k8s.eip.work/name: web-back-center
spec:
imagePullSecrets:
- {}
restartPolicy: Always
initContainers: []
containers:
- image: 'ocpsample/back-center:latest'
imagePullPolicy: Always
name: back-center
volumeMounts: []
resources: {}
env: []
envFrom:
- configMapRef:
name: ocp-config
volumes: []
replicas: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: ocp
name: web-back-center
annotations:
k8s.eip.work/workload: web-back-center
k8s.eip.work/displayName: 后台中心
labels:
k8s.eip.work/layer: web
k8s.eip.work/name: web-back-center
spec:
selector:
k8s.eip.work/layer: web
k8s.eip.work/name: web-back-center
type: ClusterIP
ports:
- port: 80
targetPort: 80
protocol: TCP
name: rxcrxf
nodePort: 0
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
namespace: ocp
name: web-back-center
annotations:
k8s.eip.work/workload: web-back-center
k8s.eip.work/displayName: 后台中心
labels:
k8s.eip.work/layer: web
k8s.eip.work/name: web-back-center
spec:
rules:
- host: back-center.ocp.demo.kuboard.cn
http:
paths:
- path: /
backend:
serviceName: web-back-center
servicePort: rxcrxf
---
metadata:
name: ocp-config
namespace: ocp
data:
CLOUD_EUREKA_URL: 'http://cloud-eureka.ocp.demo.kuboard.cn/'
GATEWAY_API_URL: 'http://api-gateway.ocp.demo.kuboard.cn/'
eureka.client.serviceUrl.defaultZone: >-
http://cloud-eureka-0.cloud-eureka.ocp.svc.cluster.local:1111/eureka,http://cloud-eureka-1.cloud-eureka.ocp.svc.cluster.local:1111/eureka,http://cloud-eureka-2.cloud-eureka.ocp.svc.cluster.local:1111/eureka
spring.datasource.druid.log.url: >-
jdbc:mysql://db-log-center:3306/log-center?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
spring.redis.host: cloud-redis
kind: ConfigMap

View File

@ -86,19 +86,21 @@ Kubernetes教程的主要依据是Kubernetes 官网文档,以及使用 Kubo
在 Kubernetes 上部署 Spring Cloud 微服务:(Open Capacity Platform)
* [OCP介绍](https://kuboard.cn/learning/k8s-practice/ocp/)
* [准备OCP的构建环境和部署环境](https://kuboard.cn/learning/k8s-practice/ocp/prepare.html)
* [构建Docker镜像并推送到仓库](https://kuboard.cn/learning/k8s-practice/ocp/build.html)
* [部署顺序](https://kuboard.cn/learning/k8s-practice/ocp/sequence.html)
* [在K8S上部署eureka-server](https://kuboard.cn/learning/k8s-practice/ocp/eureka-server.html)
* [在K8S上部署mysql](https://kuboard.cn/learning/k8s-practice/ocp/mysql.html)
* [在K8S上部署redis](https://kuboard.cn/learning/k8s-practice/ocp/redis.html)
* [在K8S上部署auth-server](https://kuboard.cn/learning/k8s-practice/ocp/auth-server.html)
* [在K8S上部署user-center](https://kuboard.cn/learning/k8s-practice/ocp/user-center.html)
* [在K8S上部署api-gateway](https://kuboard.cn/learning/k8s-practice/ocp/api-gateway.html)
* [在K8S上部署back-center](https://kuboard.cn/learning/k8s-practice/ocp/back-center.html)
* [重新审视配置信息](https://kuboard.cn/learning/k8s-practice/ocp/review.html)
* [导出部署配置]
* [在新的名称空间导入部署配置]
* 准备
* [准备OCP的构建环境和部署环境](https://kuboard.cn/learning/k8s-practice/ocp/prepare.html)
* [构建docker镜像并推送到仓库](https://kuboard.cn/learning/k8s-practice/ocp/build.html)
* 部署
* [部署顺序](https://kuboard.cn/learning/k8s-practice/ocp/sequence.html)
* [在K8S上部署eureka-server](https://kuboard.cn/learning/k8s-practice/ocp/eureka-server.html)
* [在K8S上部署mysql](https://kuboard.cn/learning/k8s-practice/ocp/mysql.html)
* [在K8S上部署redis](https://kuboard.cn/learning/k8s-practice/ocp/redis.html)
* [在K8S上部署auth-server](https://kuboard.cn/learning/k8s-practice/ocp/auth-server.html)
* [在K8S上部署user-center](https://kuboard.cn/learning/k8s-practice/ocp/user-server.html)
* [在K8S上部署api-gateway](https://kuboard.cn/learning/k8s-practice/ocp/api-gateway.html)
* [在K8S上部署back-center](https://kuboard.cn/learning/k8s-practice/ocp/back-center.html)
* [重新审视配置信息](https://kuboard.cn/learning/k8s-practice/ocp/review.html)
* 多环境
* [导出部署配置](https://kuboard.cn/learning/k8s-practice/ocp/export.html)
* [导入部署配置](https://kuboard.cn/learning/k8s-practice/ocp/import.html)
Kuboard官网免费提供 K8S教程K8S安装文档学习过程中如有疑问请加QQ群在线答疑。

View File

@ -84,17 +84,19 @@ description: Kubernetes免费中文教程目录
在 Kubernetes 上部署 Spring Cloud 微服务:(Open Capacity Platform)
* [OCP介绍](/learning/k8s-practice/ocp/)
* [准备OCP的构建环境和部署环境](/learning/k8s-practice/ocp/prepare.html)
* [构建docker镜像并推送到仓库](/learning/k8s-practice/ocp/build.html)
* [部署顺序](/learning/k8s-practice/ocp/sequence.html)
* [在K8S上部署eureka-server](/learning/k8s-practice/ocp/eureka-server.html)
* [在K8S上部署mysql](/learning/k8s-practice/ocp/mysql.html)
* [在K8S上部署redis](/learning/k8s-practice/ocp/redis.html)
* [在K8S上部署auth-center](/learning/k8s-practice/ocp/auth-server.html)
* [在K8S上部署user-center](/learning/k8s-practice/ocp/user-center.html)
* [在K8S上部署api-gateway](/learning/k8s-practice/ocp/api-gateway.html)
* [在K8S上部署back-center](/learning/k8s-practice/ocp/back-center.html)
* [重新审视配置信息](/learning/k8s-practice/ocp/review.html)
* [导出部署配置]
* [在新的名称空间导入部署配置]
* 准备
* [准备OCP的构建环境和部署环境](/learning/k8s-practice/ocp/prepare.html)
* [构建docker镜像并推送到仓库](/learning/k8s-practice/ocp/build.html)
* 部署
* [部署顺序](/learning/k8s-practice/ocp/sequence.html)
* [在K8S上部署eureka-server](/learning/k8s-practice/ocp/eureka-server.html)
* [在K8S上部署mysql](/learning/k8s-practice/ocp/mysql.html)
* [在K8S上部署redis](/learning/k8s-practice/ocp/redis.html)
* [在K8S上部署auth-server](/learning/k8s-practice/ocp/auth-server.html)
* [在K8S上部署user-center](/learning/k8s-practice/ocp/user-server.html)
* [在K8S上部署api-gateway](/learning/k8s-practice/ocp/api-gateway.html)
* [在K8S上部署back-center](/learning/k8s-practice/ocp/back-center.html)
* [重新审视配置信息](/learning/k8s-practice/ocp/review.html)
* 多环境
* [导出部署配置](/learning/k8s-practice/ocp/export.html)
* [导入部署配置](/learning/k8s-practice/ocp/import.html)

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -10,8 +10,38 @@ meta:
# 导出部署配置
通过本系列文章前面的部分,我们终于完整了 Spring Cloud OCP 的核心组件在 Kubernetes 上的部署。此时Kuboard 的名称空间 `ocp` 界面的截图如下所示:
![Kubernetes教程_部署SpringCloud_OCP_导出部署配置_配置内容](./export.assets/image-20191001123231022.png)
接下来,立刻要面临的问题是:假设刚部署完的环境是用于开发的,那我们如何快速部署一个新的环境用于测试呢?
Kuboard 支持您将此名称空间界面导出到一个 yaml 文件并在另一个名称空间或Kubernetes集群中导入所有的配置。本文档后面的部分将描述导出配置的过程
* 点击 **导出工作负载** 按钮
选择 **展现层**、**网关层**、**服务层**、**持久层**、**中间件** 五个分层,点击刷新,然后全选所有的工作负载,如下图所示:
![Kubernetes教程_部署SpringCloud_OCP_导出部署配置_筛选工作负载](./export.assets/image-20191001125319936.png)
* 点击 **下一步** 按钮
选择 `ocp-config`,如下图所示:
![Kubernetes教程_部署SpringCloud_OCP_导出部署配置_筛选ConfigMap](./export.assets/image-20191001125449800.png)
* 点击 **下一步** 按钮
![Kubernetes教程_部署SpringCloud_OCP_导出部署配置_筛选Secrets](./export.assets/image-20191001125539949.png)
* 点击 **下一步** 按钮
![Kubernetes教程_部署SpringCloud_OCP_导出部署配置_确认导出信息明细](./export.assets/image-20191001125606055.png)
* 点击 **确定** 按钮
并保存文件,文件名格式为 `kuboard_名称空间_年_月_日_时_分_秒.yaml`,例如 `kuboard_ocp_2019_10_01_12_56_14.yaml`
![Kubernetes教程_部署SpringCloud_OCP_导出部署配置_下载导出文件](./export.assets/image-20191001131142691.png)
:tada: :tada: :tada: 您已完成了部署和配置信息的导出,下一步可以在新的名称空间直接导入,请参考 [导入部署配置](./import.html)

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

View File

@ -0,0 +1,137 @@
---
vssueId: 105
titlePrefix: 部署SpringCloud_OCP
layout: LearningLayout
description: Kubernetes教程_使用Kuboard在Kubernetes上部署Spring_Cloud微服务平台OCP_open_capacity_platform微服务能力开放平台_导入部署配置
meta:
- name: keywords
content: Kubernetes部署SpringCloud,Kubernetes部署OCP,Kuboard部署OCP
---
# 导入部署配置
<script>
export default {
data () {
return {
}
},
methods: {
downloadYaml () {
if (window.ga) {
window.ga('send', {
hitType: 'event',
eventCategory: '下载OCP_YAML',
eventAction: 'OCP_YAML',
eventLabel: '下载OCP部署yaml文件'
});
console.log('发送成功 ga event')
} else {
console.log('开发环境,不发送 ga event')
}
}
}
}
</script>
## 获得yaml文件
在 [导出部署配置](./export.html) 中,我们将 Spring Cloud OCP 部署相关的所有信息导出到一个 yaml 文件,本文描述如何在一个新的名称空间(或者新的 Kubernetes 集群)中导入该部署信息,并形成一个新的独立的部署环境。
如果您还没有该 yaml 文件,可从此处
<span v-on:click="downloadYaml"><a :href="$withBase('/practice/ocp/kuboard_ocp_2019_10_01_13_58_04.yaml')" download="kuboard_ocp_2019_10_01.yaml">下载 OCP部署yaml文件</a></span>
## 导入yaml文件
假设您已创建了名称空间 `ocp-import` 用来导入部署配置。请参考接下来的导入步骤:
* 点击 **导入工作负载** 按钮
在此界面中上传前一个步骤导出的(或从 www.kuboard.cn 下载的yaml 文件。如下图所示:
![Kubernetes教程_部署SpringCloud_OCP_导入部署配置_上传YAML文件](./import.assets/image-20191001141313966.png)
* 点击 **下一步** 按钮
全选所有的工作负载,如下图所示:
![Kubernetes教程_部署SpringCloud_OCP_导入部署配置_选择要导入的工作负载](./import.assets/image-20191001141409779.png)
* 点击 **下一步** 按钮
选中 `ocp-config` 如下图所示:
![Kubernetes教程_部署SpringCloud_OCP_导入部署配置_选择要导入的ConfigMap](./import.assets/image-20191001141454878.png)
* 点击 **下一步** 按钮
如下图所示:
![Kubernetes教程_部署SpringCloud_OCP_导入部署配置_选择要导入的Secret](./import.assets/image-20191001141532125.png)
* 点击 **下一步** 按钮
如下图所示:
![Kubernetes教程_部署SpringCloud_OCP_导入部署配置_配置存储卷](./import.assets/image-20191001141554887.png)
* 点击 **下一步** 按钮
勾选 `使用随机端口` 此处由于我们在原集群的新名称空间中导入配置,因此,需要修改节点端口号,以避免冲突。如果您不知道该怎么分配端口号,可以在节点端口字段填写 `0`,集群将自动为您分配可用的节点端口。
![Kubernetes教程_部署SpringCloud_OCP_导入部署配置_配置节点端口](./import.assets/image-20191001142507168.png)
* 点击 **下一步** 按钮
在此界面中调整对外的域名,以避免和原名称空间的部署产生域名冲突,如下图所示:
* cloud-eureka.ocp-import.demo.kuboard.cn
* api-gateway.ocp-import.demo.kuboard.cn
* svc-auth-server.ocp-import.demo.kuboard.cn
* svc-user-center.ocp-import.demo.kuboard.cn
* back-center.ocp-import.demo.kuboard.cn
![Kubernetes教程_部署SpringCloud_OCP_导入部署配置_配置域名](./import.assets/image-20191001141951560.png)
* 点击 **确定** 按钮
![Kubernetes教程_部署SpringCloud_OCP_导入部署配置_校验导入参数](./import.assets/image-20191001142617667.png)
* 点击 **应用** 按钮
![Kubernetes教程_部署SpringCloud_OCP_执行导入操作](./import.assets/image-20191001142642948.png)
* 点击 **完成** 按钮
* 此时进入名称空间,可看到所有的配置和部署都已经完成导入。
## 导入后调整
* 导入到新的名称空间以后ConfigMap中配置参数受到影响的部分需要调整如下图所示
* <span style="color: blue">eureka.client.serviceUrl.defaultZone</span> = `http://cloud-eureka-0.cloud-eureka.ocp-import.svc.cluster.local:1111/eureka,http://cloud-eureka-1.cloud-eureka.ocp-import.svc.cluster.local:1111/eureka,http://cloud-eureka-2.cloud-eureka.ocp-import.svc.cluster.local:1111/eureka`
* <span style="color: blue">spring.datasource.druid.log.url</span> = `jdbc:mysql://db-log-center:3306/log-center?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false`
* <span style="color: blue">spring.redis.host</span> = `cloud-redis`
* <font color="blue">GATEWAY_API_URL</font> = `http://api-gateway.ocp-import.demo.kuboard.cn/`
* <font color="blue">CLOUD_EUREKA_URL</font> = `http://cloud-eureka.ocp-import.demo.kuboard.cn/`
![Kubernetes教程_部署SpringCloud_OCP_导入部署配置_调整ConfigMap中的参数](./import.assets/image-20191001142831089.png)
* 由于 ConfigMap 中的参数发生了变化,此时必须删除所以引用该 ConfigMap 中的容器组Kubernetes 将自动创建新的容器组以替换被删除的容器组新的容器组中ConfigMap 的变更将生效。
点击名称空间上方的 **容器组列表** 按钮,全选,并删除,如下图所示:
![Kubernetes教程_部署SpringCloud_OCP_导入部署配置_重启容器组](./import.assets/image-20191001142955738.png)
## 验证配置
* 在浏览器打开 `http://back-end.ocp-import.demo.kuboard.cn` (此域名已失效,以节省演示服务器空间,请使用您自己的域名),可登录 OCP 后台中心的界面。
:tada: :tada: :tada: 您成功学会了如何使用 Kuboard 快速复制一份 Spring Cloud 微服务架构的部署环境。
## Kuboard授权
使用 Kuboard 是免费的,请查看 [Kuboard 授权声明](/support/)

View File

@ -9,27 +9,30 @@ description: Kubernetes教程_使用Kuboard在Kubernetes上部署Spring_Cloud微
## 使用 Kuboard 在 K8S 上部署 OCP
Kuboard 网站将陆续 **连载** 如何使用 Kuboard 在 Kubernetes 上部署 OCP 的如下组件:
本系列文章将描述如何使用 Kuboard 在 Kubernetes 上部署 OCP 的如下组件:
* eureka-server
* auth-server
* user-center
* api-gateway
* back-center
该系列连载文章的目录如下:
* [准备OCP的构建环境和部署环境](/learning/k8s-practice/ocp/prepare.html)
* [构建docker镜像并推送到仓库](/learning/k8s-practice/ocp/build.html)
* [部署顺序](/learning/k8s-practice/ocp/sequence.html)
* [在K8S上部署eureka-server](/learning/k8s-practice/ocp/eureka-server.html)
* [在K8S上部署mysql](/learning/k8s-practice/ocp/mysql.html)
* [在K8S上部署redis](/learning/k8s-practice/ocp/redis.html)
* [在K8S上部署auth-server](/learning/k8s-practice/ocp/auth-server.html)
* [在K8S上部署user-center](/learning/k8s-practice/ocp/user-server.html)
* [在K8S上部署api-gateway](/learning/k8s-practice/ocp/api-gateway.html)
* [在K8S上部署back-center](/learning/k8s-practice/ocp/back-center.html)
* [重新审视配置信息](/learning/k8s-practice/ocp/review.html)
* [导出部署配置](/learning/k8s-practice/ocp/export.html)
* [在新的名称空间导入部署配置]
该系列文章的目录如下:
* 准备
* [准备OCP的构建环境和部署环境](/learning/k8s-practice/ocp/prepare.html)
* [构建docker镜像并推送到仓库](/learning/k8s-practice/ocp/build.html)
* 部署
* [部署顺序](/learning/k8s-practice/ocp/sequence.html)
* [在K8S上部署eureka-server](/learning/k8s-practice/ocp/eureka-server.html)
* [在K8S上部署mysql](/learning/k8s-practice/ocp/mysql.html)
* [在K8S上部署redis](/learning/k8s-practice/ocp/redis.html)
* [在K8S上部署auth-server](/learning/k8s-practice/ocp/auth-server.html)
* [在K8S上部署user-center](/learning/k8s-practice/ocp/user-server.html)
* [在K8S上部署api-gateway](/learning/k8s-practice/ocp/api-gateway.html)
* [在K8S上部署back-center](/learning/k8s-practice/ocp/back-center.html)
* [重新审视配置信息](/learning/k8s-practice/ocp/review.html)
* 多环境
* [导出部署配置](/learning/k8s-practice/ocp/export.html)
* [导入部署配置](/learning/k8s-practice/ocp/import.html)
::: tip OCP答疑
与 OCP 相关的问题,请加 OCP 的 QQ群 483725710

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

View File

@ -126,13 +126,14 @@ meta:
可参考文档 [使用ConfigMap配置您的应用程序](/learning/k8s-intermediate/config/config-map.html#configmap-%E5%AE%B9%E5%99%A8%E7%9A%84%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%EF%BC%88configmap%E7%9A%84%E6%89%80%E6%9C%89%E5%90%8D%E5%80%BC%E5%AF%B9%EF%BC%89)
* 在 Kuboard 界面中进入 `ocp` 名称空间
* 创建ConfigMap并填入个名值对:
* 创建ConfigMap并填入个名值对:
* <span style="color: blue">eureka.client.serviceUrl.defaultZone</span> = `http://cloud-eureka-0.cloud-eureka.ocp.svc.cluster.local:1111/eureka,http://cloud-eureka-1.cloud-eureka.ocp.svc.cluster.local:1111/eureka,http://cloud-eureka-2.cloud-eureka.ocp.svc.cluster.local:1111/eureka`
* <span style="color: blue">spring.datasource.druid.log.url</span> = `jdbc:mysql://db-log-center:3306/log-center?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false`
* <span style="color: blue">spring.redis.host</span> = `cloud-redis`
* <font color="blue">GATEWAY_API_URL</font> = `http://api-gateway.ocp.demo.kuboard.cn/`
* <font color="blue">CLOUD_EUREKA_URL</font> = `http://cloud-eureka.ocp.demo.kuboard.cn/`
![Kubernetes教程部署SpringCloud_创建ConfigMap](./review.assets/image-20191001090827800.png)
![Kubernetes教程部署SpringCloud_创建ConfigMap](./review.assets/image-20191001135132953.png)
* 修改 eureka-server、auth-server、user-center、api-gateway 的部署信息,将上面创建的 ConfigMap 中所有名值对注入到容器的环境变量,并去除已经在 ConfigMap 中包含的环境变量。
@ -149,11 +150,13 @@ meta:
在本教程中,为了避免对 OCP 已有代码的修改,因此以直接注入 `spring.datasource.druid.log.url` 类似的环境变量的方式使docker镜像适应不同的环境开发环境、测试环境、生产环境等。这种做法就会碰到一个比较尴尬的情况例如对于参数 `spring.datasource.druid.core.url` 键值相同而不同模块中auth-server、user-center、api-gateway取值却不同。这是从参数使用者视角来看不可避免的现象。
一个建议的方式是从参数提供者的视角来定义环境变量参数并由参数使用者引用。例如我们定义如下几个ConfigMap属性
* <font color="blue">EUREKA_URLS</font>=http://cloud-eureka-0.cloud-eureka.ocp.svc.cluster.local:1111/eureka,http://cloud-eureka-1.cloud-eureka.ocp.svc.cluster.local:1111/eureka,http://cloud-eureka-2.cloud-eureka.ocp.svc.cluster.local:1111/eureka
* <font color="blue">DB_AUTH_CENTER_URL</font>=jdbc:mysql://db-auth-center:3306/auth-center?useUnicode=true&characterEncoding=utf-8&allowMultiQueries</font>=true&useSSL=false
* <font color="blue">DB_USER_CENTER_URL</font>=jdbc:mysql://db-user-center:3306/user-center?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
* <font color="blue">DB_LOG_CENTER_URL</font>=jdbc:mysql://db-log-center:3306/log-center?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
* <font color="blue">REDIS_HOST</font>=cloud-redis
* <font color="blue">EUREKA_URLS</font> = `http://cloud-eureka-0.cloud-eureka.ocp.svc.cluster.local:1111/eureka,http://cloud-eureka-1.cloud-eureka.ocp.svc.cluster.local:1111/eureka,http://cloud-eureka-2.cloud-eureka.ocp.svc.cluster.local:1111/eureka`
* <font color="blue">DB_AUTH_CENTER_URL</font> = `jdbc:mysql://db-auth-center:3306/auth-center?useUnicode=true&characterEncoding=utf-8&allowMultiQueries</font>=true&useSSL=false`
* <font color="blue">DB_USER_CENTER_URL</font>= `jdbc:mysql://db-user-center:3306/user-center?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false`
* <font color="blue">DB_LOG_CENTER_URL</font> = `jdbc:mysql://db-log-center:3306/log-center?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false`
* <font color="blue">REDIS_HOST</font> = `cloud-redis`
* <font color="blue">GATEWAY_API_URL</font> = `http://api-gateway.ocp.demo.kuboard.cn/`
* <font color="blue">CLOUD_EUREKA_URL</font> = `http://cloud-eureka.ocp.demo.kuboard.cn/`
然后在参数使用者的 `application.xml` 中引用这些环境变量参数,以 auth-center 的 `application.xml` 为例:

View File

@ -176,20 +176,22 @@ Kuboard 为 Kubernetes 初学者设计了如下学习路径:
在 Kubernetes 上部署 Spring Cloud 微服务:(Open Capacity Platform)
* [OCP介绍](/learning/k8s-practice/ocp/)
* [准备OCP的构建环境和部署环境](/learning/k8s-practice/ocp/prepare.html)
* [构建docker镜像并推送到仓库](/learning/k8s-practice/ocp/build.html)
* [部署顺序](/learning/k8s-practice/ocp/sequence.html)
* [在K8S上部署eureka-server](/learning/k8s-practice/ocp/eureka-server.html)
* [在K8S上部署mysql](/learning/k8s-practice/ocp/mysql.html)
* [在K8S上部署redis](/learning/k8s-practice/ocp/redis.html)
* [在K8S上部署auth-center](/learning/k8s-practice/ocp/auth-server.html)
* [在K8S上部署user-center](/learning/k8s-practice/ocp/user-center.html)
* [在K8S上部署api-gateway](/learning/k8s-practice/ocp/api-gateway.html)
* [在K8S上部署back-center](/learning/k8s-practice/ocp/back-center.html)
* [重新审视配置信息](/learning/k8s-practice/ocp/review.html)
* [导出部署配置]
* [在新的名称空间导入部署配置]
* 准备
* [准备OCP的构建环境和部署环境](/learning/k8s-practice/ocp/prepare.html)
* [构建docker镜像并推送到仓库](/learning/k8s-practice/ocp/build.html)
* 部署
* [部署顺序](/learning/k8s-practice/ocp/sequence.html)
* [在K8S上部署eureka-server](/learning/k8s-practice/ocp/eureka-server.html)
* [在K8S上部署mysql](/learning/k8s-practice/ocp/mysql.html)
* [在K8S上部署redis](/learning/k8s-practice/ocp/redis.html)
* [在K8S上部署auth-server](/learning/k8s-practice/ocp/auth-server.html)
* [在K8S上部署user-center](/learning/k8s-practice/ocp/user-server.html)
* [在K8S上部署api-gateway](/learning/k8s-practice/ocp/api-gateway.html)
* [在K8S上部署back-center](/learning/k8s-practice/ocp/back-center.html)
* [重新审视配置信息](/learning/k8s-practice/ocp/review.html)
* 多环境
* [导出部署配置](/learning/k8s-practice/ocp/export.html)
* [导入部署配置](/learning/k8s-practice/ocp/import.html)
### Kubernetes 有经验者