Skip to content

Instantly share code, notes, and snippets.

@venkube
Last active June 14, 2024 16:32
Show Gist options
  • Save venkube/858948d87a0f3f4d72ca376802eb2c69 to your computer and use it in GitHub Desktop.
Save venkube/858948d87a0f3f4d72ca376802eb2c69 to your computer and use it in GitHub Desktop.
File contains code snippet for liveness probe in kubernetes.
apiVersion: v1
kind: Pod
metadata:
labels:
app: liveness
name: liveness-pod
spec:
containers:
- name: liveness
image: nginx
ports:
- containerPort: 8080
livenessProbe:
exec:
command:
- cat
- /usr/share/nginx/html/index.html
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 4
successThreshold: 1
failureThreshold: 3
apiVersion: v1
kind: Pod
metadata:
name: ectd-server-grpc
spec:
containers:
- name: ectd
image: registry.k8s.io/etcd:3.5.1-0
command: [ "/usr/local/bin/etcd", "--data-dir", "/var/lib/etcd", "--listen-client-urls", "http://0.0.0.0:2379", "--advertise-client-urls", "http://127.0.0.1:2379", "--log-level", "debug"]
ports:
- containerPort: 2379
livenessProbe:
grpc:
port: 2379
initialDelaySeconds: 30
periodSeconds: 20
timeoutSeconds: 4
successThreshold: 1
failureThreshold: 3
apiVersion: v1
kind: Pod
metadata:
labels:
app: liveness
name: liveness-pod
spec:
containers:
- name: liveness
image: nginx
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 4
successThreshold: 1
failureThreshold: 3
apiVersion: v1
kind: Pod
metadata:
name: redis-server
spec:
containers:
- name: redis
image: redis:latest
ports:
- containerPort: 6379
livenessProbe:
tcpSocket:
port: 6379
initialDelaySeconds: 30
periodSeconds: 20
timeoutSeconds: 4
successThreshold: 1
failureThreshold: 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment