livenessProbe-readinessProbe-tcpSocket 案例
cat 27-pods-livenessProbe-readinessProbe-tcpSocket.yaml
kind: Pod
apiVersion: v1
metadata:
name: probe-liveness-readiness-tcpsocket-001
labels:
apps: zk
spec:
containers:
- name: zk
image: harbor.baimei.com/huaxiang/zookeeper:3.8.1
ports:
- containerPort: 2181
name: "server"
- containerPort: 8080
name: "web"
livenessProbe:
tcpSocket:
port: 2181
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 1
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
tcpSocket:
port: 8080
# port: 80
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 1
successThreshold: 1
timeoutSeconds: 1
---
apiVersion: v1
kind: Service
metadata:
name: probe-readiness-liveness-tcpsocket
spec:
type: ClusterIP
selector:
apps: zk
ports:
- port: 2181
name: server
- port: 8080
name: web
kubectl apply -f 27-pods-livenessProbe-readinessProbe-tcpSocket.yaml
kubectl describe -f 27-pods-livenessProbe-readinessProbe-tcpSocket.yaml