0
0
Microservicessystem_design~10 mins

Health checks in containers in Microservices - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a liveness probe in a Kubernetes pod spec.

Microservices
livenessProbe:
  httpGet:
    path: [1]
    port: 8080
Drag options to blanks, or click blank then click option'
A/ready
B/healthz
C/status
D/metrics
Attempts:
3 left
💡 Hint
Common Mistakes
Using readiness probe endpoints for liveness checks
Using metrics endpoints which are not suitable for liveness
2fill in blank
medium

Complete the code to define a readiness probe command in a Kubernetes pod.

Microservices
readinessProbe:
  exec:
    command: ["[1]", "-c", "curl -f http://localhost:8080/ready || exit 1"]
Drag options to blanks, or click blank then click option'
Ash
Bcurl
Cbash
Dwget
Attempts:
3 left
💡 Hint
Common Mistakes
Using curl directly as the command without a shell
Using wget which may not be installed
3fill in blank
hard

Fix the error in the Kubernetes readiness probe configuration.

Microservices
readinessProbe:
  tcpSocket:
    port: [1]
Drag options to blanks, or click blank then click option'
Aready
B80
C8080
Dhttp
Attempts:
3 left
💡 Hint
Common Mistakes
Using protocol names instead of port numbers
Using endpoint paths in tcpSocket probes
4fill in blank
hard

Fill both blanks to create a Kubernetes liveness probe that checks an HTTP endpoint after a 10 second initial delay.

Microservices
livenessProbe:
  httpGet:
    path: [1]
    port: 8080
  initialDelaySeconds: [2]
Drag options to blanks, or click blank then click option'
A/healthz
B5
C10
D/ready
Attempts:
3 left
💡 Hint
Common Mistakes
Using readiness paths for liveness probes
Setting initial delay too low causing false failures
5fill in blank
hard

Fill in the blank to define a readiness probe with an exec command that retries curl 3 times.

Microservices
readinessProbe:
  exec:
    command: ["[1]", "-c", "for i in {1..3}; do curl -f http://localhost:8080/ready && exit 0 || sleep 1; done; exit 1"]
Drag options to blanks, or click blank then click option'
Adash
Bsh
Czsh
Dbash
Attempts:
3 left
💡 Hint
Common Mistakes
Using shells that do not support brace expansion
Using shells not installed in the container