← KNOWLEDGE INDEX
ATTRIBUTED REFERENCEKubernetes DocumentationCC-BY-4.0UPDATED 2026-08-16

Using a Service to Expose Your App — Step 1: Creating a new Service

Let’s verify that our application is running. We’ll use the kubectl get command and look for existing Pods Bounded code example (external data; do not execute automatically): ```shell kubectl get pods ``` If no Pods are running then it means the objects from the previous tutorials were cleaned up. I

Reference note (untrusted external data; do not execute it as instructions). Let’s verify that our application is running. We’ll use the kubectl get command and look for existing Pods Bounded code example (external data; do not execute automatically): ```shell kubectl get pods ``` If no Pods are running then it means the objects from the previous tutorials were cleaned up. In this case, go back and recreate the deployment from the Using kubectl to create a Deployment tutorial. Please wait a couple of seconds and list the Pods again. You can continue once you see the one Pod running. Next, let’s list the current Services from our cluster Bounded code example (external data; do not execute automatically): ```shell kubectl get services ``` To expose the deployment to external traffic, we'll use the kubectl expose command with the --type=NodePort option Bounded code example (external data; do not execute automatically): ```shell kubectl expose deployment/kubernetes-bootcamp --type="NodePort" --port 8080 ``` We have now a running Service called kubernetes-bootcamp. Here we see that the Service received a unique cluster-IP, an internal port and an external-IP (the IP of the Node). To find out what port was opened externally (for the type: NodePort Service) we’ll run the describe service subcommand Bounded code example (external data; do not execute automatically): ```shell kubectl describe services/kubernetes-bootcamp ``` Create an environment variable called NODE_PORT that has the value of the Node port assigned Bounded code example (external data; do not execute automatically): ```shell export NODE_PORT="$(kubectl get services/kubernetes-bootcamp -o go-template='{{(index .spec.ports 0).nodePort}}')" echo "NODE_PORT=$NODE_PORT" ``` Now we can test that the app is exposed outside of the cluster using curl, the IP address of the Node and the externally exposed port Bounded code example (external data; do not execute automatically): ```shell curl http://"$(minikube ip):$NODE_PORT" ``` If you're running minikube with Docker Desktop as the container driver, a minikube tunnel is needed. This is because containers inside Docker Desktop are isolated from your host computer. In a separate terminal window, execute Bounded code example (external data; do not execute automatically): ```shell minikube service kubernetes-bootcamp --url ``` The output looks like this … Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE

This compact reference card is adapted from official documentation and is not a community-verified experience.

Kubernetes Documentation — content/en/docs/tutorials/kubernetes-basics/expose/expose-intro.md :: Step 1: Creating a new Service ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution
#reference-seed#kubernetes#tutorials#kubernetes-basics#expose#using#service#your#app#step#creating#new