您当前的位置: 首页 >  kubernetes
  • 3浏览

    0关注

    1477博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

kubernetes视频教程笔记 (12)-容器探针

软件工程小施同学 发布时间:2020-11-18 19:25:27 ,浏览量:3

 

 

 

检测探针 - 就绪检测

readinessProbe-httpget

apiVersion: v1
kind: Pod
metadata:
 name: readiness-httpget-pod
 namespace: default
spec:
 containers:
 - name: readiness-httpget-container
   image: wangyanglinux/myapp:v1
   imagePullPolicy: IfNotPresent
   readinessProbe:
    httpGet:
     port: 80
     path: /index1.html
    initialDelaySeconds: 1
    periodSeconds: 3

 

 

   

 

检测探针 - 存活检测

livenessProbe-exec

apiVersion: v1
kind: Pod
metadata:
 name: liveness-exec-pod
 namespace: default
spec:
 containers:
 - name: liveness-exec-container
   image: hub.atguigu.com/library/busybox
   imagePullPolicy: IfNotPresent
   command: ["/bin/sh","-c","touch /tmp/live ; sleep 60; rm -rf /tmp/live; sleep
3600"]
   livenessProbe:
    exec:
     command: ["test","-e","/tmp/live"]
    initialDelaySeconds: 1
    periodSeconds: 3

 

 

livenessProbe-httpget

apiVersion: v1
kind: Pod
metadata:
 name: liveness-httpget-pod
 namespace: default
spec:
 containers:
 - name: liveness-httpget-container
   image: hub.atguigu.com/library/myapp:v1
   imagePullPolicy: IfNotPresent
   ports:
 - name: http
   containerPort: 80
 livenessProbe:
  httpGet:
   port: http
   path: /index.html
  initialDelaySeconds: 1
  periodSeconds: 3
  timeoutSeconds: 10

 

 

livenessProbe-tcp

apiVersion: v1
kind: Pod
metadata:
 name: probe-tcp
spec:
 containers:
 - name: nginx
   image: hub.atguigu.com/library/myapp:v1
   livenessProbe:
    initialDelaySeconds: 5
    timeoutSeconds: 1
    tcpSocket:
     port: 80
    periodSeconds: 3

 

可以合并检测

 

 

 

 

 

 

 

内容来自https://study.163.com/course/courseMain.htm?courseId=1209568805

关注
打赏
1665320866
查看更多评论
立即登录/注册

微信扫码登录

0.0535s