Skip to content

Comments

Troubleshooting WebApp#1

Open
L2klbs wants to merge 1 commit intomainfrom
troubleshooting
Open

Troubleshooting WebApp#1
L2klbs wants to merge 1 commit intomainfrom
troubleshooting

Conversation

@L2klbs
Copy link
Owner

@L2klbs L2klbs commented Mar 25, 2025

Task

This training exercise comes with several intentional bugs. The goal of this mock scenario is to troubleshoot these issues and get the application up and running.

Discovered Issues

Missing credentials for Google Container Registry

Description
The webapp StatefulSet fetches a container image from a private Google registry. To access this image we would require proper authentication to the registry.

Discovery Process
Pods have Kubernetes events that provide meaningful information. These events can be checked by describing the pod.

kubectl describe pod my-app-pod-abc123 -n my-namespace

From the context of the event message, I was able to determine that we needed credentials to access the container image.

Solution
Given the situation, I saw two quick and easy approaches to resolving this issue.

  • Reach out to the project owner to get the credentials to the private registry.
  • Build the Docker image and reference the build within my kubernetes manifest.

I went with the later approach, given it's a good demonstration of basic docker skills.

Missing Secret Resource

Description
The StatefulSets postgres and webapp have a reference to a secretKeyRef within there container env. This reference is invalid because there is no Secret resource defined.

Discovery Process
This was discovered by looking at the pod events.

Solution
Add the secret resource. This will also establish the password that will be used for the postgres service.

Missing storageClass resource

Description
The gold storage class was referenced but not defined.

Discovery Process
This was discovered by looking at the pod events.

Solution
Add the storageClass resource.

Unreachable Port

Description
The WebApp targeted port 5432 for the postgres service but the exposed postgres port was set to 5432.

Discovery Process
Pods have logs on the application level. Similar to the describe command, we can fetch logs for a pod.

kubectl logs my-app-pod-abc123

While reviewing the logs, I noticed the application was unable to connect to the Postgres service on the expected port. After examining the code, I found that it was attempting to reach a port that hadn’t been exposed.

Solution
To resolve this issue we could either update the port number within the application or the exposed port within the kubernetes manifest. I chose to go with the later.

- Missing credentials for Google Container Registry
- Missing Secret Resource
- Missing storageClass resource
- WebApp targeted port 5432 for the postgres service but the exposed port was 5432
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant