Merge pull request #12423 from brendandburns/service
Make services print on a single line.
This commit is contained in:
commit
e52d8bf49d
|
@ -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 <none> name=dns-backend 10.0.236.129 8000/TCP
|
||||
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
|
||||
dns-backend 10.0.2.3 <none> 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 <none> name=dns-backend 10.0.35.246 8000/TCP
|
||||
NAME CLUSTER_IP EXTERNAL_IP PORT(S) SELECTOR AGE
|
||||
dns-backend 10.0.2.4 <none> 8000/TCP name=dns-backend 1d
|
||||
```
|
||||
|
||||
### Step Four: Create client pod in one namespace
|
||||
|
|
|
@ -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 <none> 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 <none> 6379/TCP app=redis,role=master 1h
|
||||
redis-slave 10.0.21.92 <none> 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 <none> 6379/TCP app=redis,role=master 1h
|
||||
redis-slave 10.0.21.92 <none> 6379/TCP app-redis,role=slave 1h
|
||||
...
|
||||
```
|
||||
|
||||
|
|
|
@ -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 <none> 6379/TCP app=redis,role=master 1h
|
||||
...
|
||||
```
|
||||
|
||||
This will cause all pods to see the redis master apparently running on <ip>: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 <none> 6379/TCP app=redis,role=master 1h
|
||||
redis-slave 10.0.21.92 <none> 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 <none> 80/TCP name=frontend 1h
|
||||
redis-master 10.0.136.3 <none> 6379/TCP app=redis,role=master 1h
|
||||
redis-slave 10.0.21.92 <none> 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 <none> 6379/TCP app=redis,role=master 1h
|
||||
redis-slave 10.0.21.92 <none> 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.
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 <none> 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 <none> 28015/TCP db=rethinkdb 20m
|
||||
```
|
||||
|
||||
We request an external load balancer in the [admin-service.yaml](admin-service.yaml) file:
|
||||
|
|
|
@ -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 <none> 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 <none> 2181/TCP name=zookeeper 10m
|
||||
kubernetes 10.0.0.2 <none> 443/TCP <none> 1d
|
||||
|
||||
$ echo ruok | nc 10.254.139.141 2181; echo
|
||||
imok
|
||||
|
|
Loading…
Reference in New Issue