当电脑在运行应用程序时,突然遇到当机,势必就需要重新启动,相对来说,当Pod里的Container在执行应用程序的时候,可能遇到记忆体不足,造成crash,服务就需要重启,所以在Pod的描述档里,就需要增加检查机制的功能,来确定Pod有持续的运作。
Pod有Health Check检查程序如我们所期望的方式运作,而这项功能有两种检验方式:livenessProbe和readinessProbe
livenessProbe: 依据判断的方式,来决定Container是否要重启。
readinessProbe: 依据判断的方式,来决定Service功能是否要将流量access到Pod
livenessProbe:
exec:
command:
- cat
- /var/www/html/index.php
livenessProbe:
httpGet:
path: /index.php
port: 80
livenessProbe:
tcpSocket:
port: 80
readinessProbe也是一样的撰写方式,只需要把livenessProbe做替换即可,以下会采用httpGet的方式,对livenessProbe进行demo
livenessProbe YAML定义
apiVersion: v1
kind: Pod
metadata:
name: myappformoreliveness
labels:
name: myappformoreliveness
spec:
containers:
- name: myappformoreliveness
image: httpd
resources:
limits:
memory: "512Mi"
cpu: "512m"
requests:
memory: "128Mi"
cpu: "256m"
ports:
- containerPort: 80
livenessProbe:
httpGet:
path: /index.php
port: 80
initialDelaySeconds: 5
periodSeconds: 5
nodeSelector:
name: morepods
initialDelaySeconds: 初始化时间。执行第一次检测时,所需要的等待时间
periodSeconds: 周期性检测
在httpd这个Container中Web Server没有index.php这个档案,所以会一直重启
readinessProbe的部分会放到明日与Service一起讲,因为两者需要一起实作,才可以更能理解
<<: 深呼吸、喘口气,所以你这麽努力是要往哪里去?(拼命努力,不好吗? )
>>: D27 - 用 Swift 和公开资讯,打造投资理财的 Apps { 三大法人成交比重实作.2 }
Mixed and Stacked scale Chart 有时候我们需要堆叠多种图表来表达资料的...
每当我们在使用git的时候,我们查看每一条之前自己加入的纪录: git log --oneline ...
Sass媒体查询其实与Css媒体查询是差不多的~ 只是在Sass中也可以使用SassScript e...
为何需要环境变数 ? 若你的专案有使用到 DataBase 服务,在程序码里会撰写 Connect ...
摘要 ResNet152V2 1.1 来源 1.2 架构 1.3 特性 训练过程 2.1 预训练模型...