mirror of https://github.com/istio/istio.io.git
188 lines
4.8 KiB
Bash
188 lines
4.8 KiB
Bash
#!/bin/bash
|
|
# shellcheck disable=SC2034,SC2153,SC2155,SC2164
|
|
|
|
# Copyright Istio Authors. All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
####################################################################################################
|
|
# WARNING: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT. PLEASE MODIFY THE ORIGINAL MARKDOWN FILE:
|
|
# docs/tasks/observability/distributed-tracing/opencensusagent/index.md
|
|
####################################################################################################
|
|
source "content/en/boilerplates/snips/before-you-begin-egress.sh"
|
|
source "content/en/boilerplates/snips/trace-generation.sh"
|
|
|
|
! read -r -d '' snip_configure_tracing_1 <<\ENDSNIP
|
|
apiVersion: install.istio.io/v1alpha1
|
|
kind: IstioOperator
|
|
spec:
|
|
meshConfig:
|
|
defaultProviders:
|
|
tracing:
|
|
- "opencensus"
|
|
enableTracing: true
|
|
extensionProviders:
|
|
- name: "opencensus"
|
|
opencensus:
|
|
service: "opentelemetry-collector.istio-system.svc.cluster.local"
|
|
port: 55678
|
|
context:
|
|
- W3C_TRACE_CONTEXT
|
|
ENDSNIP
|
|
|
|
snip_configure_tracing_2() {
|
|
kubectl apply -f - <<EOF
|
|
apiVersion: telemetry.istio.io/v1alpha1
|
|
kind: Telemetry
|
|
metadata:
|
|
name: mesh-default
|
|
namespace: istio-system
|
|
spec:
|
|
tracing:
|
|
- randomSamplingPercentage: 100.00
|
|
EOF
|
|
}
|
|
|
|
snip_deploy_opentelemetry_collector_1() {
|
|
kubectl apply -f - <<EOF
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: opentelemetry-collector
|
|
namespace: istio-system
|
|
labels:
|
|
app: opentelemetry-collector
|
|
data:
|
|
config: |
|
|
receivers:
|
|
opencensus:
|
|
endpoint: 0.0.0.0:55678
|
|
processors:
|
|
memory_limiter:
|
|
limit_mib: 100
|
|
spike_limit_mib: 10
|
|
check_interval: 5s
|
|
exporters:
|
|
zipkin:
|
|
# Export via zipkin for easy querying
|
|
endpoint: http://zipkin.istio-system.svc:9411/api/v2/spans
|
|
logging:
|
|
loglevel: debug
|
|
extensions:
|
|
health_check:
|
|
port: 13133
|
|
service:
|
|
extensions:
|
|
- health_check
|
|
pipelines:
|
|
traces:
|
|
receivers:
|
|
- opencensus
|
|
processors:
|
|
- memory_limiter
|
|
exporters:
|
|
- zipkin
|
|
- logging
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: opentelemetry-collector
|
|
namespace: istio-system
|
|
labels:
|
|
app: opentelemetry-collector
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app: opentelemetry-collector
|
|
ports:
|
|
- name: grpc-opencensus
|
|
port: 55678
|
|
protocol: TCP
|
|
targetPort: 55678
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: opentelemetry-collector
|
|
namespace: istio-system
|
|
labels:
|
|
app: opentelemetry-collector
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: opentelemetry-collector
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: opentelemetry-collector
|
|
spec:
|
|
containers:
|
|
- name: opentelemetry-collector
|
|
image: "otel/opentelemetry-collector:0.49.0"
|
|
imagePullPolicy: IfNotPresent
|
|
command:
|
|
- "/otelcol"
|
|
- "--config=/conf/config.yaml"
|
|
ports:
|
|
- name: grpc-opencensus
|
|
containerPort: 55678
|
|
protocol: TCP
|
|
volumeMounts:
|
|
- name: opentelemetry-collector-config
|
|
mountPath: /conf
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: 13133
|
|
resources:
|
|
requests:
|
|
cpu: 40m
|
|
memory: 100Mi
|
|
volumes:
|
|
- name: opentelemetry-collector-config
|
|
configMap:
|
|
name: opentelemetry-collector
|
|
items:
|
|
- key: config
|
|
path: config.yaml
|
|
EOF
|
|
}
|
|
|
|
snip_access_the_dashboard_1() {
|
|
istioctl dashboard jaeger
|
|
}
|
|
|
|
snip_generating_traces_using_the_bookinfo_sample_1() {
|
|
kubectl -n istio-system logs deploy/opentelemetry-collector
|
|
}
|
|
|
|
snip_cleanup_1() {
|
|
killall istioctl
|
|
}
|
|
|
|
snip_cleanup_2() {
|
|
kubectl delete -f https://raw.githubusercontent.com/istio/istio/release-1.18/samples/addons/jaeger.yaml
|
|
}
|
|
|
|
snip_cleanup_3() {
|
|
kubectl delete -n istio-system cm opentelemetry-collector
|
|
kubectl delete -n istio-system svc opentelemetry-collector
|
|
kubectl delete -n istio-system deploy opentelemetry-collector
|
|
}
|
|
|
|
snip_cleanup_4() {
|
|
kubectl delete telemetries.telemetry.istio.io -n istio-system mesh-default
|
|
}
|