k8s发布模板

2023-11-04

deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: {{ (datasource "config").name }}
  name: {{ (datasource "config").name }}
  namespace: {{ (datasource "config").namespace }}
spec:
  progressDeadlineSeconds: 600
  revisionHistoryLimit: 10
  replicas: {{ (datasource "config").replicas }}
  selector:
    matchLabels:
      app: {{ (datasource "config").name }}
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: {{ (datasource "config").name }}
    spec:
      topologySpreadConstraints:
      - maxSkew: 1
        topologyKey: kubernetes.io/hostname
        whenUnsatisfiable: ScheduleAnyway
        labelSelector:
          matchLabels:
            app: {{ (datasource "config").name }}
      containers:
      - env:
        - name: TZ
          value: Asia/Shanghai
        - name: APOLLO_META
          value: {{ (datasource "config").apollo }}
        - name: configServerUrl
          value: {{ (datasource "config").apollo }}
        - name: RUN_ENV
          value: {{ (datasource "config").run_env }}
        - name: SPRING_PROFILES_ACTIVE
          value: {{ (datasource "config").run_env }}
        resources:
          limits:
            #ephemeral-storage: {{ (datasource "config").limits_disk }}
            cpu: {{ (datasource "config").limits_cpu }}
            memory: {{ (datasource "config").limits_mem }}
          requests:
            cpu: {{ (datasource "config").requests_cpu }}
            memory: {{ (datasource "config").requests_mem }}
        image: {{ (datasource "config").image }}:{{ (datasource "config").tag }}
        imagePullPolicy: Always
        restartPolicy: Never (Always)
        imagePullSecrets:
          - name: myregistrykey
        name: app
        volumeMounts:
        - mountPath: {{ (datasource "config").log_dir }}
          name: log-volume
    #  - env:
    #    - name: POD_IP
    #      valueFrom:
    #        fieldRef:
    #          apiVersion: v1
    #          fieldPath: status.podIP
    #    - name: POD_NAME
    #      valueFrom:
    #        fieldRef:
    #          apiVersion: v1
    #          fieldPath: metadata.name
    #    - name: KAFKA_HOSTS
    #      value: '{{ (datasource "config").kafka_hosts }}'
    #    - name: KAFKA_TOPIC
    #      value: {{ (datasource "config").kafka_topic }}
    #    - name: KAFKA_SERVICE
    #      value: {{ (datasource "config").namespace }}-{{ (datasource "config").name }}
    #    image: harbor.saxofintech.com/online/filebeat:7.12.0 
    #    imagePullPolicy: IfNotPresent
    #    name: filebeat
    #    resources:
    #      requests:
    #        cpu: 50m
    #    volumeMounts:
    #    - mountPath: /app/log/
    #      name: log-volume
      dnsPolicy: ClusterFirst
    #  imagePullSecrets:
    #  - name: harbor-secret
      volumes:
      - name: log-volume
        emptyDir:
          sizeLimit: {{ (datasource "config").limits_disk }}

service

apiVersion: v1
kind: Service
metadata:
  labels:
    app: {{ (datasource "config").name }}-svc
  name: {{ (datasource "config").name }}-svc
  namespace: {{ (datasource "config").namespace }}
spec:
  type: ClusterIP
  ports:
  - name: {{ (datasource "config").name }}-{{ $index }}
    port: {{ $element }}
    targetPort: {{ $element }}
    protocol: TCP{{ end }}
  sessionAffinity: ClientIP
  sessionAffinityConfig:
    clientIP:
      timeoutSeconds: 10800
  selector:
    app: {{ (datasource "config").name }}

ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 50m
  name: {{ (datasource "config").name }}-ingress
  namespace: {{ (datasource "config").namespace }}
spec:
  rules:
  - host: {{ (datasource "config").name }}.{{ (datasource "config").namespace }}.saxok8s.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: {{ (datasource "config").name }}-svc
            port:
              number: {{ $element }}{{ end }}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

k8s发布模板 的相关文章

随机推荐

  • 《Linux C++项目必备》glog日志管理

    一 简介 Google Glog 是一个C 语言的应用级日志记录框架 提供了 C 风格的流操作和各种助手宏 二 下载 git clone https github com google glog git cd glog autogen sh
  • Matplotlib-绘制3D曲面-plot_surfaceh与plot_trisurf函数-数据结构

    Matplotlib 绘制3D曲面 plot surfaceh与plot trisurf函数 数据结构 3D平面绘制示例 plot surfaceh 网格采样点的生成函数np meshgrid 3D平面绘制示例 plot trisurf 3
  • Windows下nvm的安装与Idea内如何配置使用

    nvm node npm 区别 nvm nodejs 版本管理工具 类似于python的Miniconda 一个 nvm 可以管理很多 node 版本和 npm 版本 nodejs 是一个开源 跨平台的 JavaScript 运行时环境 n
  • 英伟达点开后显示无法连接服务器,解决win10提示“无法连接到 NVIDIA 检查您的互联网连接”的教程...

    nvidia控制面板是windows系统中自带的一个程序 我们一般会使用它来更新系统中的显卡驱动 有部分win10用户在使用这个软件的时候被系统提示 无法连接到 NVIDIA 检查您的互联网连接 但是该用户的网络是可以正常的使用的 别的软件
  • java中占位符的使用

    java中占位符的使用 SimpleDateFormat simple new SimpleDateFormat yyyy年MM月dd日 HH点mm分ss秒 String newDate simple format new Date Str
  • 国内常用镜像源

    国内常用镜像源 阿里云官方镜像站 https developer aliyun com mirror 清华大学开源软件镜像站 https mirrors tuna tsinghua edu cn 浙大镜像源 http mirrors zju
  • Segmentation with deep atlas prior

    文章目录 前言 一 Probabilistic Atlas 二 Deep Atlas Prior 三 Objective Function 四 Experiment Results 五 Analysis 前言 最近还是在看一些医学图像分割的
  • 大型网站架构核心要素之扩展性:可扩展架构

    前言 续上节大型网站架构核心要素性能之后 我们今天要讲的是第四个要素 扩展性 什么叫扩展性呢 简单的说就是在对现有系统影响最小的情况下 系统功能可持续扩展及提升的能力 讲扩展性之前 我先讲下扩展性和伸缩性的区别 因为这两个点经常有人会混淆
  • VUE-Router之解决 Navigating to current location (XXX) is not allowed

    VUE Router之解决 Navigating to current location index list2 is not allowed 错误代码 NavigationDuplicated name NavigationDuplica
  • 菠萝狗四足机器人使用手册

    菠萝狗手册 一 菠萝狗的组装和使用 1 1 各菠萝狗的操作步骤 1 2 具体教程 二 b站的视频教程 全集目录 第一章 入门导论 第二章 开源菠萝狗制造组装篇 第三章 边玩边了解四足基本理论知识 三 总体项目的介绍 四 交流群 一 菠萝狗的
  • error: No rule to make target 'image/资源.qrc', needed by 'debug/qrc_资源.cpp'. Stop

    使用Qt添加资源文件 出现上述错误 原因是把 qrc文件的位置放错了 根本原因是创建资源文件的时候路径选择错了 解决办法 1 将你所添加的资源文件删掉 直接在项目中 2 在文件中以记事本的方式打开 pro文件 删除所添加的资源信息 因为在项
  • CGAL 入门基础

    目录 一 点和线段基础操作 1 概述 2 整型坐标 3 浮点型坐标 二 点序列的凸包 1 在数组Array中提取凸包点 2 在向量Vector中提取凸包点 三 关于kernel和Traits类 四 概念与模型 本文是提供给了解c 和几何算法
  • Windows下jdk的下载和安装详细步骤及解决javac无法使用的问题

    Windows下jdk的下载和安装详细步骤及解决javac无法使用的问题 一 简介 其实我最开始安装jdk是为了学习Java 而学习Java的初衷是为了开发安卓APP 但是当我接触多了之后 我才发现 Java和安卓APP是两码事 安卓原生A
  • 项目中如何修改element-ui的默认样式

    Vue项目中 通常我们在写样式的时候为了避免全局污染 我们会给当前组件的样式加上scoped 让当前的样式只作用域当前组件 但是在写项目的时候会发现一个问题 当我们需要在局部组件中修改第三方组件库样式 而又不想去除scoped属性造成的组件
  • 人工智能各领域跨界能手——Transformer

    导读 Transformer源自于AI自然语言处理任务 在计算机视觉领域 近年来Transformer逐渐替代CNN成为一个热门的研究方向 此外 Transformer在文本 语音 视频等多模态领域也在崭露头角 本文对Transformer
  • 如何用SD-WAN实现多地组网?

    SD WAN技术可以通过虚拟化和自动化的方式 实现多地点之间的网络互联 以下是如何使用SD WAN实现多地组网的步骤 部署SD WAN设备 在每个地点部署SD WAN设备 并将设备连接到各自的局域网中 设备可以是物理设备或虚拟设备 这取决于
  • 糊里糊涂进了微盟Java内招群,抱着试试的想法投了简历,没想到面试通过了

    不久前登录QQ的时候忽然发现自己进了微盟内招群 我一脸懵逼不知道什么时候进入的 在里面划水了一段时间 抱着试一试的心态就投了简历 昨天进行了一面二面 然后就 就通过了 我也挺惊讶的 等着三面吧 把面试经验分享给大家 希望我们都能成功 一面5
  • Elasticsearch出现field expansion matches too many fields异常

    7 4 2的集群里面执行query string 语句时 异常信息 报了 reason field expansion matches too many fields limit 1024 got 15448 表示子查询数量大于1024 对
  • Java中的迭代器Iterator接口详解

    Iterator对象称为迭代器 设计模式的一种 主要用于遍历 Collection 集合中的元素 迭代器模式的定义为 提供一种方法访问一个容器 container 对象中各个元 素 而又不需暴露该对象的内部细节 迭代器模式 就是为容器而生
  • k8s发布模板

    deployment apiVersion apps v1 kind Deployment metadata labels app datasource config name name datasource config name nam