brunch

You can make anything
by writing

C.S.Lewis

by Master Seo Mar 27. 2023

쿠버4탄-7. K8S-kwatch

7/11

본 내용은 CloudNet 에서 진행하는 주말 스터디에 참여하여 해당 내용을 참고로 작성되었습니다.
https://gasidaseo.notion.site/gasidaseo/CloudNet-Blog-c9dfa44a27ff431dafdd2edacc8a1863  



목표

알람 노티를 Slack에 전달하는 법을 알아보자.



<1> webhook url 만들기

<2> kwatch 설치하기

<3> NGINX 배포하여 테스트

<4> 정리




<1> webhook url 만들기


1

slack에서 새 워크스페이스 개설


2

https://api.slack.com  에서 시작


메뉴얼

https://velog.io/@king/slack-incoming-webhook




<2> kwatch 설치하기


kwatch

kwatch helm

kwatch blog


# configmap 생성

cat <<EOT > ~/kwatch-config.yaml

apiVersion: v1

kind: Namespace

metadata:

  name: kwatch

---

apiVersion: v1

kind: ConfigMap

metadata:

  name: kwatch

  namespace: kwatch

data:

  config.yaml: |

    alert:

      slack:

        webhook: 'https://hooks.slack.com/services/T0569TB1PJ4/B055H8NN81K/h0CS7Rdo0'

        #title:

        #text:

    pvcMonitor:

      enabled: true

      interval: 5

      threshold: 70

EOT


kubectl apply -f kwatch-config.yaml


# 배포

kubectl apply -f https://raw.githubusercontent.com/abahmed/kwatch/v0.8.3/deploy/deploy.yaml




<3> NGINX 배포하여 테스트


1

# 터미널 1

watch kubectl get pod


2

# 잘못된 이미지 정보의 파드 배포

kubectl apply -f https://raw.githubusercontent.com/junghoon2/kube-books/main/ch05/nginx-error-pod.yml

kubectl get events -w


# 이미지 업데이트 방안 2 : set 사용 - iamge 등 일부 리소스 값을 변경 가능!

kubectl set 

kubectl set image pod nginx-19 nginx-pod=nginx:1.19


# 삭제

kubectl delete pod nginx-19





<4> 정리


웹훅 URL 만드는 법을 알아보았다.

알람 노티를 slack으로 받기 위한 kwatch 설치해 보았다.

nginx배포해서 테스트해 보았다.




다음과정

https://brunch.co.kr/@topasvga/3142




https://brunch.co.kr/@topasvga/3144




감사합니다.


                    

keyword
매거진의 이전글 쿠버4탄-5. K8S-프로메테우스 Prometheus

작품 선택

키워드 선택 0 / 3 0

댓글여부

afliean
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari