Skip to content

Instantly share code, notes, and snippets.

View chenchun's full-sized avatar
🦖
go for{vacation()}

Chun Chen chenchun

🦖
go for{vacation()}
View GitHub Profile
@chenchun
chenchun / pod_liftcycle.md
Last active July 30, 2018 07:37
kubernetes pod lifecycle #k8s, #kubernetes

kubernetes/kubernetes#20379 (comment)

@dcbw, your case seems different. The two DELETE events were just caused by how apisever and kubelet handles pod deletion.

apiserver sets the DeletionTimeStamp -> kubelet gets a DELETE event kubelet terminates the containers gracefully kubelet sends a request to the apiserver to actually remove the pod object (with DeletionGracePeriod=0) apiserver sets the DeletionGracePeriod -> kubelet gets a DELETE event again because of the udpate apiserver deletes the object -> kubelet gets a REMOVE event.

@chenchun
chenchun / xhyve.md
Last active July 30, 2018 08:15
mac osx hypervisor #xhyve #hypervisor
@chenchun
chenchun / haproxy-restart.md
Last active December 20, 2018 05:13
#haproxy
  1. Stopping and restarting HAProxy

HAProxy supports a graceful and a hard stop. The hard stop is simple, when the SIGTERM signal is sent to the haproxy process, it immediately quits and all established connections are closed. The graceful stop is triggered when the SIGUSR1 signal is sent to the haproxy process. It consists in only unbinding from listening ports, but continue to process existing connections until they close. Once the last connection is closed, the process leaves.

@chenchun
chenchun / top.txt
Last active July 30, 2018 08:10
#top
以前只是在 linux 机器上使用 top 命令。常用的快键键是:
p 键 - 按 cpu 使用率排序
m 键 - 按内存使用量排序
这 2 个快捷键在 mac 上都不一样。对应的是,先输入 o,然后输入 cpu 则按 cpu 使用量排序,输入 rsize 则按内存使用量排序。
@chenchun
chenchun / dig.md
Last active August 27, 2019 06:37
#dig #dns #docker
dig hostname
dig hostname A +short
dig hostname AAAA +short
dig hostname A hostname AAAA +short

DNS系统中,常见的资源记录类型有:

  • 主机记录(A记录):RFC 1035定义,A记录是用于名称解析的重要记录,它将特定的主机名映射到对应主机的IP地址上。
@chenchun
chenchun / idea.sh
Last active July 13, 2020 10:59
#idea #veth
umount /var/run/netns/idea &> /dev/null || true
docker rm -vf idea &> /dev/null || true
ip link del p1 &> /dev/null || true
docker run -d --name=idea --net=none --restart=always chenchun/ideals
pid=`docker inspect -f {{.State.Pid}} idea`
mkdir -p /var/run/netns/
touch /var/run/netns/idea
mount --bind /proc/$pid/ns/net /var/run/netns/idea
ip link add p1 type veth peer name p2
ip link set p2 netns idea
@chenchun
chenchun / sqllite3.md
Last active August 13, 2019 03:42
#sqllite #sqlite3
[root@tbds-100-88-65-29 /data/gaia/docker]# sqlite3 linkgraph.db 
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .databases
seq  name             file                                                      
---  ---------------  ----------------------------------------------------------
0    main             /data/gaia/docker/linkgraph.db                            
sqlite> .tables   
@chenchun
chenchun / Gobgp.md
Last active September 11, 2018 07:45
#bgp
  • GoBGP is just a bgp daemon and itself does not contain any functionality to modify routing table
  • If you like to use GoBGP as a component of software router and do packet forwarding, you need to implement that
  • There are two options to achieve FIB manipulation with GoBGP
    • Use built-in zebra integration
    • Write your own code using gRPC API
@chenchun
chenchun / Maglev.md
Last active November 18, 2019 02:38
load balance #loadbalance #lb