From c7394c09392cc46b8bc113af9fc3ceaef303ed82 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Fri, 7 Aug 2015 21:08:43 -0700 Subject: [PATCH] Fix the service printer to be a single line per service --- cluster-dns/README.md | 8 ++++---- guestbook-go/README.md | 19 +++++++++---------- guestbook/README.md | 28 ++++++++++++++-------------- mysql-wordpress-pd/README.md | 6 ++++-- phabricator/README.md | 8 +++++--- rethinkdb/README.md | 13 ++++++------- storm/README.md | 8 ++++---- 7 files changed, 46 insertions(+), 44 deletions(-) diff --git a/cluster-dns/README.md b/cluster-dns/README.md index 317ffa4d..fa779901 100644 --- a/cluster-dns/README.md +++ b/cluster-dns/README.md @@ -113,8 +113,8 @@ Once that's up you can list the service in the cluster: ```sh $ kubectl get service dns-backend -NAME LABELS SELECTOR IP(S) PORT(S) -dns-backend name=dns-backend 10.0.236.129 8000/TCP +NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE +dns-backend 10.0.2.3 8000/TCP name=dns-backend 1d ``` Again, repeat the same process for prod namespace: @@ -123,8 +123,8 @@ Again, repeat the same process for prod namespace: $ kubectl config use-context prod $ kubectl create -f examples/cluster-dns/dns-backend-service.yaml $ kubectl get service dns-backend -NAME LABELS SELECTOR IP(S) PORT(S) -dns-backend name=dns-backend 10.0.35.246 8000/TCP +NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE +dns-backend 10.0.2.4 8000/TCP name=dns-backend 1d ``` ### Step Four: Create client pod in one namespace diff --git a/guestbook-go/README.md b/guestbook-go/README.md index f27b3bb6..102efddf 100644 --- a/guestbook-go/README.md +++ b/guestbook-go/README.md @@ -117,8 +117,8 @@ Services find the containers to load balance based on pod labels. The pod that y ```console $ kubectl get services - NAME LABELS SELECTOR IP(S) PORT(S) - redis-master app=redis,role=master app=redis,role=master 10.0.136.3 6379/TCP + NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE + redis-master 10.0.136.3 6379/TCP app=redis,role=master 1h ... ``` @@ -183,9 +183,9 @@ Just like the master, we want to have a service to proxy connections to the read ```console $ kubectl get services - NAME LABELS SELECTOR IP(S) PORT(S) - redis-master app=redis,role=master app=redis,role=master 10.0.136.3 6379/TCP - redis-slave app=redis,role=slave app=redis,role=slave 10.0.21.92 6379/TCP + NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE + redis-master 10.0.136.3 6379/TCP app=redis,role=master 1h + redis-slave 10.0.21.92 6379/TCP app-redis,role=slave 1h ... ``` @@ -246,11 +246,10 @@ Just like the others, we create a service to group the guestbook pods but this t ``` $ kubectl get services - NAME LABELS SELECTOR IP(S) PORT(S) - guestbook app=guestbook app=guestbook 10.0.217.218 3000/TCP - 146.148.81.8 - redis-master app=redis,role=master app=redis,role=master 10.0.136.3 6379/TCP - redis-slave app=redis,role=slave app=redis,role=slave 10.0.21.92 6379/TCP + NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE + guestbook 10.0.217.218 146.148.81.8 3000/TCP app=guestbook 1h + redis-master 10.0.136.3 6379/TCP app=redis,role=master 1h + redis-slave 10.0.21.92 6379/TCP app-redis,role=slave 1h ... ``` diff --git a/guestbook/README.md b/guestbook/README.md index a742e588..1271fba6 100644 --- a/guestbook/README.md +++ b/guestbook/README.md @@ -235,8 +235,9 @@ Then check the list of services, which should include the redis-master: ```console $ kubectl get services -NAME LABELS SELECTOR IP PORT -redis-master name=redis-master name=redis-master 10.0.246.242 6379 +NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE +redis-master 10.0.136.3 6379/TCP app=redis,role=master 1h +... ``` This will cause all pods to see the redis master apparently running on :6379. A service can map an incoming port to any `targetPort` in the backend pod. Once created, the service proxy on each node is configured to set up a proxy on the specified port (in this case port 6379). @@ -358,9 +359,9 @@ $ kubectl create -f examples/guestbook/redis-slave-service.yaml services/redis-slave $ kubectl get services -NAME LABELS SELECTOR IP PORT -redis-master name=redis-master name=redis-master 10.0.246.242 6379 -redis-slave name=redis-slave name=redis-slave 10.0.72.62 6379 +NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE +redis-master 10.0.136.3 6379/TCP app=redis,role=master 1h +redis-slave 10.0.21.92 6379/TCP app-redis,role=slave 1h ``` ### Step Five: Create the frontend replicated pods @@ -525,10 +526,10 @@ Then, list all your services again: ```console $ kubectl get services -NAME LABELS SELECTOR IP PORT(S) -frontend name=frontend name=frontend 10.0.93.211 80/TCP -redis-master name=redis-master name=redis-master 10.0.246.242 6379/TCP -redis-slave name=redis-slave name=redis-slave 10.0.72.62 6379/TCP +NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE +frontend 10.0.93.211 80/TCP name=frontend 1h +redis-master 10.0.136.3 6379/TCP app=redis,role=master 1h +redis-slave 10.0.21.92 6379/TCP app-redis,role=slave 1h ``` @@ -544,11 +545,10 @@ If the `LoadBalancer` specification is used, it can take a short period for an e ```console $ kubectl get services -NAME LABELS SELECTOR IP PORT(S) -frontend name=frontend name=frontend 10.0.93.211 80/TCP - 130.211.135.84 -redis-master name=redis-master name=redis-master 10.0.246.242 6379/TCP -redis-slave name=redis-slave name=redis-slave 10.0.72.62 6379/TCP +NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE +frontend 10.0.93.211 130.211.188.51 80/TCP name=frontend 1h +redis-master 10.0.136.3 6379/TCP app=redis,role=master 1h +redis-slave 10.0.21.92 6379/TCP app-redis,role=slave 1h ``` Once you've exposed the service to an external IP, visit the IP to see your guestbook in action. E.g., `http://130.211.188.51:80` in the example above. diff --git a/mysql-wordpress-pd/README.md b/mysql-wordpress-pd/README.md index 968796cd..900dab85 100644 --- a/mysql-wordpress-pd/README.md +++ b/mysql-wordpress-pd/README.md @@ -302,8 +302,10 @@ $ kubectl get services Then, find the external IP for your WordPress service by running: -``` -$ kubectl get services/wpfrontend --template="{{range .status.loadBalancer.ingress}} {{.ip}} {{end}}" +```console +$ kubectl get services/wpfrontend +NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE +wpfrontend 10.0.0.2 1.2.3.4 80/TCP ... ... ``` or by listing the forwarding rules for your project: diff --git a/phabricator/README.md b/phabricator/README.md index 01a458e6..4aa15260 100644 --- a/phabricator/README.md +++ b/phabricator/README.md @@ -247,10 +247,12 @@ $ kubectl create -f examples/phabricator/phabricator-service.json phabricator ``` -To play with the service itself, find the external IP of the load balancer: +To play with the service itself, find the `EXTERNAL_IP` of the load balancer: -```sh -$ kubectl get services phabricator -o template --template='{{(index .status.loadBalancer.ingress 0).ip}}{{"\n"}}' +```console +$ kubectl get services phabricator +NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE +phabricator 10.0.0.2 1.2.3.4 8080/TCP ... ... ``` and then visit port 80 of that IP address. diff --git a/rethinkdb/README.md b/rethinkdb/README.md index f6595315..8762e7db 100644 --- a/rethinkdb/README.md +++ b/rethinkdb/README.md @@ -56,9 +56,9 @@ check out: ```sh $kubectl get services -NAME LABELS SELECTOR IP(S) PORT(S) +NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE +rethinkdb-driver 10.0.27.114 28015/TCP db=rethinkdb 10m [...] -rethinkdb-driver db=influxdb db=rethinkdb 10.0.27.114 28015/TCP ``` **Step 2** @@ -115,13 +115,12 @@ kubectl create -f examples/rethinkdb/admin-service.yaml find the service -```sh +```console $kubectl get services -NAME LABELS SELECTOR IP(S) PORT(S) +NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE [...] -rethinkdb-admin db=influxdb db=rethinkdb,role=admin 10.0.131.19 8080/TCP - 104.197.19.120 -rethinkdb-driver db=influxdb db=rethinkdb 10.0.27.114 28015/TCP +rethinkdb-admin 10.0.131.19 104.197.19.120 8080/TCP db=rethinkdb,role=admin 10m +rethinkdb-driver 10.0.27.114 28015/TCP db=rethinkdb 20m ``` We request an external load balancer in the [admin-service.yaml](admin-service.yaml) file: diff --git a/storm/README.md b/storm/README.md index a0134204..eaeafc71 100644 --- a/storm/README.md +++ b/storm/README.md @@ -91,11 +91,11 @@ zookeeper 1/1 Running 0 43s ### Check to see if ZooKeeper is accessible -```sh +```console $ kubectl get services -NAME LABELS SELECTOR IP(S) PORT(S) -kubernetes component=apiserver,provider=kubernetes 10.254.0.2 443 -zookeeper name=zookeeper name=zookeeper 10.254.139.141 2181 +NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE +zookeeper 10.254.139.141 2181/TCP name=zookeeper 10m +kubernetes 10.0.0.2 443/TCP 1d $ echo ruok | nc 10.254.139.141 2181; echo imok