Srping-Cloud 实战文章链接
Spring-Cloud 实战 一 服务配置中心 config
Spring-Cloud 实战 二 服务注册与发现 eureka
Spring-Cloud 实战 三 服务提供者
Spring-Cloud 实战 四 服务消费 feign
Spring-Cloud 实战 五 服务消费 feign + 断路器 hystrix
Spring-Cloud 实战 六 网关 zuul
Spring-Cloud 实战 七 全链路监控 zipkin
Spring-Cloud 实战 八 服务监控 spring-boot admin
Spring-Cloud 实战 九 Spring-Cloud 之 Docker Compose编排
前提
- 熟悉 Docker 操作、Dockefile编写
- 熟悉 kubernetes 基础操作
- 熟悉 kubernetes 基本resource
可以查看之前文章
环境
- kubernetes v1.14.3 kubernetes 集群搭建
整体架构图
build 镜像
以配置中心为例其他的一致
cd config
docker build -t xiliangma/mscloud-config .
准备deployment、service
以配置中心为例其他的一致
apiVersion: apps/v1
kind: Deployment
metadata:
name: mscloud-config
spec:
replicas: 1
selector:
matchLabels:
app: mscloud-config
project: mscloud
template:
metadata:
labels:
app: mscloud-config
project: mscloud
spec:
containers:
- name: config
image: xiliangma/mscloud-config:latest
imagePullPolicy: IfNotPresent
ports:
- name: dev
containerPort: 8888
hostPort: 30001
resources:
limits:
cpu: 1000m
memory: 1024Mi
requests:
cpu: 300m
memory: 256Mi
volumeMounts:
- mountPath: /mscloud/config
name: config-data
volumes:
- name: config-data
hostPath:
path: /tmp/mscloud/config
---
apiVersion: v1
kind: Service
metadata:
name: mscloud-config-service
labels:
app: mscloud-config
project: mscloud
spec:
selector:
app: mscloud-config
project: mscloud
ports:
- name: dev
port: 8888
注意: 大部分module需要创建service,这里服务间访问通过service访问。
部署
以配置中心为例其他的一致
kubectl apply -f 01-config.yml
测试
config:
eureka 服务注册:
熔断监控:
zipkin 请求监控:
admin 服务:
admin 监控: