Skip to content

Instantly share code, notes, and snippets.

@venkube
Created June 15, 2024 08:33
Show Gist options
  • Save venkube/199210a7980929907e970ad8ba25630c to your computer and use it in GitHub Desktop.
Save venkube/199210a7980929907e970ad8ba25630c to your computer and use it in GitHub Desktop.
File contains code snippet for startup probe in kubernetes.
apiVersion: v1
kind: Pod
metadata:
labels:
app: startupprobe
name: startupprobe-pod
spec:
containers:
- name: startupprobe
image: nginx
ports:
- containerPort: 8080
startupProbe:
exec:
command:
- "ls"
- "/bin"
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
startupProbe:
grpc:
port: 2379
initialDelaySeconds: 30
periodSeconds: 20
timeoutSeconds: 4
successThreshold: 1
failureThreshold: 3
apiVersion: v1
kind: Pod
metadata:
labels:
app: startupprobe
name: startupprobe-pod
spec:
containers:
- name: startupprobe
image: nginx
ports:
- containerPort: 8080
startupProbe:
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
startupProbe:
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