opentelemetry-helm-charts icon indicating copy to clipboard operation
opentelemetry-helm-charts copied to clipboard

[Operator] Service definition in Operator for AWS controller (NLB+ACM) to expose OTEL-Collector outside of k8s

Open szibis opened this issue 10 months ago • 4 comments

Four services are exposed in the operator itself, but all of them are in the K8s cluster and accessible. The only way, but not very flexible (cert-manager for external cert and ingress externally exposed), is to use Ingress, which is available at https://github.com/open-telemetry/opentelemetry-operator/blob/main/docs/api.md I would like to expose AWS NLB from the collector definition as a k8s service as bellow.

apiVersion: v1
kind: Service
metadata:
annotations:
  external-dns.alpha.kubernetes.io/hostname: {{ .Values.hostname }}
  service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags: "app=otel-collector,env={{ .Values.env }}"
  service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
  service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
  service.beta.kubernetes.io/aws-load-balancer-scheme: internal
  service.beta.kubernetes.io/aws-load-balancer-ssl-cert: {{ $certArn }}
  service.beta.kubernetes.io/aws-load-balancer-ssl-ports: '4317,4318'
  service.beta.kubernetes.io/aws-load-balancer-type: external
labels:
  app.kubernetes.io/instance: opentelemetry-stack.otel-collector
  app.kubernetes.io/managed-by: Helm
  app.kubernetes.io/name: otel-collector
  helm.sh/chart: opentelemetry-stack
name: otel-collector-lb
namespace: opentelemetry-stack
spec:
ports:
  - name: otlp-grpc
    port: 4317
    protocol: TCP
    targetPort: 4317
  - name: otlp-http
    port: 4318
    protocol: TCP
    targetPort: 4318
selector:
  app.kubernetes.io/instance: opentelemetry-kube-stack.otel-collector
  app.kubernetes.io/name: otel-collector
type: LoadBalancer

AWS NLB with ACM cert termination is the simplest way to implement and expose in k8s. It would be great to be able to add a custom service in the operator collector scope.

szibis avatar Jan 15 '25 17:01 szibis

@szibis @TylerHelmuth could you please assign this issue to me ?

Sunilwali679 avatar Mar 03 '25 07:03 Sunilwali679

@szibis what needs to change in the chart to achieve what you want?

TylerHelmuth avatar Mar 04 '25 15:03 TylerHelmuth

I believe service definition for specific collector CRD could help here to add additional service pointing to collector.

szibis avatar Mar 04 '25 15:03 szibis

If the OpenTelemetryCollector custom resource that the operator manages needs special annotations on its service then that would be the responsibility of the Operator, not the helm chart that installs the Operator.

TylerHelmuth avatar Mar 10 '25 15:03 TylerHelmuth