Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# flock_lock_test.sh
(
# flock -w: timeout 20sec, -n: 바로 lock을 얻을수 없을경우 대기 하기 보다는 fail
# 200은 fd
flock -n -w 20 200
if [ "$?" != "0" ]; then
echo "locked"
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os, sys, subprocess, pexpect
msg = 'Are you sure you want to continue connecting'
con_msg = 'rcp -r ./test/ acc@server:~/'
child = pexpect.spawn(con_msg)
#index = child.expect([msg, 'password:', pexpect.EOF, pexpect.TIMEOUT], 1)
@juner417
juner417 / docker-in-docker.yaml
Created February 10, 2022 14:51
docker-in-docker.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: prepull
spec:
selector:
matchLabels:
name: prepull
template:
metadata:
@juner417
juner417 / containerd-in-container.yaml
Created February 10, 2022 15:14
containerd-in-container.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: prepull
spec:
selector:
matchLabels:
name: prepull
template:
metadata:
@juner417
juner417 / ccnp-test.md
Created February 23, 2022 11:44
ccnp-test.md

ccnp for master node

apiVersion: "cilium.io/v2"
kind: CiliumClusterwideNetworkPolicy
metadata:
  name: "host-policy-for-master"
spec:
  description: ""
  nodeSelector:
    matchLabels:
@juner417
juner417 / ccnp.md
Last active March 16, 2022 11:47
CiliumClusterwideNetworkPolicy
@juner417
juner417 / kind-example.md
Created August 10, 2022 08:39
kind-example.md
@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 / 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 / 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/