Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using kubectl to obtain public IP for guestbook service #4606

Merged
merged 1 commit into from
Feb 26, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 19 additions & 12 deletions examples/guestbook-go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,21 +159,16 @@ redis-master <none> name=redis,rol
redis-slave name=redis,role=slave name=redis,role=slave 10.0.22.180 6379
```

To play with the service itself, find the external IP of the load balancer from the [Google Cloud Console][cloud-console] or the `gcloud` tool, and visit `http://<ip>:3000`.
To play with the service itself, find the external IP of the load balancer:

```shell
$ gcloud compute forwarding-rules describe --region=us-central1 guestbook
IPAddress: 11.22.33.44
IPProtocol: TCP
creationTimestamp: '2014-11-24T16:08:15.327-08:00'
id: '17594840560849468061'
kind: compute#forwardingRule
name: guestbook
portRange: 1-65535
region: https://www.googleapis.com/compute/v1/projects/jbeda-prod/regions/us-central1
selfLink: https://www.googleapis.com/compute/v1/projects/jbeda-prod/regions/us-central1/forwardingRules/guestbook
target: https://www.googleapis.com/compute/v1/projects/jbeda-prod/regions/us-central1/targetPools/guestbook
$ cluster/kubectl.sh get services guestbook -o template --template='{{index . "publicIPs"}}'
current-context: "kubernetes-satnam_kubernetes"
Running: cluster/../cluster/gce/../../_output/dockerized/bin/linux/amd64/kubectl get services guestbook -o template --template={{index . "publicIPs"}}
[104.154.87.59]$

```
and then visit port 3000 of that IP address e.g. `http://104.154.87.59:3000`.

You may need to open the firewall for port 3000 using the [console][cloud-console] or the `gcloud` tool. The following command will allow traffic from any source to instances tagged `kubernetes-minion`:

Expand All @@ -189,6 +184,18 @@ For details about limiting traffic to specific sources, see the [GCE firewall do

### Step Seven: Cleanup

You should delete the service which will remove any associated resources that were created e.g. load balancers, forwarding rules and target pools. All the resources (pods, replication controllers and service) can be deleted with a single command:
```shell
$ cluster/kubectl.sh delete -f examples/guestbook-go
current-context: "kubernetes-satnam_kubernetes"
Running: cluster/../cluster/gce/../../_output/dockerized/bin/linux/amd64/kubectl delete -f examples/guestbook-go
guestbook-controller
guestbook
redis-master-controller
redis-master
redis-slave-controller
redis-slave
```
To turn down a Kubernetes cluster:

```shell
Expand Down