-
Notifications
You must be signed in to change notification settings - Fork 490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Annotations do not take effect when container injection is specified #1854
Comments
I am not quite sure if I understand the issue. Where the OTEL annotations present on the pod spec in deployment when the deployment was first created? Could you please paste the deployment yaml file here? |
When the deployment was first created, the OTEL annotations present on the pod annotations, but the annotations don't seem to work, there is not "opentelemetry-auto-instrumentation" init containers and the pod events disappear "Created container opentelemetry-auto-instrumentation".
|
Thank you for your reply! But in my experiment, there was nothing attached except the OTEL Agent. I guess this is not the problem, and I am more skeptical that something was missing from the first deployment that caused the injection to fail. |
@liililil the problem is that your MutationWebhookConfiguration Ideally, you could set up the Pod to fail if the webhook isn't ready: - admissionReviewVersions:
- v1
clientConfig:
service:
name: release-name-operator-webhook
namespace: default
path: /mutate-v1-pod
failurePolicy: Fail
name: mpod.kb.io
rules:
- apiGroups:
- ""
apiVersions:
- v1
operations:
- CREATE
- UPDATE
resources:
- pods Now, take into account that the operator itself is a Pod, so you need to add some selector to know to which Pods you should apply this configuration. Ideally, I would recommend that you deploy the OpenTelemetry Operator in a namespace like ...
namespaceSelector:
matchExpressions:
- key: kubernetes.io/metadata.name
operator: NotIn
values:
- kube-system
- monitoring <- This can be whichever namespace where you've deployed the operator
... Basically, if you're using Helm, the admissionWebhooks:
pods:
failurePolicy: Fail
namespaceSelector:
matchExpressions:
- key: kubernetes.io/metadata.name
operator: NotIn
values:
- kube-system
- monitoring You can also add I want to do a Pull-Request to modify this and to add customizable selectors per resource, but I don't have time right now 😅 |
@TylerHelmuth it seems like this may be a helm chart issue? |
Based on @dacamposol great investigation I believe the helm chart can already provide a solution. |
Deployment add annotations:
The deployment has many containers, and the “app” container’s position is not fixed.
The first time the service is deployed, the opentelemetry-auto-instrumentation cannot be found in init containers. But after restart the deployment, the opentelemetry-auto-instrumentation works normally.
Environment:
Kubernetes 1.20.11
opentelemetry-operator 0.79.0
opentelemetry-autoinstrumentation-java 1.24.0
The text was updated successfully, but these errors were encountered: