zoukankan      html  css  js  c++  java
  • k8s 1.10 部署springcloud

    1.机器

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

    2. 微服务列表

    192.168.30.13:5000/microarch-sys-registry-0.0.1  注册中心

    192.168.30.13:5000/microarch-sys-gateway-0.0.1网关

    192.168.30.13:5000/microarch-sys-service-0.0.1 系统服务

    192.168.30.13:5000/webclient vue前端项目

    3.修改注册中心微服务配置文件(application-microarch-sys-registry.yml,application-loc.yml),将注册中心地址改为k8s 服务名称,保持k8s服务名称和微服务名称一样,例如:

    # 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/config

    5.部署注册中心,将配置文件目录映射到docker容器

    microarch-service-dm.yaml

    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
  • 相关阅读:
    199. Binary Tree Right Side View
    [leetcode]leetcode初体验
    [项目]WebService涉及到的部分核心代码
    设计模式之简单工厂模式Simple Factory(四创建型)
    博客园利用Word发布博客功能[其他博客也可以如此使用]
    设计模式之单例模式Singleton(三创建型)
    设计模式之代理模式(二结构型)
    设计模式之策略模式(一对象行为型)
    Enterprise Achitect使用与类的关系的简单介绍
    2016年1月15日面试某互联网公司总结(二)
  • 原文地址:https://www.cnblogs.com/rigid/p/10413704.html
Copyright © 2011-2022 走看看