Skip to content

Instantly share code, notes, and snippets.

@juner417
Created July 17, 2024 13:30
Show Gist options
  • Select an option

  • Save juner417/2c7602488795cbd6a299d89a1fce19a5 to your computer and use it in GitHub Desktop.

Select an option

Save juner417/2c7602488795cbd6a299d89a1fce19a5 to your computer and use it in GitHub Desktop.
kube-apiserver profiling

kube apiserver profiling

  • kubernetes apiserver profiling

history

  • 특정 kube-apiserver의 memory usage가 급증함(rss-181gb)
  • 재시작 했으나 다른 노드에서 memory usage가 급증함
  • 여러가지 증상들을 공유함
    • kyverno의 사용량 급증
  • 위 근거과 연관관계를 확인해 보기 위한 memory 사용량 profiling 필요하여 kube-apiserver의 profiling enable함
  • default가 true인데 kubespray에서 hardening을 위해 false로 설정 변경

apply

kube-apiserver option 조정

  • profiling disable 상태, 이것을 enable로 변경함
sudo vi /etc/kubernetes/manifest/kube-apiserver.yaml
...
# 해당 라인 제거
--profiling=false
...

local에서 kubectl proxy 실행

kubectl proxy

필수 바이너리 설치 및 프로파일링 실행

# 필수 바이너리 설치
brew install graphviz

go tool pprof -http=:6061 http://127.0.0.1:8001/debug/pprof/heap
go tool pprof -http=:6061 http://127.0.0.1:8001/debug/pprof/allocs

ui 확인

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment