Commit 239df459 authored by Satnam Singh's avatar Satnam Singh Committed by Satnam Singh

Using kubectl to obtain public IP for guestbook service

parent 703b6428
...@@ -159,21 +159,16 @@ redis-master <none> name=redis,rol ...@@ -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 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 ```shell
$ gcloud compute forwarding-rules describe --region=us-central1 guestbook $ cluster/kubectl.sh get services guestbook -o template --template='{{index . "publicIPs"}}'
IPAddress: 11.22.33.44 current-context: "kubernetes-satnam_kubernetes"
IPProtocol: TCP Running: cluster/../cluster/gce/../../_output/dockerized/bin/linux/amd64/kubectl get services guestbook -o template --template={{index . "publicIPs"}}
creationTimestamp: '2014-11-24T16:08:15.327-08:00' [104.154.87.59]$
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
``` ```
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`: 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`:
...@@ -189,6 +184,18 @@ For details about limiting traffic to specific sources, see the [GCE firewall do ...@@ -189,6 +184,18 @@ For details about limiting traffic to specific sources, see the [GCE firewall do
### Step Seven: Cleanup ### 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: To turn down a Kubernetes cluster:
```shell ```shell
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment