yum -y install git
git init monitoring
git config --global init.defaultBranch main
cd monitoring
git remote add -f origin https://github.com/k8s-1pro/install.git
git config core.sparseCheckout true
echo "ground/k8s-1.27/prometheus-2.44.0" >> .git/info/sparse-checkout
echo "ground/k8s-1.27/loki-stack-2.6.1" >> .git/info/sparse-checkout
git pull origin main
kubectl apply --server-side -f ground/k8s-1.27/prometheus-2.44.0/manifests/setup
kubectl wait --for condition=Established --all CustomResourceDefinition --namespace=monitoring
kubectl apply -f ground/k8s-1.27/prometheus-2.44.0/manifests
kubectl get pods -n monitoring

kubectl apply -f ground/k8s-1.27/loki-stack-2.6.1

주소창에 http://192.168.56.30:30001

id,pw 입력

접속 완료

왼쪽위 화살표늘 누른뒤 Data sources를 누른뒤 파란색 add버튼 누른다.

로키눌러서 접속 후 URL에 http://loki-stack.loki-stack:3100 입력 후 하단에 save & test 클릭

초기화면으로 돌아간 후 대시보드로 들어가면 모니터링 화면들이 생성 된다.




지표중에 copy를 눌러서 원하는 지표만 따로 대시보드로 만들 수 있다.
cd monitoring ( 설치 디렉토리로 이동)
kubectl delete --ignore-not-found=true -f ground/k8s-1.27/prometheus-2.44.0/manifests -f ground/k8s-1.27/prometheus-2.44.0/manifests/setup
kubectl delete -f ground/k8s-1.27/loki-stack-2.6.1