-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(demo): add demo using OpenObserve's OTLP GRPC ingestion
Signed-off-by: Szilard Parrag <szilard.parrag@axoflow.com>
- Loading branch information
Showing
3 changed files
with
219 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: collector | ||
--- | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
labels: | ||
nsSelector: example-tenant | ||
name: example-tenant-ns | ||
--- | ||
apiVersion: telemetry.kube-logging.dev/v1alpha1 | ||
kind: Collector | ||
metadata: | ||
name: example-collector | ||
spec: | ||
controlNamespace: collector | ||
tenantSelector: | ||
matchLabels: | ||
collectorLabel: example-collector | ||
--- | ||
apiVersion: telemetry.kube-logging.dev/v1alpha1 | ||
kind: Tenant | ||
metadata: | ||
labels: | ||
collectorLabel: example-collector | ||
name: example-tenant | ||
spec: | ||
subscriptionNamespaceSelectors: | ||
- matchLabels: | ||
nsSelector: example-tenant | ||
logSourceNamespaceSelectors: | ||
- matchLabels: | ||
nsSelector: example-tenant | ||
--- | ||
apiVersion: telemetry.kube-logging.dev/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: subscription-sample-1 | ||
namespace: example-tenant-ns | ||
spec: | ||
ottl: 'route()' | ||
outputs: | ||
- name: otlp-openobserve | ||
namespace: collector | ||
--- | ||
apiVersion: telemetry.kube-logging.dev/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: subscription-sample-2 | ||
namespace: example-tenant-ns | ||
spec: | ||
ottl: 'route()' | ||
outputs: | ||
- name: otlp-openobserve | ||
namespace: collector | ||
--- | ||
apiVersion: telemetry.kube-logging.dev/v1alpha1 | ||
kind: OtelOutput | ||
metadata: | ||
name: otlp-openobserve | ||
namespace: collector | ||
spec: | ||
otlp: | ||
endpoint: openobserve-otlp-grpc.openobserve.svc.cluster.local:5081 | ||
headers: | ||
# Add token from Web UI manually as there is no way to query it | ||
Authorization: "Basic cm9vdEBleGFtcGxlLmNvbTp1TzU4QmFaeXAzeDZRUDlZ" # echo -n username:pwd | base64 | ||
organization: default | ||
stream-name: default | ||
tls: | ||
insecure: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
#!/usr/bin/env bash | ||
KIND_CLUSTER_NAME=${KIND_CLUSTER_NAME:-kind} | ||
|
||
# Install OpenObserve | ||
kubectl create namespace openobserve | ||
|
||
kubectl apply -f - <<EOF | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: openobserve | ||
namespace: openobserve | ||
spec: | ||
clusterIP: None | ||
selector: | ||
app: openobserve | ||
ports: | ||
- name: http | ||
port: 5080 | ||
targetPort: 5080 | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: openobserve-otlp-grpc | ||
namespace: openobserve | ||
spec: | ||
clusterIP: None | ||
selector: | ||
app: openobserve | ||
ports: | ||
- name: otlp-grpc | ||
port: 5081 | ||
targetPort: 5081 | ||
--- | ||
# create statefulset | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: openobserve | ||
namespace: openobserve | ||
labels: | ||
name: openobserve | ||
spec: | ||
serviceName: openobserve | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
name: openobserve | ||
app: openobserve | ||
template: | ||
metadata: | ||
labels: | ||
name: openobserve | ||
app: openobserve | ||
spec: | ||
securityContext: | ||
fsGroup: 2000 | ||
runAsUser: 10000 | ||
runAsGroup: 3000 | ||
runAsNonRoot: true | ||
# terminationGracePeriodSeconds: 0 | ||
containers: | ||
- name: openobserve | ||
image: public.ecr.aws/zinclabs/openobserve:v0.7.2 | ||
env: | ||
- name: ZO_ROOT_USER_EMAIL | ||
value: root@example.com | ||
- name: ZO_ROOT_USER_PASSWORD | ||
value: Complexpass#123 | ||
- name: ZO_DATA_DIR | ||
value: /data | ||
# command: ["/bin/bash", "-c", "while true; do sleep 1; done"] | ||
imagePullPolicy: Always | ||
resources: | ||
limits: | ||
cpu: 4096m | ||
memory: 2048Mi | ||
requests: | ||
cpu: 256m | ||
memory: 50Mi | ||
ports: | ||
- containerPort: 5080 | ||
name: http | ||
- containerPort: 50801 | ||
name: otlp-grpc | ||
volumeMounts: | ||
- name: data | ||
mountPath: /data | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: data | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
# storageClassName: default | ||
# NOTE: You can increase the storage size | ||
resources: | ||
requests: | ||
storage: 10Gi | ||
EOF | ||
|
||
# Check for readiness | ||
while | ||
echo "Waiting for OpenObserve pod to be running" | ||
kubectl get pods -n openobserve | grep -qi "running" | ||
|
||
[[ $? -ne 0 ]] | ||
do sleep 3; done | ||
|
||
# Install prerequisites | ||
|
||
helm upgrade \ | ||
--install \ | ||
--repo https://charts.jetstack.io \ | ||
cert-manager cert-manager \ | ||
--namespace cert-manager \ | ||
--create-namespace \ | ||
--version v1.13.3 \ | ||
--set installCRDs=true \ | ||
--wait | ||
|
||
kubectl apply -f https://github.com/open-telemetry/opentelemetry-operator/releases/latest/download/opentelemetry-operator.yaml --wait | ||
echo "Wait until otel operator pod is in ready state..." | ||
kubectl wait --namespace opentelemetry-operator-system --for=condition=available deployment/opentelemetry-operator-controller-manager --timeout=300s | ||
|
||
|
||
(cd ../.. && make manifests generate install) | ||
|
||
cd ../../ && make docker-build | ||
kind load docker-image controller:latest --name "${KIND_CLUSTER_NAME}" | ||
make deploy && cd - | ||
|
||
kubectl apply -f ./demo.yaml | ||
|
||
|
||
# OpenObserve UI | ||
kubectl -n openobserve port-forward svc/openobserve 5080:5080 & | ||
# OpenObserve OTLP GRPC | ||
#kubectl -n openobserve port-forward svc/openobserve-otlp-grpc 5081:5081 & | ||
sleep 5 | ||
|
||
# Create log-generator | ||
helm install --wait --create-namespace --namespace example-tenant-ns --generate-name oci://ghcr.io/kube-logging/helm-charts/log-generator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters