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 / 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 / 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 / top.txt
Last active July 30, 2018 08:10
#top
以前只是在 linux 机器上使用 top 命令。常用的快键键是:
p 键 - 按 cpu 使用率排序
m 键 - 按内存使用量排序
这 2 个快捷键在 mac 上都不一样。对应的是,先输入 o,然后输入 cpu 则按 cpu 使用量排序,输入 rsize 则按内存使用量排序。
@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 / xhyve.md
Last active July 30, 2018 08:15
mac osx hypervisor #xhyve #hypervisor
@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 / gist:4a6fcce0eed1e6a842f722f1d69197d5
Created November 13, 2017 04:41 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@chenchun
chenchun / infinite_arp.sh
Last active July 30, 2018 08:17
#hairpin mode
ip link add br0 type bridge
ip link add br1 type bridge
ip link add dev v0 type veth peer name v1
ip link set v0 master br0
ip link set v1 master br1
ip link set br0 up
ip link set br1 up
ip link set v0 up
ip link set v1 up
ip ad add 192.168.0.1/24 dev br0