Identifying Existing Services
The first step is to check how many services are running on your system. Run one of the commands below:Checking the Service Type
Next, verify the type of the default service by executing:Inspecting the Target Port
To determine the target port configured on the Kubernetes service, use the following command:Verifying Service Labels
Next, check the labels that are configured on the Kubernetes service. From the output above, you can see two labels:- component: apiserver
- provider: kubernetes
Exploring Endpoints
Endpoints represent the pods that the service directs traffic to. The output shows one endpoint:What Are Endpoints?
Endpoints list the pods selected by the service based on specified labels. For example, if a service targets three pods (all matching the label selector), then three endpoints will be listed. Conversely, if an extra pod is unintentionally matched, the endpoints list will increase, which could affect traffic routing. Endpoints are essential for troubleshooting. If the service’s selector does not match any pod labels, the endpoints list will be empty, indicating why the application may not be accessible. In a properly configured scenario, services map pod endpoints by associating the service with the IP addresses of matching pods. Here are two diagrams provided for visualization:

Reviewing Deployments
Now, let’s check the number of Deployments in the default namespace by running:Inspecting the Deployment
Inspect the deployment responsible for creating the pods:Accessing the Web Application UI
At this point, you may try to access the web application UI using the link provided in the deployment tab; however, you will encounter a “bad gateway” error. This occurs because there is no service configured to expose the deployment:Since no service is exposing the deployment, the web application is not accessible.
Creating a Service to Expose the Web Application
Below is an example YAML configuration file that defines a Kubernetes service to expose the web application:
- Name: webapp-service
- Type: NodePort
- Target port: 8080 (the port on which the application is running)
- Port: 8080 (the port to expose)
- NodePort: 30080
- Selector: name set to simple-webapp