---
title: Exposing an External IP Address to Access an Application in a Cluster
content_type: tutorial
weight: 10
---
<!-- overview -->
This page shows how to create a Kubernetes Service object that exposes an
external IP address.
## {{% heading "prerequisites" %}}
* Install [kubectl](/docs/tasks/tools/).
* Use a cloud provider like Google Kubernetes Engine or Amazon Web Services to
create a Kubernetes cluster. This tutorial creates an
[external load balancer](/docs/tasks/access-application-cluster/create-external-load-balancer/),
which requires a cloud provider.
* Configure `kubectl` to communicate with your Kubernetes API server. For instructions, see the
documentation for your cloud provider.
## {{% heading "objectives" %}}
* Run five instances of a Hello World application.
* Create a Service object that exposes an external IP address.
* Use the Service object to access the running application.
<!-- lessoncontent -->
## Creating a service for an application running in five pods
1. Run a Hello World application in your cluster:
{{% code_sample file="service/load-balancer-example.yaml" %}}
```shell
kubectl apply -f https://k8s.io/examples/service/load-balancer-example.yaml
```
The preceding command creates a
{{< glossary_tooltip text="Deployment" term_id="deployment" >}}
and an associated
{{< glossary_tooltip term_id="replica-set" text="ReplicaSet" >}}.
The ReplicaSet has five
{{< glossary_tooltip text="Pods" term_id="pod" >}}
each of which runs the Hello World application.
1. Display information about the Deployment:
```shell
kubectl get deployments hello-world
kubectl describe deployments hello-world
```
1. Display information about your ReplicaSet objects:
```shell
kubectl get replicasets
kubectl describe replicasets
```
1. Create a Service object that exposes the deployment:
```shell
kubectl expose deployment hello-world --type=LoadBalancer --name=my-service
```
1. Display information about the Service:
```shell
kubectl get services my-service
```
The output is similar to:
```console
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
my-service LoadBalancer 10.3.245.137 104.198.205.71 8080/TCP 54s
```
{{< note >}}
The `type=LoadBalancer` service is backed by external cloud providers, which is not covered in this example, please refer to [this page](/docs/concepts/services-networking/service/#loadbalancer) for the details.
{{< /note >}}
{{< note >}}
If the external IP address is shown as \<pending\>, wait for a minute and enter the same command again.
{{< /note >}}
1. Display detailed information about the Service:
```shell
kubectl describe services my-service