Update TCP docs to address issues (#684)

This commit is contained in:
Douglas Reid 2017-10-24 10:10:46 -07:00 committed by GitHub
parent 5ba66d20c0
commit fc62790e8d
1 changed files with 95 additions and 71 deletions

View File

@ -41,73 +41,73 @@ as the example application throughout this task.
Save the following as `tcp_telemetry.yaml`: Save the following as `tcp_telemetry.yaml`:
```yaml ```yaml
# Configuration for a metric measuring bytes sent from a server # Configuration for a metric measuring bytes sent from a server
# to a client # to a client
apiVersion: "config.istio.io/v1alpha2" apiVersion: "config.istio.io/v1alpha2"
kind: metric kind: metric
metadata: metadata:
name: mongosentbytes name: mongosentbytes
namespace: default namespace: default
spec: spec:
value: connection.sent.bytes | 0 # uses a TCP-specific attribute value: connection.sent.bytes | 0 # uses a TCP-specific attribute
dimensions: dimensions:
source_service: source.service | "unknown" source_service: source.service | "unknown"
source_version: source.labels["version"] | "unknown" source_version: source.labels["version"] | "unknown"
destination_version: destination.labels["version"] | "unknown" destination_version: destination.labels["version"] | "unknown"
monitoredResourceType: '"UNSPECIFIED"' monitoredResourceType: '"UNSPECIFIED"'
--- ---
# Configuration for a metric measuring bytes sent from a client # Configuration for a metric measuring bytes sent from a client
# to a server # to a server
apiVersion: "config.istio.io/v1alpha2" apiVersion: "config.istio.io/v1alpha2"
kind: metric kind: metric
metadata: metadata:
name: mongoreceivedbytes name: mongoreceivedbytes
namespace: default namespace: default
spec: spec:
value: connection.received.bytes | 0 # uses a TCP-specific attribute value: connection.received.bytes | 0 # uses a TCP-specific attribute
dimensions: dimensions:
source_service: source.service | "unknown" source_service: source.service | "unknown"
source_version: source.labels["version"] | "unknown" source_version: source.labels["version"] | "unknown"
destination_version: destination.labels["version"] | "unknown" destination_version: destination.labels["version"] | "unknown"
monitoredResourceType: '"UNSPECIFIED"' monitoredResourceType: '"UNSPECIFIED"'
--- ---
# Configuration for a Prometheus handler # Configuration for a Prometheus handler
apiVersion: "config.istio.io/v1alpha2" apiVersion: "config.istio.io/v1alpha2"
kind: prometheus kind: prometheus
metadata: metadata:
name: mongohandler name: mongohandler
namespace: default namespace: default
spec: spec:
metrics: metrics:
- name: mongo_sent_bytes # Prometheus metric name - name: mongo_sent_bytes # Prometheus metric name
instance_name: mongosentbytes.metric.default # Mixer instance name (fully-qualified) instance_name: mongosentbytes.metric.default # Mixer instance name (fully-qualified)
kind: COUNTER kind: COUNTER
label_names: label_names:
- source_service - source_service
- source_version - source_version
- destination_version - destination_version
- name: mongo_sent_bytes # Prometheus metric name - name: mongo_received_bytes # Prometheus metric name
instance_name: mongosentbytes.metric.default # Mixer instance name (fully-qualified) instance_name: mongoreceivedbytes.metric.default # Mixer instance name (fully-qualified)
kind: COUNTER kind: COUNTER
label_names: label_names:
- source_service - source_service
- source_version - source_version
- destination_version - destination_version
--- ---
# Rule to send metric instances to a Prometheus handler # Rule to send metric instances to a Prometheus handler
apiVersion: "config.istio.io/v1alpha2" apiVersion: "config.istio.io/v1alpha2"
kind: rule kind: rule
metadata: metadata:
name: mongoprom name: mongoprom
namespace: default namespace: default
spec: spec:
match: context.protocol == "tcp" match: context.protocol == "tcp"
&& destination.service = "mongodb.default.svc.cluster.local" && destination.service == "mongodb.default.svc.cluster.local"
actions: actions:
- handler: mongohandler.prometheus - handler: mongohandler.prometheus
instances: instances:
- mongoreceivedbytes.metric - mongoreceivedbytes.metric
- mongosentbytes.metric - mongosentbytes.metric
``` ```
1. Push the new configuration. 1. Push the new configuration.
@ -126,7 +126,16 @@ as the example application throughout this task.
1. Setup BookInfo to use MongoDB. 1. Setup BookInfo to use MongoDB.
1. Install `v2` of the `ratings` service: 1. Install `v2` of the `ratings` service.
If you are using a cluster with automatic sidecar injection enabled,
simply deploy the services using `kubectl`:
```
kubectl apply -f samples/bookinfo/kube/bookinfo-ratings-v2.yaml
```
If you are using manual sidecar injection, use the following command instead:
``` ```
kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/kube/bookinfo-ratings-v2.yaml) kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/kube/bookinfo-ratings-v2.yaml)
@ -140,6 +149,15 @@ as the example application throughout this task.
1. Install the `mongodb` service: 1. Install the `mongodb` service:
If you are using a cluster with automatic sidecar injection enabled,
simply deploy the services using `kubectl`:
```
kubectl apply -f samples/bookinfo/kube/bookinfo-db.yaml
```
If you are using manual sidecar injection, use the following command instead:
``` ```
kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/kube/bookinfo-db.yaml) kubectl apply -f <(istioctl kube-inject -f samples/bookinfo/kube/bookinfo-db.yaml)
``` ```
@ -154,14 +172,14 @@ as the example application throughout this task.
1. Add routing rules to send traffic to `v2` of the `ratings` service: 1. Add routing rules to send traffic to `v2` of the `ratings` service:
``` ```
kubectl apply -f samples/bookinfo/kube/route-rule-ratings-db.yaml istioctl create -f samples/bookinfo/kube/route-rule-ratings-db.yaml
``` ```
Expected output: Expected output:
``` ```
routerule "ratings-test-v2" created Created config route-rule//ratings-test-v2 at revision 7216403
routerule "reviews-test-ratings-v2" created Created config route-rule//reviews-test-ratings-v2 at revision 7216404
``` ```
1. Send traffic to the sample application. 1. Send traffic to the sample application.
@ -232,6 +250,12 @@ protocols within policies.
istioctl delete -f tcp_telemetry.yaml istioctl delete -f tcp_telemetry.yaml
``` ```
* Remove the `port-forward` process:
```bash
killall kubectl
```
* If you are not planning to explore any follow-on tasks, refer to the * If you are not planning to explore any follow-on tasks, refer to the
[BookInfo cleanup]({{home}}/docs/guides/bookinfo.html#cleanup) instructions [BookInfo cleanup]({{home}}/docs/guides/bookinfo.html#cleanup) instructions
to shutdown the application. to shutdown the application.