By frank.bailey.jr ·August 10, 2026· 1 min read
Kubernetes - Exposing an Application Using NodePort Service in Kubernetes
Task 13 of the Kubernetes - Level 1 curriculum from KodeKloud. Today's task was to expose an
.
Here are today's requirements: The Nautilus DevOps team has already deployed a ReplicaSet to host an application that requires a highly available infrastructure. Your task is to expose the application running in the existing ReplicaSet by creating a Kubernetes NodePort Service.
Follow the specifications below to create the Service and ensure the application pods are accessible: • The pods managed by the ReplicaSet use labels app as nginx_app, and type as front-end
• Create a NodePort Service named nginx-service to expose the application. • Set the NodePort to 30080. • Expose port 80 of the application. • Do not delete or modify the configuration of the deployed ReplicaSet application
Here's how it was accomplished:
- Create a YAML file with the configuration from the screenshot attached. I named my node.yaml. Pay attention to the comments to understand what is happening
- Run 𝚔𝚞𝚋𝚎𝚌𝚝𝚕 𝚊𝚙𝚙𝚕𝚢 -𝚏 𝚗𝚘𝚍𝚎.𝚢𝚊𝚖𝚕 to apply the new service
- Run 𝚔𝚞𝚋𝚎𝚌𝚝𝚕 𝚐𝚎𝚝 𝚗𝚘𝚍𝚎𝚜 -𝚘 𝚠𝚒𝚍𝚎 to get the nodes IP address to test the NodePort
- Run a curl command to test the nginx service: 𝚌𝚞𝚛𝚕 𝚑𝚝𝚝𝚙://𝚗𝚘𝚍𝚎-𝙸𝙿:𝟹𝟶𝟶𝟾𝟶 . You should get a response
I hope you found that informative. More to come!