本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
在 Amazon EKS 和 Kubernetes 上使用指標匯出工具設定 HAProxy
HAProxy 是一個開放程式碼代理應用程式。如需詳細資訊,請參閱 HAProxy
如果您在具有 Fargate 啟動類型的叢集上執行 HAProxy,則需要在執行此程序中的步驟之前設定 Fargate 描述檔。若要設定描述檔,請輸入下列命令。將 MyCluster
取代為您的叢集名稱。
eksctl create fargateprofile --cluster
MyCluster
\ --namespace haproxy-ingress-sample --name haproxy-ingress-sample
使用指標匯出工具安裝 HAProxy,以測試 Container Insights Prometheus 支援
-
輸入下列命令以新增 Helm incubator 儲存庫:
helm repo add haproxy-ingress https://haproxy-ingress.github.io/charts
-
輸入以下命令來建立新的命名空間:
kubectl create namespace haproxy-ingress-sample
-
輸入下列命令來安裝 HAProxy:
helm install haproxy haproxy-ingress/haproxy-ingress \ --namespace haproxy-ingress-sample \ --set defaultBackend.enabled=true \ --set controller.stats.enabled=true \ --set controller.metrics.enabled=true \ --set-string controller.metrics.service.annotations."prometheus\.io/port"="9101" \ --set-string controller.metrics.service.annotations."prometheus\.io/scrape"="true"
-
輸入下列命令以確認服務的註釋:
kubectl describe service haproxy-haproxy-ingress-metrics -n haproxy-ingress-sample
您應該會看到下列註釋。
Annotations: prometheus.io/port: 9101 prometheus.io/scrape: true
解除安裝 HAProxy
-
輸入下列命令:
helm uninstall haproxy --namespace haproxy-ingress-sample kubectl delete namespace haproxy-ingress-sample