![](/img/trans.png)
[英]Unable to deploy a second ingress controller using helm in Azure Kubernetes Cluster ( AKS )
[英]How to annotate pods of an Ingress Controller using Helm in Kubernetes (AKS)?
在 Azure AKS 上運行 helm chart 打包容器時,我正在嘗試自動注釋 pod(編輯:入口控制器 pod)以在 Scalyr 中設置自定義日志解析器。 我可以自動注釋服務,但無法自動注釋 pod。 使用 kubectl 手動執行此操作:
kubectl annotate pod nginx-ingress-ingress-nginx-controller-yyy-xxx --overwrite log.config.scalyr.com/attributes.parser=<my_scalyr_parser_name>
很好,但是當我的 pod 終止時,我會丟失我的注釋,並且 Scalyr 可能會丟失一些日志。 或者入口 nginx pods IDDQD(不朽)? 所以我試圖以某種方式自動化。
我試過將它添加到 values.yaml
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/use-regex: "true"
log.config.scalyr.com/attributes.parser: "<my_scalyr_parser_name>"
但它只是落在 ingress.yaml 中的元數據注釋中
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "myservice.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
這會導致服務的注釋。 但是,我需要在 pod 上進行注釋,以便 Scalyr 使用我的自定義解析器,而不是在服務中。
另一種方法是在安裝 nginx-ingress 時硬着頭皮做:
helm install nginx-ingress ingress-nginx/ingress-nginx --set controller.replicaCount=3 --set-string controller.pod.annotations.'log\.config\.scalyr\.com/attributes\.parser'="<my_scalyr_parser_name>"
--set-string controller.service.annotations.'service\.beta\.kubernetes\.io/azure-load-balancer-internal'="true"
在那里,當我設置 controller.service.annotations 時,我得到了關於服務的注釋,但是 controller.pod.annotations 被忽略了(我在 nginx 文檔中找到了 controller.pod.annotations)。
那我還能做什么?
您應該可以使用values.yaml
來做到這values.yaml
,就像您嘗試使用ingress
:
controller:
podAnnotations:
log.config.scalyr.com/attributes.parser: "<my_scalyr_parser_name>"
出於某種原因,變量的關鍵是controller.podAnnotations
NOT controller.pod.annotations
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.