Lab 3 - Debugging¶
30 min Intermediate
Problem¶
The Hyper Drive isn't working, and we need to find out why. Debug the hyper-drive deployment and its service so we can reach light speed again.
Some tips to get you started:
- Check the status and description of the
deploymentand itspods. - Get the logs of one of the broken pods and save them to a file.
- Check that the correct
portsare used everywhere. - Make sure your
labelsandselectorsmatch. - Check that the
probesare working.
The application listens on port 8080 and serves its health check on /healthz.
Setup¶
Create a project, then apply the broken application:
oc apply -f - <<'EOF'
apiVersion: apps/v1
kind: Deployment
metadata:
name: hyper-drive
spec:
replicas: 3
selector:
matchLabels:
app: hyper-drive
template:
metadata:
labels:
app: hyper-drive
spec:
containers:
- name: hyper-drive
image: registry.k8s.io/e2e-test-images/agnhost:2.56
args: ["netexec", "--http-port=8080"]
ports:
- containerPort: 8080
livenessProbe:
tcpSocket:
port: 80
---
apiVersion: v1
kind: Service
metadata:
name: hyper-drive
spec:
selector:
run: hyper-drive
ports:
- protocol: TCP
port: 80
EOF
Wait a minute or two before you start. Some of the problems only show up after the pods have been running for a while.
Verification¶
You're done when all of the following are true:
-
All 3
hyper-drivepods areRunning,1/1ready, and theirRESTARTScount has stopped increasing: -
The service has 3 endpoints on port
8080: -
The service answers from inside the cluster. Start a client pod, then call the service by name:
oc run client --image=registry.access.redhat.com/ubi9/ubi-minimal -- sleep infinity oc wait --for=condition=Ready pod/client oc exec client -- curl -s --max-time 5 hyper-drive/hostnameThis prints the name of one of the
hyper-drivepods.