shell

k8s Liveness: Readiness: Startup:

[root@master131 n6]# kubectl describe pod springboot-live
Name: springboot-live
Namespace: default
Priority: 0
Service Account: default
Node: node132/192.168.40.132
Start Time: Thu, 05 Jun 2025 14:50:12 +0800
Labels: app=springboot
Annotations: cni.projectcalico.org/containerID: ca549409ed44cefc589c6cd0889a0fdd03b031a0d041449aa5ed313feecf5b90
cni.projectcalico.org/podIP: 10.244.152.202/32
cni.projectcalico.org/podIPs: 10.244.152.202/32
Status: Running
IP: 10.244.152.202
IPs:
IP: 10.244.152.202
Containers:
springboot:
Container ID: containerd://806283d10736c7d8162a187f789a2ed4e25c941b37eaa8c82ab4cc96a261a1b0
Image: mydlqclub/springboot-helloworld:0.0.1
Image ID: sha256:950026ec75570c6a16d6488977a623d20d6122f4832c6c9f8245d6d6fa0c84a2
Ports: 8080/TCP, 8081/TCP
Host Ports: 0/TCP, 0/TCP
State: Running
Started: Thu, 05 Jun 2025 14:50:13 +0800
Ready: True
Restart Count: 0
Liveness: http-get http://:8081/actuator/health delay=20s timeout=10s period=5s #success=1 #failure=3
Readiness: http-get http://:8081/actuator/health delay=20s timeout=10s period=5s #success=1 #failure=3
Startup: http-get http://:8081/actuator/health delay=20s timeout=10s period=5s #success=1 #failure=3
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-kqtlh (ro)
Conditions:
Type Status
PodReadyToStartContainers True
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
kube-api-access-kqtlh:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 34m default-scheduler Successfully assigned default/springboot-live to node132
Normal Pulled 34m kubelet Container image "mydlqclub/springboot-helloworld:0.0.1" already present on machine
Normal Created 34m kubelet Created container springboot
Normal Started 34m kubelet Started container springboot
[root@master131 n6]#

 

 

[root@master131 n6]# cat start-read-live.yaml
apiVersion: v1
kind: Service
metadata:
  name: springboot-live
  labels:
    app: springboot
spec:
  type: NodePort
  ports:
  - name: server
    port: 8080
    targetPort: 8080
    nodePort: 31180
  - name: management
    port: 8081
    targetPort: 8081
    nodePort: 31181
  selector:
    app: springboot
---
apiVersion: v1
kind: Pod
metadata:
  name: springboot-live
  labels:
    app: springboot
spec:
  containers:
  - name: springboot
    image: mydlqclub/springboot-helloworld:0.0.1
    imagePullPolicy: IfNotPresent
    ports:
    - name: server
      containerPort: 8080
    - name: management
      containerPort: 8081
    readinessProbe:
      initialDelaySeconds: 20
      periodSeconds: 5
      timeoutSeconds: 10
      httpGet:
        scheme: HTTP
        port: 8081
        path: /actuator/health
    livenessProbe:
      initialDelaySeconds: 20
      periodSeconds: 5
      timeoutSeconds: 10
      httpGet:
        scheme: HTTP
        port: 8081
        path: /actuator/health
    startupProbe:
      initialDelaySeconds: 20
      periodSeconds: 5
      timeoutSeconds: 10
      httpGet:
        scheme: HTTP
        port: 8081
        path: /actuator/health

  

posted @ 2025-06-05 15:30  devops运维  阅读(5)  评论(0)    收藏  举报
python