![](/img/trans.png)
[英]Azure kubernetes - Azure CNI & Istio, sidecar IP allocation?
[英]Azure Kubernetes - Azure Monitor & Sidecar Logshipping?
由於容器的 Azure Monitor 將從控制台收集基本日志,即 stdout/stderr。 是否有任何理由為日志傳送實施 sidecar,尤其是對於生產工作負載? 目前我正在使用以下模式
apiVersion: apps/v1
kind: Deployment
metadata:
name: sidecar-logshipping
spec:
replicas: 2
selector:
matchLabels:
app: sidecar-logshipping
template:
metadata:
labels:
app: sidecar-logshipping
spec:
containers:
- name: main-container
image: busybox
args:
- /bin/sh
- -c
- >
i=0;
while true;
do
echo "$i: $(date) dog" >> /var/log/mylogs/app.log;
i=$((i+1));
sleep 1;
done
resources:
limits:
memory: "256Mi"
cpu: "500m"
requests:
memory: "64Mi"
cpu: "250m"
volumeMounts:
- name: logs
mountPath: /var/log/mylogs
- name: log-shipper
image: busybox
args: [/bin/sh, -c, 'tail -n+1 -f /var/log/mylogs/*.log']
resources:
limits:
memory: "256Mi"
cpu: "500m"
requests:
memory: "64Mi"
cpu: "250m"
volumeMounts:
- name: logs
mountPath: /var/log/mylogs
volumes:
- name: logs
emptyDir: {}
Azure Monitor 收集日志並發送到 Log Analytics 工作區。 它無法將日志發送到 ELK 堆棧。 因此,如果您習慣了這些工具並希望繼續使用它們,那么基於 fluentbit sidecar 或 fluentd daemonset 的解決方案是替代方案。 但是在這種情況下,ELK 堆棧的管理取決於您。
Azure Monitor 的優勢在於它將您的 AKS 日志與其他 Azure 平台日志合並,提供統一的監控體驗。
azure 監視器的缺點是在非常大的容量下,成本可能會成為一個考慮因素。
因此,您可能希望將開源 ELK 堆棧用於產生大量日志的應用程序,而將 Azure Monitor 用於產生少量日志的應用程序。
只是為 Arghya Sadhus 答案添加另一個選項:Elasticsearch 在生產就緒安裝中具有相當高的內存占用。 我個人認為僅將它用於日志聚合是過度的。
一個輕量級的替代方案是您可以使用直接集成在 Grafana 中的 Loki 來聚合您的日志。 (參見此處參考: https : //grafana.com/oss/loki/ )
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.