当前位置:网站首页>ingress 待完善
ingress 待完善
2022-08-04 02:48:00 【青春不流名】
apiVersion: apps/v1 # 指定api版本,此值必须在kubectl api-versions中
kind: Deployment # 指定创建资源的角色/类型
metadata: # 资源的元数据/属性
name: demo # 资源的名字,在同一个namespace中必须唯一
namespace: default # 部署在哪个namespace中
labels: # 设定资源的标签
app: demo
version: stable
spec: # 资源规范字段
replicas: 1 # 声明副本数目
revisionHistoryLimit: 3 # 保留历史版本
selector: # 选择器
matchLabels: # 匹配标签
app: demo
version: stable
strategy: # 策略
rollingUpdate: # 滚动更新
maxSurge: 30% # 最大额外可以存在的副本数,可以为百分比,也可以为整数
maxUnavailable: 30% # 示在更新过程中能够进入不可用状态的 Pod 的最大值,可以为百分比,也可以为整数
type: RollingUpdate # 滚动更新策略
template: # 模版
metadata: # 资源的元数据/属性
annotations: # 自定义注解列表
sidecar.istio.io/inject: "false" # 自定义注解名字
labels: # 设定资源的标签
app: demo
version: stable
spec: # 资源规范字段
containers:
- name: demo # 容器的名字
image: demo:latest # 容器使用的镜像地址
imagePullPolicy: IfNotPresent # 每次Pod启动拉取镜像策略,三个选择 Always、Never、IfNotPresent
# Always,每次都检查;Never,每次都不检查(不管本地是否有);IfNotPresent,如果本地有就不检查,如果没有就拉取
resources: # 资源管理
limits: # 最大使用
cpu: 1000m # CPU,1核心 = 1000m
memory: 1024Mi # 内存,1G = 1024Mi
requests: # 容器运行时,最低资源需求,也就是说最少需要多少资源容器才能正常运行
cpu: 500m
memory: 512Mi
#探针的配置,可选的开启
#livenessProbe: # pod 内部健康检查的设置
#httpGet: # 通过httpget检查健康,返回200-399之间,则认为容器正常
#path: /healthCheck # URI地址
#port: 8090 # 端口
#scheme: HTTP # 协议
# host: 127.0.0.1 # 主机地址
#initialDelaySeconds: 30 # 表明第一次检测在容器启动后多长时间后开始
#timeoutSeconds: 5 # 检测的超时时间
#periodSeconds: 30 # 检查间隔时间
#successThreshold: 1 # 成功门槛
#failureThreshold: 5 # 失败门槛,连接失败5次,pod杀掉,重启一个新的pod
#探针的配置,可选的开启
#readinessProbe: # Pod 准备服务健康检查设置
#httpGet:
#path: /healthCheck
#port: 8090
#scheme: HTTP
#initialDelaySeconds: 30
#timeoutSeconds: 5
#periodSeconds: 10
#successThreshold: 1
#failureThreshold: 5
#也可以用这种方法
#exec: 执行命令的方法进行监测,如果其退出码不为0,则认为容器正常
# command:
# - cat
# - /tmp/health
#也可以用这种方法
#tcpSocket: # 通过tcpSocket检查健康
# port: number
ports:
- name: demo # 名称
containerPort: 8090 # 容器开发对外的端口
protocol: TCP # 协议
imagePullSecrets: # 镜像仓库拉取密钥
- name: harbor-certification
affinity: # 亲和性调试
nodeAffinity: # 节点亲和力
requiredDuringSchedulingIgnoredDuringExecution: # pod 必须部署到满足条件的节点上
nodeSelectorTerms: # 节点满足任何一个条件就可以
- matchExpressions: # 有多个选项,则只有同时满足这些逻辑选项的节点才能运行 pod
- key: kubernetes.io/arch
operator: In
values:
- amd64
---
apiVersion: v1 # 指定api版本,此值必须在kubectl api-versions中
kind: Service # 指定创建资源的角色/类型
metadata: # 资源的元数据/属性
name: demo-service # 资源的名字,在同一个namespace中必须唯一
namespace: default # 部署在哪个namespace中
labels: # 设定资源的标签
app: demo-service
spec: # 资源规范字段
type: ClusterIP # ClusterIP 类型
ports:
- port: 8090 # service 端口
targetPort: 8090 # 容器暴露的端口
protocol: TCP # 协议
name: http # 端口名称
selector: # 选择器
app: demo
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/affinity: "cookie"
nginx.ingress.kubernetes.io/affinity-mode: "persistent"
nginx.ingress.kubernetes.io/session-cookie-name: "route"
nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
name: demo-ingress
namespace: dev
spec:
defaultBackend:
service:
name: demo-ingress
port:
number: 80
ingressClassName: nginx
rules:
- host: demo.lovely.ingress
http:
paths:
- pathType: Prefix
path: "/gin(/|$)(.*)"
backend:
service:
name: demo-service
port:
number: 8090
path: "/test(/|$)(.*)"
backend:
service:
name: demo1-service
port:
number: 8091
- host: "demo2.k8s.com"
http:
paths:
- pathType: Prefix
path: "/nginx(/|$)(.*)"
backend:
service:
name: svc-nginx
port:
number: 8000
边栏推荐
- 22/8/3(板子)树状dp板子+中国剩余定理+求组合数3,4+容斥原理
- 织梦内核电动伸缩门卷闸门门业公司网站模板 带手机版【站长亲测】
- 查看mysql死锁语法
- 2022.8.3-----leetcode.899
- 异步编程解决方案 Generator生成器函数、iterator迭代器、async/await、Promise
- Small Turtle Compilation Notes
- 2022焊工(初级)上岗证题目模拟考试平台操作
- MCU C language -> usage, and meaning
- 为什么用Selenium做自动化测试
- [Original] Start the XPS/OXPS reader that comes with Windows 10
猜你喜欢

Presto中broadcast join和partition join执行计划的处理过程

织梦内核电动伸缩门卷闸门门业公司网站模板 带手机版【站长亲测】

STM8S project creation (STVD creation) --- use COSMIC to create a C language project

为什么用Selenium做自动化测试

activiti流程执行过程中,数据库表的使用关系

Flink原理流程图简单记录

Kubernetes:(十一)KubeSphere的介绍和安装(华丽的篇章)

C语言--环形缓存区

In a more general sense, calculating the displacement distance and assumptions

v-model
随机推荐
Example 037: Sorting
MCU C language -> usage, and meaning
How to read the resources files in the directory path?
Example 040: Reverse List
In a more general sense, calculating the displacement distance and assumptions
倒计时2天,“文化数字化战略新型基础设施暨文化艺术链生态建设发布会”启幕在即
Engineering drawing review questions (with answers)
KingbaseES数据库启动失败,报“内存段超过可用内存”
Flink原理流程图简单记录
db2中kettle报错 Field [XXX] is required and couldn‘t be found 解决方法
云开发旅游打卡广场微信小程序源码(含视频教程)
2022.8.3-----leetcode.899
Ant - the design of the Select component using a custom icon (suffixIcon attribute) suffixes, click on the custom ICONS have no reaction, will not display the drop-down menu
22/8/3(板子)树状dp板子+中国剩余定理+求组合数3,4+容斥原理
Simple record of Flink principle flow chart
DHCP服务详解
Asynchronous programming solution Generator generator function, iterator iterator, async/await, Promise
小程序:扫码打开参数解析
Big guys, it takes a long time to read mysql3 million single tables, what parameters can be discounted, or is there any way to hurry up
P3384 【模板】轻重链剖分/树链剖分