Skip to content

Instantly share code, notes, and snippets.

@juner417
juner417 / kube-apiserver-profiling.md
Created July 17, 2024 13:30
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로 설정 변경
@juner417
juner417 / README.md
Created March 11, 2024 14:56
My colima VM IP is not NATed, and the src IP goes out as is.

Status

  • colima vm(type : vz)에 2개의 컨테이너 런타임의 vm 존재(containerd-default, docker)
  • docker vm을 실행한뒤, 사내 내부 harbor로 로그인할 경우, 둘다 vm의 ip(192.168.64.0/24 col0)가 source ip 패킷이 나감(using tcpdump)
  • 해당 ip는 pc(macos)의 vtep interface ip이므로 dest(사내 내부 harbor)에서 src를 찾지 못해서 정상적인 커넥션 맺지 못함

Solution

  1. Force add translation rules to my local PC
# add below rule in /etc/pf.conf, utun4 is secure vpn interface
@juner417
juner417 / auth.exp
Created January 29, 2024 15:10
handle a interactive ssh using expect script
#!/usr/bin/expect
set host "YOURGWHOST"
set username "YOURACCOUNT"
set password "[exec dec.sh]"
set timeout 30
spawn ssh $username@$host
expect {
@juner417
juner417 / README.md
Created January 22, 2024 15:27
Starting podman machine is stuck with qemu assert

Starting podman machine is stuck with qemu assert

issue

  • podman을 설치해보겠다고... 설치하고 podman machine을 실행하다가 계속 starting 상태에서 멈춰있음

  • log를 좀 찍어봤음

# machine init
podman machine init --cpus 4 --disk-size 50 --memory 4096 --rootful
@juner417
juner417 / test-cert-manager.sh
Created October 19, 2023 15:00
test-cert-manager.sh
#!/bin/bash
CERTM_VER=${CERTM_VER:-"v1.13.1"}
CERTM_HN_PORT=${CERTM_HN_PORT:-"10443"}
SS_ISSUE=${SS_ISSUE:-"ss-issuer.yaml"}
EXAM_CERT=${EXAM_CERT:-"example-cert.yaml"}
YEL='\033[1;33m'
NC='\033[0m' # No Color
@juner417
juner417 / installa-for-test.sh
Created October 17, 2023 15:26
installa-for-test.sh
#!/bin/bash
# install tmux
sudo apt update
sudo apt install -y \
tmux \
golang-go
# install docker : so convenience tools, only for testing
# from https://docs.docker.com/engine/install/ubuntu/
@juner417
juner417 / k8s-dns-lookup-timeout.md
Created September 6, 2023 14:24
k8s dns lookup timeout

dns delay issue

증상:

  • k8s pod에서 api 호출시 간헐적인 timeout 발생(5s)
  • 사용자 클러스터에서 확인을 해보니 dns resolving시 5초 정도의 딜레이가 생기고 다시 리졸빙한 이력이 있다(tcpdump 내용)
  • A(ipv4), AAAA(ipv6)로 동시에 요청을 보내는데 응답이 안오는 경우가 간헐적으로 있고, 5초 정도의 딜레이가 생기고 다시 요청한다.

추가 확인

  • dns resolving시 pod → kube-dns → local dns resolver 로 dns search를 하는 과정에서 no such domain의 딜레이가 발생함
  • no such domain(NXDOMAIN)의 경우는 k8s의 dns resolving시 클러스터 dns의 kube-dns를 조회하는 과정에서 생긴 결과이고,
@juner417
juner417 / aws-lb-controller-example.md
Created July 11, 2023 16:40
aws-lb-controller-example.md

aws lb controller

iam 정책 추가.

curl -O https://raw.githubusercontent.com/kubernetes-sigs/aws-load-balancer-controller/v2.4.7/docs/install/iam_policy.json


aws iam create-policy \
    --policy-name AWSLoadBalancerControllerIAMPolicy \
@juner417
juner417 / kind-example.md
Created August 10, 2022 08:39
kind-example.md
@juner417
juner417 / ccnp.md
Last active March 16, 2022 11:47
CiliumClusterwideNetworkPolicy