🧊kube cadvisor with external prometheus
Pre Kubernetes Cluster at Master Node:
install cadvisor
kubectl apply -k https://github.com/google/cadvisor/deploy/kubernetes/baseassing env pod name
pod=`kubectl -n cadvisor get pod -l app=cadvisor -o jsonpath="{.items[0].metadata.name}"`port-forward cadvisor
kubectl -n cadvisor port-forward pod/"${pod}" 8080:8080 --address='0.0.0.0' &-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
İlk adım service account oluşturun.
apiVersion: v1
kind: ServiceAccount
metadata:
name: testsa
namespace: defaultkubectl apply -f service-account-testsa.yml
Service account'u bir clusterrolebinding oluşturup, clusterrole'e atayarak, yetki tanımlamış olalım.
kubectl create clusterrolebinding cluster_role_binding_name --clusterrole=cluster-admin --serviceaccount=namespace:service_account_name
Example
Service account'ına ait, token ve ca.crt dosyalarını almak için, service account'ı bir pod'a tanımlayalım.
Oluşturduğumuz Pod'a shell'den bağlanıp, iglili dizine gidelim.
Dizine geçelim.
Token ve ca.crt dosyalarının içeriklerini alalım.
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
Prometheus Sunucuya Geçelim;
ca.crt dosyasını /tmp altına kopyalayalım.
Prometheus yapılandırma dosyasını güncelleyelim.
token, ca.crt, api server tanımları yapıldı.
Prometheus servisi restart edelim.
systemctl restart prometheus


Last updated
Was this helpful?