k8s 1.10 部署springcloud

1.機器前端

機器   用途
192.168.30.11 k8s master
192.168.30.12 k8s node
192.168.30.13 docker 私服

 

   
   
   

 

2. 微服務列表vue

192.168.30.13:5000/microarch-sys-registry-0.0.1  註冊中心node

192.168.30.13:5000/microarch-sys-gateway-0.0.1網關web

192.168.30.13:5000/microarch-sys-service-0.0.1 系統服務docker

192.168.30.13:5000/webclient vue前端項目api

3.修改註冊中心微服務配置文件(application-microarch-sys-registry.yml,application-loc.yml),將註冊中心地址改成k8s 服務名稱,保持k8s服務名稱和微服務名稱同樣,例如:app

# application-microarch-sys-registry.yml 註冊中心配置 eureka.server: enable-self-preservation: false # 自我保護模式 eviction-interval-timer-in-ms: 30000 # 清理間隔時間 默認爲1分鐘 eureka.instance: lease-expiration-duration-in-seconds: 60 # 等待下一次心跳超時 eureka.client: serviceUrl: defaultZone: http://microarch-sys-registry:5001/eureka/ #註冊地址
  register-with-eureka: false #是否註冊 fetch-registry: false #是否獲取註冊信息 ~
# application-loc.xml 註冊中心配置 eureka.instance: lease-renewal-interval-in-seconds: 10 # 續約更新時間間隔(默認30秒) lease-expiration-duration-in-seconds: 30 # 續約到期時間(默認90秒) prefer-ip-address: true # hostname: ${myApp.uri} # instance-id: ${myApp.uri}:${server.port} # status-page-url: http://${myApp.uri}:${server.port}/myinfo # ${server.port}爲該服務的端口號 eureka.client: service-url: defaultZone: http://microarch-sys-registry:5001/eureka/ register-with-eureka: true fetch-registry: true
View Code

 

4.上傳配置文件目錄只node節點,/opt/microarch/configide

5.部署註冊中心,將配置文件目錄映射到docker容器微服務

microarch-service-dm.yamlfetch

apiVersion: apps/v1 kind: Deployment metadata: name: registry-dm spec: replicas: 1 selector: matchLabels: name: registry template: metadata: labels: name: registry spec: containers: - name: registry-pod image: 192.168.30.13:5000/microarch-sys-registry-0.0.1:0215 ports: - containerPort: 5001 protocol: TCP volumeMounts: - mountPath: /config name: config volumes: - name: config hostPath: path: /opt/microarch/config

microarch-registry-svc.yaml

apiVersion: v1 kind: Service metadata: name: microarch-sys-registry spec: type: NodePort ports: - port: 5001 targetPort: 5001 nodePort: 30001 protocol: TCP selector: name: registry
相關文章
相關標籤/搜索