0
0
Kubernetesdevops~20 mins

TCP probe configuration in Kubernetes - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
TCP Probe Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
TCP Probe Success Check
Given this Kubernetes pod spec snippet with a TCP liveness probe, what will be the status of the pod if the TCP port is open and responding?
Kubernetes
livenessProbe:
  tcpSocket:
    port: 8080
  initialDelaySeconds: 5
  periodSeconds: 10
AThe pod will be marked as healthy and continue running.
BThe pod will restart immediately due to probe failure.
CThe pod will be marked as unhealthy but not restarted.
DThe pod will enter CrashLoopBackOff state.
Attempts:
2 left
💡 Hint
Think about what a successful TCP probe means for pod health.
Configuration
intermediate
2:00remaining
Correct TCP Probe YAML Syntax
Which of the following YAML snippets correctly configures a TCP readiness probe on port 3306 with an initial delay of 15 seconds?
A
readinessProbe:
  tcpSocket:
    port: 3306
  initialDelaySeconds: 15
B
readinessProbe:
  tcpSocket:
    port: "3306"
  initialDelaySeconds: 15
C
readinessProbe:
  tcpSocket:
    portNumber: 3306
  initialDelaySeconds: 15
D
readinessProbe:
  tcpSocket:
    port: 3306
  initialDelay: 15
Attempts:
2 left
💡 Hint
Check the exact field names and data types for TCP probes in Kubernetes.
Troubleshoot
advanced
2:00remaining
TCP Probe Fails Despite Open Port
A pod's TCP liveness probe on port 9090 keeps failing, but manual checks confirm the port is open and accepting connections. What is the most likely cause?
AThe TCP probe port number is incorrectly specified as a string instead of an integer.
BThe pod's container is not listening on 0.0.0.0 but only on localhost.
CThe initialDelaySeconds is set too high, causing premature failures.
DThe pod's CPU limits are too low, causing probe timeouts.
Attempts:
2 left
💡 Hint
Think about network interfaces and how probes connect to pods.
🔀 Workflow
advanced
2:00remaining
Implementing a TCP Readiness Probe
You want to add a TCP readiness probe to a deployment to check port 8081 every 10 seconds with a 5-second initial delay. Which kubectl command applies this configuration correctly from a YAML file named 'probe.yaml'?
Akubectl set probe deployment/myapp --tcp=8081 --readiness --initial-delay=5 --period=10
Bkubectl create tcp-probe -f probe.yaml
Ckubectl apply -f probe.yaml
Dkubectl edit deployment myapp --tcp-readiness-port=8081
Attempts:
2 left
💡 Hint
Remember how kubectl applies YAML configurations.
Best Practice
expert
2:00remaining
Best Practice for TCP Probe Configuration
Which practice is best when configuring TCP probes for a stateful application that takes time to start and open its port?
ASet initialDelaySeconds to 0 and timeoutSeconds to 1 for fast failure detection.
BUse HTTP probes instead of TCP probes for all stateful applications regardless of port availability.
CDisable probes entirely to prevent pod restarts during startup delays.
DSet a high initialDelaySeconds and a reasonable timeoutSeconds to avoid false failures during startup.
Attempts:
2 left
💡 Hint
Consider startup time and avoiding unnecessary restarts.